| 1 | name: Test |
| 2 | |
| 3 | on: [push, pull_request] |
| 4 | |
| 5 | permissions: |
| 6 | contents: read |
| 7 | |
| 8 | concurrency: |
| 9 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} |
| 10 | cancel-in-progress: true |
| 11 | |
| 12 | jobs: |
| 13 | test: |
| 14 | if: |
| 15 | github.event_name == 'push' || github.event.pull_request.head.repo.full_name != |
| 16 | github.repository |
| 17 | |
| 18 | runs-on: ${{ matrix.os }} |
| 19 | strategy: |
| 20 | fail-fast: false |
| 21 | matrix: |
| 22 | python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] |
| 23 | os: [ubuntu-latest, macOS-latest, windows-latest] |
| 24 | |
| 25 | steps: |
| 26 | - uses: actions/checkout@v3 |
| 27 | |
| 28 | - name: Set up Python ${{ matrix.python-version }} |
| 29 | uses: actions/setup-python@v4 |
| 30 | id: setup_python |
| 31 | with: |
| 32 | python-version: ${{ matrix.python-version }} |
| 33 | allow-prereleases: true |
| 34 | |
| 35 | - name: Install virtualenv |
| 36 | run: | |
| 37 | python -m pip install --upgrade pip |
| 38 | python -m pip install --upgrade virtualenv |
| 39 | - name: Run tests |
| 40 | env: |
| 41 | ABSL_EXPECTED_PYTHON_VERSION: ${{ matrix.python-version }} |
| 42 | ABSL_COPY_TESTLOGS_TO: ci-artifacts |
| 43 | shell: bash |
| 44 | run: ci/run_tests.sh |
| 45 | |
| 46 | - name: Upload bazel test logs |
| 47 | uses: actions/upload-artifact@v3 |
| 48 | with: |
| 49 | name: bazel-testlogs-${{ matrix.os }}-${{ matrix.python-version }} |
| 50 | path: ci-artifacts |