Skip to content

Commit a70cf8e

Browse files
committed
Add GitHub Actions CI/CD pipelines
CI workflow runs tests (Ruby 3.3, 3.4, head), RuboCop, and gem build on every push/PR to main. Release workflow auto-publishes to RubyGems when a GitHub release is created. Made-with: Cursor
1 parent f75897d commit a70cf8e

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test (Ruby ${{ matrix.ruby }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
ruby: ["3.3", "3.4"]
17+
include:
18+
- ruby: head
19+
experimental: true
20+
continue-on-error: ${{ matrix.experimental || false }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: ${{ matrix.ruby }}
26+
bundler-cache: true
27+
- name: Run tests
28+
run: bundle exec rake test
29+
30+
lint:
31+
name: RuboCop
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: ruby/setup-ruby@v1
36+
with:
37+
ruby-version: "3.3"
38+
bundler-cache: true
39+
- name: Run RuboCop
40+
run: bundle exec rake rubocop
41+
42+
build:
43+
name: Build Gem
44+
runs-on: ubuntu-latest
45+
needs: [test, lint]
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: "3.3"
51+
bundler-cache: true
52+
- name: Build gem
53+
run: gem build ruby_code.gemspec
54+
- name: Verify gem was built
55+
run: ls ruby_code-*.gem

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
name: Publish to RubyGems
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: "3.3"
19+
bundler-cache: true
20+
- name: Build gem
21+
run: gem build ruby_code.gemspec
22+
- name: Push to RubyGems
23+
run: gem push ruby_code-*.gem
24+
env:
25+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}

0 commit comments

Comments
 (0)