Debian Codegraph @

.github/workflows/tests.yml

raw
1 name: Tests
2
3 on:
4 # NOTE: github.event context is push payload:
5 # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
6 push:
7 branches:
8 - main
9 - feature/**
10
11 # NOTE: github.event context is pull_request payload:
12 # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
13 pull_request:
14
15 concurrency:
16 # Concurrency group that uses the workflow name and PR number if available
17 # or commit SHA as a fallback. If a new build is triggered under that
18 # concurrency group while a previous build is running it will be canceled.
19 # Repeated pushes to a PR will cancel all previous builds, while multiple
20 # merges to main will not cancel.
21 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
22 cancel-in-progress: true
23
24 jobs:
25 linux:
26 runs-on: ubuntu-latest
27 defaults:
28 run:
29 shell: bash -l {0}
30 strategy:
31 fail-fast: false
32 matrix:
33 python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
34
35 steps:
36 - name: Checkout repository
37 uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
38 with:
39 fetch-depth: 0
40
41 - name: Setup Miniconda
42 uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
43 with:
44 python-version: ${{ matrix.python-version }}
45 channels: defaults
46 activate-environment: test_env
47 auto-update-conda: false
48 auto-activate-base: false
49 show-channel-urls: true
50
51 - name: Source Scripts
52 run: |
53 set -x
54 # conda is our test dependency but can't be pip installed
55 conda install --quiet conda pip
56 pip install -e .[test]
57 conda info --json
58 echo "condarc"
59 cat ~/.condarc
60 echo "conda_pkgs_dir"
61 ls /home/runner/conda_pkgs_dir
62 echo "miniconda/pkgs"
63 ls /usr/share/miniconda/pkgs
64 echo "test_env"
65 ls /usr/share/miniconda/envs/test_env
66 pytest
67
68 analyze:
69 name: Analyze test results
70 needs: [linux]
71 if: always()
72 runs-on: ubuntu-latest
73 steps:
74 - name: Download test results
75 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
76
77 - name: Upload combined test results
78 # provides one downloadable archive of all .coverage/test-report.xml files
79 # of all matrix runs for further analysis.
80 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
81 with:
82 name: test-results-${{ github.sha }}-all
83 path: test-results-${{ github.sha }}-*
84 retention-days: 90 # default: 90
85
86 - name: Test Summary
87 uses: test-summary/action@37b508cfee6d4d080eedd00b5bb240a6a784a6a5 # v2.6
88 with:
89 paths: ./test-results-${{ github.sha }}-**/test-report*.xml
90
91 - name: Decide whether the needed jobs succeeded or failed
92 uses: re-actors/alls-green@release/v1
93 with:
94 jobs: ${{ toJSON(needs) }}