From 20d58441bc92595ec555365eb15acfe534609be4 Mon Sep 17 00:00:00 2001 From: Rune Philosof <57357936+runephilosof-abtion@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:32:26 +0200 Subject: [PATCH 1/4] CI: comment with rspec-stderr We should avoid introducing noisy warnings in our test output. --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96160ff0a..e49fe689e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: [push] +on: [push, pull_request, workflow_dispatch] jobs: rubocop: @@ -220,10 +220,33 @@ jobs: bin/rake db:create bin/rake db:schema:load - name: rspec - run: bin/rspec + run: bin/rspec 2> tmp/rspec-stderr + - name: output tmp/rspec-stderr + run: cat tmp/rspec-stderr + - name: Upload rspec-stderr output + uses: actions/upload-artifact@v4 + with: + name: rspec-stderr + path: tmp/rspec-stderr - name: Archive capybara artifacts uses: actions/upload-artifact@v4 if: failure() with: name: capybara path: tmp/capybara/ + post_to_github_pr: + runs-on: ubuntu-latest + needs: rspec + if: github.event.pull_request + permissions: + pull-requests: write + contents: read + steps: + - name: Download rspec-stderr + uses: actions/download-artifact@v4 + with: + name: rspec-stderr + - name: Post to PR + uses: marocchino/sticky-pull-request-comment@v2 + with: + path: rspec-stderr From 17b96ae2e156cceb7626c09945210db99a4e8de1 Mon Sep 17 00:00:00 2001 From: Rune Philosof <57357936+runephilosof-abtion@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:49:58 +0200 Subject: [PATCH 2/4] CI: Add header to rspec stderr message and only show when present --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e49fe689e..49b6c98f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -220,14 +220,16 @@ jobs: bin/rake db:create bin/rake db:schema:load - name: rspec - run: bin/rspec 2> tmp/rspec-stderr - - name: output tmp/rspec-stderr - run: cat tmp/rspec-stderr + run: bin/rspec 2> tmp/stderr + - name: tmp/rspec-stderr + run: | + test -s tmp/stderr && echo "Rspec stderr output:" > tmp/rspec-stderr && cat tmp/stderr >> tmp/rspec-stderr - name: Upload rspec-stderr output uses: actions/upload-artifact@v4 with: name: rspec-stderr path: tmp/rspec-stderr + if-no-files-found: ignore - name: Archive capybara artifacts uses: actions/upload-artifact@v4 if: failure() @@ -249,4 +251,5 @@ jobs: - name: Post to PR uses: marocchino/sticky-pull-request-comment@v2 with: + ignore_empty: true path: rspec-stderr From a85f4dea5ed0ad0306bdbc8ff3f144f6b8b83ad6 Mon Sep 17 00:00:00 2001 From: Rune Philosof <57357936+runephilosof-abtion@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:54:26 +0200 Subject: [PATCH 3/4] CI: rspec stderr markdown header formatting --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49b6c98f3..aae41d998 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -223,7 +223,7 @@ jobs: run: bin/rspec 2> tmp/stderr - name: tmp/rspec-stderr run: | - test -s tmp/stderr && echo "Rspec stderr output:" > tmp/rspec-stderr && cat tmp/stderr >> tmp/rspec-stderr + test -s tmp/stderr && echo "# Rspec stderr output:" > tmp/rspec-stderr && cat tmp/stderr >> tmp/rspec-stderr - name: Upload rspec-stderr output uses: actions/upload-artifact@v4 with: From 925a3ec4651b746a516b6c3505d536d4d4ee1d20 Mon Sep 17 00:00:00 2001 From: Rune Philosof Date: Tue, 17 Sep 2024 09:29:09 +0200 Subject: [PATCH 4/4] CI lint: Add a newline separator For readability --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aae41d998..d3bd4b19d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -236,6 +236,7 @@ jobs: with: name: capybara path: tmp/capybara/ + post_to_github_pr: runs-on: ubuntu-latest needs: rspec