|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["*"] |
| 6 | + pull_request: |
| 7 | + branches: ["*"] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + id-token: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + determine_version: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + outputs: |
| 17 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 18 | + steps: |
| 19 | + - id: set-matrix |
| 20 | + run: | |
| 21 | + if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref }}" == 'refs/heads/main' ]]; then |
| 22 | + # Push to main branch |
| 23 | + echo 'matrix=["3.10", "3.11", "3.12", "3.13", "3.14"]' >> $GITHUB_OUTPUT |
| 24 | + elif [[ "${{ github.event_name }}" == 'pull_request' && "${{ github.event.pull_request.base.ref }}" == 'main' ]]; then |
| 25 | + # PR to main branch |
| 26 | + echo 'matrix=[ "3.10", "3.11", "3.12", "3.13", "3.14"]' >> $GITHUB_OUTPUT |
| 27 | + else |
| 28 | + echo 'matrix=["3.10", "3.13"]' >> $GITHUB_OUTPUT |
| 29 | + fi |
| 30 | +
|
| 31 | + build: |
| 32 | + needs: determine_version |
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + platform: [ubuntu-latest] |
| 36 | + python-version: ${{fromJson(needs.determine_version.outputs.matrix)}} |
| 37 | + |
| 38 | + runs-on: ${{ matrix.platform }} |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v5 |
| 42 | + with: |
| 43 | + submodules: true |
| 44 | + |
| 45 | + - name: Set up Python ${{ matrix.python-version }} |
| 46 | + uses: actions/setup-python@v6 |
| 47 | + with: |
| 48 | + python-version: ${{ matrix.python-version }} |
| 49 | + |
| 50 | + - uses: actions/cache@v4 |
| 51 | + with: |
| 52 | + path: ${{ env.pythonLocation }} |
| 53 | + key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('docs/requirements.txt') }} |
| 54 | + |
| 55 | + # Install dependencies |
| 56 | + - name: Install dependencies |
| 57 | + run: | |
| 58 | + python -m pip install --upgrade pip |
| 59 | + pip install -r requirements.txt |
| 60 | + pip install -r docs/requirements.txt |
| 61 | + pip install -e .[test] |
| 62 | +
|
| 63 | + # Run spec tests without coverage for non Python 3.10 |
| 64 | + - name: Run spec_test |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ github.token }} |
| 67 | + continue-on-error: true |
| 68 | + run: | |
| 69 | + python -m unittest discover spec_tests |
| 70 | +
|
| 71 | + # Run unittest without coverage |
| 72 | + - name: Test with unittest |
| 73 | + env: |
| 74 | + GITHUB_TOKEN: ${{ github.token }} |
| 75 | + run: | |
| 76 | + python -m unittest discover tests |
0 commit comments