Skip to content

Commit ce34354

Browse files
nficanoclaude
andcommitted
ci: add GitHub Actions test workflow
Runs unit tests on push to main and PRs, with caching, concurrency control, minimal permissions, and pinned action versions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9e1e607 commit ce34354

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Action pinning policy:
2+
# - First-party actions/* pinned to major version tag (GitHub-maintained).
3+
# - Third-party actions pinned to a full commit SHA with a version comment.
4+
name: test
5+
6+
on:
7+
push:
8+
branches: [main]
9+
paths-ignore:
10+
- '**.md'
11+
- 'docs/**'
12+
- 'LICENSE'
13+
- '.gitignore'
14+
- '.editorconfig'
15+
pull_request:
16+
branches: [main]
17+
paths-ignore:
18+
- '**.md'
19+
- 'docs/**'
20+
- 'LICENSE'
21+
- '.gitignore'
22+
- '.editorconfig'
23+
workflow_dispatch:
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
28+
29+
permissions:
30+
contents: read
31+
32+
jobs:
33+
test:
34+
name: Ruby ${{ matrix.ruby }}
35+
runs-on: ubuntu-latest
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
# Floor from arcp.gemspec required_ruby_version (>= 3.4.0) and latest stable.
40+
ruby: ['3.4', '3.5']
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 1
46+
47+
- name: Set up Ruby ${{ matrix.ruby }}
48+
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
49+
with:
50+
ruby-version: ${{ matrix.ruby }}
51+
bundler-cache: true
52+
53+
- name: RuboCop
54+
run: bundle exec rubocop --parallel
55+
56+
- name: RSpec
57+
run: bundle exec rake spec
58+
59+
- name: Upload test artifacts
60+
if: failure()
61+
# actions/upload-artifact v4.4.3
62+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
63+
with:
64+
name: rspec-results-ruby-${{ matrix.ruby }}
65+
path: |
66+
coverage/
67+
if-no-files-found: ignore
68+
retention-days: 7

0 commit comments

Comments
 (0)