|
| 1 | +# run test suites |
| 2 | + |
| 3 | +name: Tests |
| 4 | +on: |
| 5 | + - pull_request |
| 6 | + - push |
| 7 | + - release |
| 8 | + - workflow_dispatch |
| 9 | + |
| 10 | +# cancel the current workflow if another commit was pushed on the same PR or reference |
| 11 | +# uses the GitHub workflow name to avoid collision with other workflows running on the same PR/reference |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + # see: https://github.com/fkirc/skip-duplicate-actions |
| 18 | + skip_duplicate: |
| 19 | + continue-on-error: true |
| 20 | + runs-on: ubuntu-latest |
| 21 | + outputs: |
| 22 | + should_skip: ${{ steps.skip_duplicate.outputs.should_skip && ! contains(github.ref, 'refs/tags') && ! contains(github.ref, 'refs/heads/main') }} |
| 23 | + steps: |
| 24 | + - uses: fkirc/skip-duplicate-actions@master |
| 25 | + with: |
| 26 | + concurrent_skipping: "same_content_newer" |
| 27 | + skip_after_successful_duplicate: "true" |
| 28 | + cancel_others: "true" |
| 29 | + do_not_skip: '["workflow_dispatch", "schedule", "release"]' |
| 30 | + |
| 31 | + # see: https://github.com/actions/setup-python |
| 32 | + tests: |
| 33 | + needs: skip_duplicate |
| 34 | + if: ${{ needs.skip_duplicate.outputs.should_skip != 'true' }} |
| 35 | + runs-on: ${{ matrix.os }} |
| 36 | + continue-on-error: ${{ matrix.allow-failure }} |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + os: [ubuntu-latest] |
| 40 | + python-version: ["3.10", "3.11", "3.12", "3.13"] |
| 41 | + test-case: ["test-only"] |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v2 |
| 44 | + with: |
| 45 | + fetch-depth: "0" |
| 46 | + - name: Setup Python |
| 47 | + uses: actions/setup-python@v5 |
| 48 | + with: |
| 49 | + python-version: "${{ matrix.python-version }}" |
| 50 | + cache: 'pip' |
| 51 | + - name: Parse Python Version |
| 52 | + id: python-semver |
| 53 | + run: | |
| 54 | + echo "::set-output name=major:$(echo ${{ matrix.python-version }} | cut -d '.' -f 1)" |
| 55 | + echo "::set-output name=minor:$(echo ${{ matrix.python-version }} | cut -d '.' -f 2)" |
| 56 | + - name: Install Dependencies |
| 57 | + run: make install-dev |
| 58 | + - name: Display Packages |
| 59 | + run: | |
| 60 | + pip freeze |
| 61 | + make info |
| 62 | + - name: Display Environment Variables |
| 63 | + run: | |
| 64 | + hash -r |
| 65 | + env | sort |
| 66 | + - name: Run Tests |
| 67 | + run: make ${{ matrix.test-case }} |
0 commit comments