Skip to content

Commit ec11e61

Browse files
File sync from hanakai-rb/repo-sync
Updated files: - .github/workflows/ci.yml
1 parent 6000008 commit ec11e61

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,24 @@ on:
1414

1515
jobs:
1616
tests:
17+
name: Tests (${{ matrix.ruby }})
18+
permissions:
19+
pull-requests: write
1720
runs-on: ubuntu-latest
18-
name: Tests
21+
continue-on-error: ${{ matrix.optional }}
1922
strategy:
2023
fail-fast: false
2124
matrix:
2225
ruby:
2326
- "3.4"
2427
- "3.3"
2528
- "3.2"
29+
optional: [false]
2630
include:
2731
- ruby: "3.4"
2832
coverage: "true"
33+
- ruby: "jruby"
34+
optional: true
2935
env:
3036
COVERAGE: ${{matrix.coverage}}
3137
steps:
@@ -39,7 +45,26 @@ jobs:
3945
ruby-version: ${{matrix.ruby}}
4046
bundler-cache: true
4147
- name: Run all tests
42-
run: bundle exec rake
48+
id: test
49+
run: |
50+
status=0
51+
bundle exec rake || status=$?
52+
if [ ${status} -ne 0 ] && [ "${{ matrix.optional }}" == "true" ]; then
53+
echo "::warning::Optional matrix job failed."
54+
echo "optional_fail=true" >> "${GITHUB_OUTPUT}"
55+
echo "optional_fail_status=${status}" >> "${GITHUB_OUTPUT}"
56+
exit 0 # Ignore error here to keep the green checkmark
57+
fi
58+
exit ${status}
59+
- name: Add comment for optional failures
60+
uses: thollander/actions-comment-pull-request@v3
61+
if: ${{ matrix.optional && github.event.pull_request }}
62+
with:
63+
comment-tag: "${{ matrix.ruby }}-optional-failure-notice"
64+
message: |
65+
ℹ️ Optional job failed: Ruby ${{ matrix.ruby }}
66+
mode: ${{ steps.test.outputs.optional_fail == 'true' && 'upsert' || 'delete' }}
67+
4368
workflow-keepalive:
4469
if: github.event_name == 'schedule'
4570
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)