Merge pull request #680 from instructlab/update-constraints #1282
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Test | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "main" | |
| - "release-**" | |
| paths: | |
| - '**.py' | |
| - 'pyproject.toml' | |
| - 'requirements*.txt' | |
| - 'constraints-dev.txt' | |
| - 'tox.ini' | |
| - '.github/workflows/test.yml' # This workflow | |
| pull_request: | |
| branches: | |
| - "main" | |
| - "release-**" | |
| paths: | |
| - '**.py' | |
| - 'pyproject.toml' | |
| - 'requirements*.txt' | |
| - 'constraints-dev.txt' | |
| - 'tox.ini' | |
| - '.github/workflows/test.yml' # This workflow | |
| env: | |
| LC_ALL: en_US.UTF-8 | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: "${{ matrix.python }} on ${{ matrix.platform }}" | |
| runs-on: "${{ matrix.platform }}" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: | |
| - "3.11" | |
| - "3.12" | |
| platform: | |
| - "ubuntu-latest" | |
| include: | |
| - python: "3.11" | |
| platform: "macos-latest" | |
| - python: "3.12" | |
| platform: "macos-latest" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| # https://github.com/actions/checkout/issues/249 | |
| fetch-depth: 0 | |
| - name: Free disk space | |
| if: matrix.platform != 'macos-latest' | |
| uses: ./.github/actions/free-disk-space | |
| - name: Install the expect package | |
| if: startsWith(matrix.platform, 'ubuntu') | |
| run: | | |
| sudo apt-get install -y expect | |
| - name: Install tools on MacOS | |
| if: startsWith(matrix.platform, 'macos') | |
| run: | | |
| brew install expect coreutils bash | |
| - name: Setup Python ${{ matrix.python }} | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| cache: pip | |
| cache-dependency-path: | | |
| **/pyproject.toml | |
| **/requirements*.txt | |
| - name: Remove llama-cpp-python from cache | |
| run: | | |
| pip cache remove llama_cpp_python | |
| - name: Cache huggingface | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| with: | |
| path: ~/.cache/huggingface | |
| # config contains DEFAULT_MODEL | |
| key: huggingface-${{ hashFiles('src/instructlab/configuration.py') }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install tox tox-gh>=1.2 -c constraints-dev.txt | |
| - name: Run unit and functional tests with tox | |
| run: | | |
| tox | |
| - name: Remove llama-cpp-python from cache | |
| if: always() | |
| run: | | |
| pip cache remove llama_cpp_python | |
| test-workflow-complete: | |
| needs: ["test"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Test Workflow Complete | |
| run: echo "Test Workflow Complete" |