|
23 | 23 | - essreflectometry |
24 | 24 | - esssans |
25 | 25 | - essspectroscopy |
| 26 | + # Packages whose tests write reduced data files via the --file-output |
| 27 | + # pytest option. Their output is collected and published to the |
| 28 | + # `reduced_data_nightly` release by the `publish` job below. To publish data |
| 29 | + # from another package, add a `--file-output`/`output_folder` fixture to |
| 30 | + # its conftest and list it here. |
| 31 | + include: |
| 32 | + - package: essdiffraction |
| 33 | + file_output: true |
| 34 | + - package: essreflectometry |
| 35 | + file_output: true |
26 | 36 | runs-on: ubuntu-24.04 |
27 | 37 | steps: |
28 | 38 | - uses: actions/checkout@v6 |
|
34 | 44 | frozen: true |
35 | 45 | environments: ${{ matrix.package }} |
36 | 46 | - name: Run tests |
37 | | - run: pixi run -e ${{ matrix.package }} test ${{ matrix.package }} |
| 47 | + run: pixi run -e ${{ matrix.package }} test ${{ matrix.package }} ${{ matrix.file_output && '-- --file-output=tests_outputs' || '' }} |
| 48 | + - name: Upload reduced data files |
| 49 | + if: matrix.file_output |
| 50 | + uses: actions/upload-artifact@v7 |
| 51 | + with: |
| 52 | + name: reduced-data-${{ matrix.package }} |
| 53 | + path: tests_outputs/ |
| 54 | + if-no-files-found: warn |
| 55 | + |
| 56 | + publish: |
| 57 | + name: Publish nightly reduced data |
| 58 | + needs: test |
| 59 | + runs-on: ubuntu-24.04 |
| 60 | + permissions: |
| 61 | + contents: write |
| 62 | + steps: |
| 63 | + - name: Download reduced data files |
| 64 | + uses: actions/download-artifact@v8 |
| 65 | + with: |
| 66 | + path: ./artifacts |
| 67 | + pattern: reduced-data-* |
| 68 | + merge-multiple: true |
| 69 | + - name: Check for reduced data files |
| 70 | + id: check |
| 71 | + run: | |
| 72 | + shopt -s nullglob |
| 73 | + files=(./artifacts/*) |
| 74 | + if [ ${#files[@]} -eq 0 ]; then |
| 75 | + echo "No reduced data files were produced; nothing to publish." |
| 76 | + echo "found=false" >> "$GITHUB_OUTPUT" |
| 77 | + else |
| 78 | + echo "Publishing ${#files[@]} file(s):" |
| 79 | + printf ' %s\n' "${files[@]}" |
| 80 | + echo "found=true" >> "$GITHUB_OUTPUT" |
| 81 | + fi |
| 82 | + # Upload assets to the existing `reduced_data_nightly` release, overwriting |
| 83 | + # the previous night's files. Updating assets in place (rather than |
| 84 | + # deleting and recreating the release) avoids generating a release |
| 85 | + # notification on every nightly run. |
| 86 | + - name: Upload to nightly release |
| 87 | + if: steps.check.outputs.found == 'true' |
| 88 | + uses: svenstaro/upload-release-action@v2 |
| 89 | + with: |
| 90 | + file: ./artifacts/* |
| 91 | + file_glob: true |
| 92 | + tag: reduced_data_nightly |
| 93 | + overwrite: true |
| 94 | + prerelease: true |
| 95 | + - name: Update release notes |
| 96 | + if: steps.check.outputs.found == 'true' |
| 97 | + env: |
| 98 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 99 | + GH_REPO: ${{ github.repository }} |
| 100 | + run: | |
| 101 | + gh release edit reduced_data_nightly \ |
| 102 | + --notes "Automated nightly build from $(date -u +%Y-%m-%dT%H:%MZ) (commit ${GITHUB_SHA::7})" |
38 | 103 |
|
39 | 104 | lower-bound: |
40 | 105 | name: Lower bound ${{ matrix.package }} |
|
0 commit comments