From e8797d7bc7e47ccf376d9570eae47d404a733832 Mon Sep 17 00:00:00 2001 From: Fotis Nikolaidis Date: Tue, 7 Nov 2023 16:18:35 +0200 Subject: [PATCH] update ci and fix openai version Signed-off-by: Fotis Nikolaidis --- .github/workflows/cache-builder.yml | 55 +++++++++++++++++++++++++++++ .github/workflows/ci_code.yml | 4 +-- .github/workflows/ci_docs.yaml | 9 +++-- .github/workflows/release.yaml | 2 +- pyproject.toml | 2 +- 5 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/cache-builder.yml diff --git a/.github/workflows/cache-builder.yml b/.github/workflows/cache-builder.yml new file mode 100644 index 000000000..c0aeec132 --- /dev/null +++ b/.github/workflows/cache-builder.yml @@ -0,0 +1,55 @@ +name: Update Cache +on: + push: + branches: + - main + paths: # run this action only when the docs folder is changed + - 'pyproject.toml' + workflow_dispatch: # allows triggering a GitHub action manually - see 'Actions' tab + + +# When this workflow is queued, automatically cancel any previous running +# or pending jobs from the same branch +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + + +jobs: + #--------------------------------------------------- + # Cache Builder + #--------------------------------------------------- + cache-builder: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ "ubuntu-latest" ] # TODO: add "windows-latest", "macos-latest" when Docker removed + python-version: ["3.8", "3.11"] # Due to cache limitations, check only the earliest and the latest. + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + #--------------------------------------------------- + # Configuring Python environments. + # + # We intentionally commented the `cache` field to remind us not to enable it. + # The reason is that most of the time is spent on package installation rather than package downloading. + # As a result, in the next step, we will cache the complete Python environment, including all pre-installed components. + - name: Set up Python ${{ matrix.python-version }} + id: setup-python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + #cache: 'pip' # Do not activate + + - name: Cache Python ${{ matrix.python-version }} + uses: actions/cache@v3 + with: + path: ${{ env.pythonLocation }} + key: ${{ matrix.os }}_python-${{ matrix.python-version }}_${{ hashFiles('**/pyproject.toml') }} + #--------------------------------------------------- + + - name: Install Dev Dependencies + run: python -m pip install --upgrade .[dev] \ No newline at end of file diff --git a/.github/workflows/ci_code.yml b/.github/workflows/ci_code.yml index 051d2407e..a06c79a03 100644 --- a/.github/workflows/ci_code.yml +++ b/.github/workflows/ci_code.yml @@ -1,4 +1,4 @@ -name: Validate code changes +name: Code Testing on: # rules for when this action will be triggered pull_request: @@ -47,7 +47,7 @@ jobs: uses: actions/cache@v3 with: path: ${{ env.pythonLocation }} - key: ${{ matrix.os }}_python-${{ matrix.python-version }}_${{ hashFiles('pyproject.toml') }} + key: ${{ matrix.os }}_python-${{ matrix.python-version }}_${{ hashFiles('**/pyproject.toml') }} #--------------------------------------------------- - name: Install Dependencies diff --git a/.github/workflows/ci_docs.yaml b/.github/workflows/ci_docs.yaml index 85668c9e1..3936cd5bd 100644 --- a/.github/workflows/ci_docs.yaml +++ b/.github/workflows/ci_docs.yaml @@ -1,4 +1,4 @@ -name: Publish Doc Changes +name: Build Doc Website on: push: branches: @@ -27,18 +27,18 @@ jobs: sudo apt-get update sudo apt-get install nodejs npm - - name: Set up Python 3.10 + - name: Set up Python 3.11 id: setup-python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Cache pip packages uses: actions/cache@v3 with: path: | ${{ env.pythonLocation }} - key: python3.10_ubuntu-latest_${{ hashFiles('**/pyproject.toml') }} + key: ubuntu-latest_python-3.11_${{ hashFiles('**/pyproject.toml') }} - name: Build docs and use-cases # build is available in docs/hr/build @@ -46,7 +46,6 @@ jobs: make hr-docs - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' run: pip install .[docs] - name: Build inline api docs diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 235af2a17..5940050d0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Release new version +name: Release in Pypi/DockerHub on: push: branches: diff --git a/pyproject.toml b/pyproject.toml index 78a6bf7bc..fea3ea949 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,7 +74,7 @@ torch = [ "torchvision", ] apis = [ - "openai>=0.27.6", + "openai==0.27.6", "cohere", "anthropic", ]