Skip to content

Commit 8dd6ad7

Browse files
committed
Adding back CI file and adding CI file to .fernignore to stop accidental deletion
1 parent 9cd75a1 commit 8dd6ad7

File tree

2 files changed

+132
-1
lines changed

2 files changed

+132
-1
lines changed

.fernignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ Rakefile
55
.rubocop.yml
66
square.gemspec
77
.gitignore
8-
test/
8+
test/
9+
.github/workflows

.github/workflows/ci.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
# Cancel previous workflows on previous push
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
12+
cancel-in-progress: true
13+
14+
# Global environment variables
15+
env:
16+
RUBY_VERSION: '3.3'
17+
BUNDLER_VERSION: '2.7'
18+
19+
jobs:
20+
test:
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
ruby-version: ['3.2', '3.3', '3.4']
25+
bundler-version: ${{ env.BUNDLER_VERSION }}
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Ruby
32+
uses: ruby/setup-ruby@v1
33+
with:
34+
ruby-version: ${{ matrix.ruby-version }}
35+
bundler-version: ${{ matrix.bundler-version }}
36+
bundler-cache: true
37+
38+
- name: Install dependencies
39+
run: |
40+
bundle install
41+
42+
- name: Build gem
43+
run: |
44+
bundle exec rake build
45+
46+
- name: Run tests
47+
run: |
48+
bundle exec rake test
49+
50+
lint:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v4
55+
56+
- name: Set up Ruby
57+
uses: ruby/setup-ruby@v1
58+
with:
59+
ruby-version: ${{ env.RUBY_VERSION }}
60+
bundler-version: ${{ env.BUNDLER_VERSION }}
61+
bundler-cache: true
62+
63+
- name: Install dependencies
64+
run: |
65+
bundle install
66+
67+
- name: Run RuboCop with auto-correct
68+
run: |
69+
bundle exec rake rubocop:autocorrect
70+
71+
# TODO: Uncomment this when we have a way a fix for all RuboCop violations
72+
# - name: Check for RuboCop violations
73+
# run: |
74+
# bundle exec rubocop --fail-level W
75+
76+
- name: Ensure no changes to git-tracked files
77+
run: git --no-pager diff --exit-code
78+
79+
security:
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Checkout repository
83+
uses: actions/checkout@v4
84+
85+
- name: Set up Ruby
86+
uses: ruby/setup-ruby@v1
87+
with:
88+
ruby-version: ${{ env.RUBY_VERSION }}
89+
bundler-version: ${{ env.BUNDLER_VERSION }}
90+
bundler-cache: true
91+
92+
- name: Install dependencies
93+
run: |
94+
bundle install
95+
96+
- name: Run bundle audit
97+
run: |
98+
bundle exec bundle audit check --update
99+
100+
gem-publish:
101+
runs-on: ubuntu-latest
102+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
103+
needs: [test, lint, security]
104+
steps:
105+
- name: Checkout repository
106+
uses: actions/checkout@v4
107+
with:
108+
fetch-depth: 0
109+
110+
- name: Set up Ruby
111+
uses: ruby/setup-ruby@v1
112+
with:
113+
ruby-version: ${{ env.RUBY_VERSION }}
114+
bundler-version: ${{ env.BUNDLER_VERSION }}
115+
bundler-cache: true
116+
117+
- name: Install dependencies
118+
run: |
119+
bundle install
120+
121+
- name: Build gem
122+
run: |
123+
bundle exec rake build
124+
125+
# TODO: Uncomment this when we are ready to publish to RubyGems
126+
# - name: Publish to RubyGems
127+
# run: |
128+
# gem push pkg/*.gem
129+
# env:
130+
# RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}

0 commit comments

Comments
 (0)