|
1 | 1 | name: Matrix and Codecov |
2 | 2 |
|
3 | 3 | on: |
4 | | - # push: |
5 | | - # branches: |
6 | | - # - main |
7 | | - release: |
8 | | - types: |
9 | | - - prereleased |
10 | | - - published |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | + workflow_call: |
| 9 | + secrets: |
| 10 | + CODECOV_TOKEN: |
| 11 | + required: false |
11 | 12 | workflow_dispatch: |
12 | 13 |
|
13 | 14 | concurrency: |
14 | 15 | group: matrix-${{ github.ref }} |
15 | | - cancel-in-progress: ${{ github.event_name != 'release' }} |
| 16 | + cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }} |
16 | 17 |
|
17 | 18 | jobs: |
18 | 19 | matrix-coverage: |
19 | | - name: C++ tests (${{ matrix.os }}, Python ${{ matrix.python-version }}) |
| 20 | + name: C++ tests (${{ matrix.os }}) |
20 | 21 | runs-on: ${{ matrix.os }} |
21 | 22 | timeout-minutes: 45 |
22 | 23 | strategy: |
23 | 24 | fail-fast: false |
24 | 25 | matrix: |
25 | 26 | os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel] |
26 | | - python-version: ["3.12", "3.13", "3.14"] |
27 | 27 | include: |
28 | 28 | - os: ubuntu-latest |
29 | 29 | shell: bash -l {0} |
@@ -51,48 +51,21 @@ jobs: |
51 | 51 | with: |
52 | 52 | fetch-depth: 0 |
53 | 53 |
|
54 | | - - name: Fetch upstream release tags |
55 | | - run: git fetch --tags https://github.com/diffpy/libdiffpy.git |
56 | | - |
57 | | - # CxxTest is header-only and its generator runs directly from source. |
58 | | - # The conda-forge package is not available on every matrix platform. |
59 | | - - name: Check out CxxTest 4.4 |
60 | | - uses: actions/checkout@v6 |
61 | | - with: |
62 | | - repository: CxxTest/cxxtest |
63 | | - ref: 191adddb3876ab389c0c856e1c03874bf70f8ee4 |
64 | | - path: build/cxxtest |
65 | | - |
66 | | - - name: Prepare C++ test configuration |
67 | | - shell: python {0} |
68 | | - run: | |
69 | | - import runpy |
70 | | - runpy.run_path('.github/scripts/configure-matrix.py') |
71 | | -
|
72 | | - - name: Create build environment |
73 | | - uses: conda-incubator/setup-miniconda@v3 |
74 | | - with: |
75 | | - activate-environment: test |
76 | | - channels: conda-forge |
77 | | - conda-remove-defaults: "true" |
78 | | - auto-update-conda: false |
79 | | - auto-activate-base: false |
80 | | - python-version: ${{ matrix.python-version }} |
81 | | - environment-file: build/matrix-environment.yml |
82 | | - channel-priority: strict |
| 54 | + - name: Set up C++ tests |
| 55 | + uses: ./.github/actions/setup-tests |
83 | 56 |
|
84 | 57 | - name: Build and run C++ tests |
85 | 58 | run: scons -j${{ matrix.jobs }} build=${{ matrix.build }} test |
86 | 59 |
|
87 | 60 | - name: Generate coverage report |
88 | | - if: runner.os == 'Linux' && matrix.python-version == '3.14' |
| 61 | + if: runner.os == 'Linux' |
89 | 62 | run: >- |
90 | 63 | gcovr --gcov-executable "$CONDA_PREFIX/bin/gcov" |
91 | 64 | --root . --filter 'build/coverage-.*/diffpy/' |
92 | 65 | --xml coverage.xml |
93 | 66 |
|
94 | 67 | - name: Save coverage report |
95 | | - if: runner.os == 'Linux' && matrix.python-version == '3.14' |
| 68 | + if: runner.os == 'Linux' |
96 | 69 | uses: actions/upload-artifact@v4 |
97 | 70 | with: |
98 | 71 | name: coverage-report |
|
101 | 74 |
|
102 | 75 | - name: Upload coverage to Codecov |
103 | 76 | # Fork push builds have no upstream Codecov token; keep their artifact. |
104 | | - if: >- |
105 | | - runner.os == 'Linux' && matrix.python-version == '3.14' && |
106 | | - github.repository == 'diffpy/libdiffpy' |
| 77 | + if: runner.os == 'Linux' && github.repository == 'diffpy/libdiffpy' |
107 | 78 | uses: codecov/codecov-action@v5 |
108 | 79 | with: |
109 | 80 | files: coverage.xml |
|
0 commit comments