From c18ffbccdfb931581bdfd51c703cda9391a731ad Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 9 Oct 2024 17:49:26 +0200 Subject: [PATCH 1/4] ci: upgrade lychee, the link checker There is now a v2 of `lychee-action` and we no longer need to use the nightly version because lychee v0.16.1 includes support for the option to fall back on appending the `.html` file extension. Signed-off-by: Johannes Schindelin --- .github/actions/deploy-to-github-pages/action.yml | 3 +-- .github/workflows/ci.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/deploy-to-github-pages/action.yml b/.github/actions/deploy-to-github-pages/action.yml index 1713f45990..8fa370245f 100644 --- a/.github/actions/deploy-to-github-pages/action.yml +++ b/.github/actions/deploy-to-github-pages/action.yml @@ -122,9 +122,8 @@ runs: - name: check for broken links id: lychee - uses: lycheeverse/lychee-action@d4128702eae98bbc5ecf74df0165a8156c80920a # until an official version is out that includes https://github.com/lycheeverse/lychee/pull/1422 + uses: lycheeverse/lychee-action@v2 with: - lycheeVersion: nightly # until an official version includes https://github.com/lycheeverse/lychee/pull/1422 args: >- --offline --fallback-extensions html diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e723882fa3..418873d8d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,9 +60,8 @@ jobs: - name: check for broken links id: lychee - uses: lycheeverse/lychee-action@d4128702eae98bbc5ecf74df0165a8156c80920a # until an official version is out that includes https://github.com/lycheeverse/lychee/pull/1422 + uses: lycheeverse/lychee-action@v2 with: - lycheeVersion: nightly # until an official version includes https://github.com/lycheeverse/lychee/pull/1422 args: >- --offline --fallback-extensions html From b4cf2f4de7231428b547d8ac21f9e7b57e73ae9e Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 9 Oct 2024 17:51:02 +0200 Subject: [PATCH 2/4] deploy: only try to open/close a ticket if lychee actually ran If the link check was not run for any particular reason, we do not have enough information to open, update or close a "broken link(s)" ticket. Signed-off-by: Johannes Schindelin --- .github/actions/deploy-to-github-pages/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/deploy-to-github-pages/action.yml b/.github/actions/deploy-to-github-pages/action.yml index 8fa370245f..a3c6ad88e9 100644 --- a/.github/actions/deploy-to-github-pages/action.yml +++ b/.github/actions/deploy-to-github-pages/action.yml @@ -144,6 +144,7 @@ runs: failIfEmpty: false # needed because its default overrides `fail = false` - name: ${{ env.lychee_exit_code != '0' && 'maybe close' || 'open or update' }} link checker issue + if: env.lychee_exit_code != '' uses: actions/github-script@v7 with: github-token: ${{ inputs.github-token }} From 08c24b2cb063bc90a0fa13210a42232fed377a19 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 9 Oct 2024 17:52:20 +0200 Subject: [PATCH 3/4] deploy: fix inverted logic If lychee's exit code is 0, we want to close any open "broken link(s)" ticket, not when its exit code is non-zero. Not that it matters much because GitHub Actions seems not to show the labels of composite Actions in the logs, at least not at time of writing. Signed-off-by: Johannes Schindelin --- .github/actions/deploy-to-github-pages/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-github-pages/action.yml b/.github/actions/deploy-to-github-pages/action.yml index a3c6ad88e9..7c5bfc1009 100644 --- a/.github/actions/deploy-to-github-pages/action.yml +++ b/.github/actions/deploy-to-github-pages/action.yml @@ -143,7 +143,7 @@ runs: fail: false failIfEmpty: false # needed because its default overrides `fail = false` - - name: ${{ env.lychee_exit_code != '0' && 'maybe close' || 'open or update' }} link checker issue + - name: ${{ env.lychee_exit_code != '0' && 'open or update' || 'maybe close' }} link checker issue if: env.lychee_exit_code != '' uses: actions/github-script@v7 with: From 72393de77123d182138b5a9a611f43ff919b27f5 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 9 Oct 2024 17:55:39 +0200 Subject: [PATCH 4/4] ci/deploy: only upload the playwright report if the tests actually ran Otherwise it does not make much sense trying to upload the results. Not that it matters much: If the file does not exist, there will be a warning and nothing gets uploaded anyway. Signed-off-by: Johannes Schindelin --- .github/actions/deploy-to-github-pages/action.yml | 4 +++- .github/workflows/ci.yml | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/actions/deploy-to-github-pages/action.yml b/.github/actions/deploy-to-github-pages/action.yml index 7c5bfc1009..d11464ed94 100644 --- a/.github/actions/deploy-to-github-pages/action.yml +++ b/.github/actions/deploy-to-github-pages/action.yml @@ -198,6 +198,7 @@ runs: run: sudo sh -c 'echo "185.199.108.153 git-scm.com" >>/etc/hosts' - name: Run Playwright tests shell: bash + id: playwright env: PLAYWRIGHT_TEST_URL: ${{ steps.pages.outputs.base_url }} run: | @@ -206,9 +207,10 @@ runs: https://*|http://git-scm.com) ;; # okay, leave as-is http://*) PLAYWRIGHT_TEST_URL="https://${PLAYWRIGHT_TEST_URL#http://}";; esac && + echo "result=$PLAYWRIGHT_TEST_URL" >>$GITHUB_OUTPUT && npx playwright test --project=chrome - uses: actions/upload-artifact@v4 - if: always() + if: always() && steps.playwright.outputs.result != '' with: name: playwright-report path: playwright-report/ \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 418873d8d7..7513da65b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,11 +79,14 @@ jobs: - name: Install @playwright/test run: npm install @playwright/test - name: Run Playwright tests + id: playwright env: PLAYWRIGHT_TEST_URL: http://localhost:5000/ - run: npx playwright test --project=chrome + run: | + echo "result=$PLAYWRIGHT_TEST_URL" >>$GITHUB_OUTPUT && + npx playwright test --project=chrome - uses: actions/upload-artifact@v4 - if: always() + if: always() && steps.playwright.outputs.result != '' with: name: playwright-report path: playwright-report/ \ No newline at end of file