From 3257ea97d2420969be840ca04fd200a7e1d4374f Mon Sep 17 00:00:00 2001 From: Mridul Seth Date: Thu, 21 May 2026 16:47:40 +0200 Subject: [PATCH 1/6] [CI] Publish nightly reduced data files --- .github/workflows/nightly.yml | 54 ++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4bdce9fac..7eb424162 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,6 +1,7 @@ name: Nightly Tests on: + pull_request: workflow_dispatch: schedule: - cron: "30 1 * * 1-5" @@ -23,6 +24,16 @@ jobs: - essreflectometry - esssans - essspectroscopy + # Packages whose tests write reduced data files via the --file-output + # pytest option. Their output is collected and published to the + # `reduced_data_nightly` release by the `publish` job below. To publish data + # from another package, add a `--file-output`/`output_folder` fixture to + # its conftest and list it here. + include: + - package: essdiffraction + file_output: true + - package: essreflectometry + file_output: true runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 @@ -34,7 +45,48 @@ jobs: frozen: true environments: ${{ matrix.package }} - name: Run tests - run: pixi run -e ${{ matrix.package }} test ${{ matrix.package }} + run: pixi run -e ${{ matrix.package }} test ${{ matrix.package }} ${{ matrix.file_output && '-- --file-output=tests_outputs' || '' }} + - name: Upload reduced data files + if: matrix.file_output + uses: actions/upload-artifact@v7 + with: + name: reduced-data-${{ matrix.package }} + path: tests_outputs/ + if-no-files-found: warn + + publish: + name: Publish nightly reduced data + needs: test + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - uses: actions/checkout@v6 + - name: Download reduced data files + uses: actions/download-artifact@v8 + with: + path: ./artifacts + pattern: reduced-data-* + merge-multiple: true + - name: Publish to nightly release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + shopt -s nullglob + files=(./artifacts/*) + if [ ${#files[@]} -eq 0 ]; then + echo "No reduced data files were produced; nothing to publish." + exit 0 + fi + echo "Publishing ${#files[@]} file(s):" + printf ' %s\n' "${files[@]}" + gh release delete reduced_data_nightly --yes --cleanup-tag 2>/dev/null || true + gh release create reduced_data_nightly \ + --target "${{ github.sha }}" \ + --title "Nightly reduced data files" \ + --notes "Automated nightly build from $(date -u +%Y-%m-%dT%H:%MZ) (commit ${GITHUB_SHA::7})" \ + --prerelease \ + "${files[@]}" lower-bound: name: Lower bound ${{ matrix.package }} From 904a6a0bcac3dd8497ea4b4bcc9d1f90b219a33d Mon Sep 17 00:00:00 2001 From: Mridul Seth Date: Thu, 21 May 2026 17:00:46 +0200 Subject: [PATCH 2/6] remove trigger --- .github/workflows/nightly.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7eb424162..cb92ffc39 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,7 +1,6 @@ name: Nightly Tests on: - pull_request: workflow_dispatch: schedule: - cron: "30 1 * * 1-5" From 507691521d375849499dc377d002aa6605c48aca Mon Sep 17 00:00:00 2001 From: Mridul Seth Date: Tue, 2 Jun 2026 22:52:27 +0200 Subject: [PATCH 3/6] Update release assets in place instead of recreating release --- .github/workflows/nightly.yml | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cb92ffc39..2180e1f11 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -60,32 +60,38 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v6 - name: Download reduced data files uses: actions/download-artifact@v8 with: path: ./artifacts pattern: reduced-data-* merge-multiple: true - - name: Publish to nightly release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Check for reduced data files + id: check run: | shopt -s nullglob files=(./artifacts/*) if [ ${#files[@]} -eq 0 ]; then echo "No reduced data files were produced; nothing to publish." - exit 0 + echo "found=false" >> "$GITHUB_OUTPUT" + else + echo "Publishing ${#files[@]} file(s):" + printf ' %s\n' "${files[@]}" + echo "found=true" >> "$GITHUB_OUTPUT" fi - echo "Publishing ${#files[@]} file(s):" - printf ' %s\n' "${files[@]}" - gh release delete reduced_data_nightly --yes --cleanup-tag 2>/dev/null || true - gh release create reduced_data_nightly \ - --target "${{ github.sha }}" \ - --title "Nightly reduced data files" \ - --notes "Automated nightly build from $(date -u +%Y-%m-%dT%H:%MZ) (commit ${GITHUB_SHA::7})" \ - --prerelease \ - "${files[@]}" + # Upload assets to the existing `reduced_data_nightly` release, overwriting + # the previous night's files. Updating assets in place (rather than + # deleting and recreating the release) avoids generating a release + # notification on every nightly run. + - name: Upload to nightly release + if: steps.check.outputs.found == 'true' + uses: svenstaro/upload-release-action@v2 + with: + file: ./artifacts/* + file_glob: true + tag: reduced_data_nightly + overwrite: true + prerelease: true lower-bound: name: Lower bound ${{ matrix.package }} From fe29f118f2b9aee6a9f8f81db2dcd00078e8535c Mon Sep 17 00:00:00 2001 From: Mridul Seth Date: Tue, 2 Jun 2026 22:54:56 +0200 Subject: [PATCH 4/6] trigger --- .github/workflows/nightly.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2180e1f11..adcdc0f59 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,6 +1,7 @@ name: Nightly Tests on: + pull_request: workflow_dispatch: schedule: - cron: "30 1 * * 1-5" From 891bdb083777662e4593c564a5ae9ef545ca74ba Mon Sep 17 00:00:00 2001 From: Mridul Seth Date: Tue, 2 Jun 2026 23:09:17 +0200 Subject: [PATCH 5/6] Refresh nightly release notes on each publish --- .github/workflows/nightly.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index adcdc0f59..ce6c3ec63 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -93,6 +93,14 @@ jobs: tag: reduced_data_nightly overwrite: true prerelease: true + - name: Update release notes + if: steps.check.outputs.found == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + run: | + gh release edit reduced_data_nightly \ + --notes "Automated nightly build from $(date -u +%Y-%m-%dT%H:%MZ) (commit ${GITHUB_SHA::7})" lower-bound: name: Lower bound ${{ matrix.package }} From 4f0baf2e5911d612eb73ef08f859b71d0ac93454 Mon Sep 17 00:00:00 2001 From: Mridul Seth Date: Tue, 2 Jun 2026 23:22:42 +0200 Subject: [PATCH 6/6] Update nightly.yml to remove pull_request trigger --- .github/workflows/nightly.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ce6c3ec63..66fc07615 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,7 +1,6 @@ name: Nightly Tests on: - pull_request: workflow_dispatch: schedule: - cron: "30 1 * * 1-5"