Skip to content

Commit 67c03ec

Browse files
authored
Migrate to GitHub Actions CI, fix test builds on main (#66)
Two issues being resolved here: - Test builds have started failing on `main` (due to Gems being installed that are incompatible with Ruby 2.7.7), see note from Patrick below on resolution - Migrating away from Circle CI and on to GitHub Actions (now our preferred CI platform)
2 parents 2b3011b + 1ce8fb8 commit 67c03ec

File tree

12 files changed

+946
-503
lines changed

12 files changed

+946
-503
lines changed

.circleci/config.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
if: github.ref_type == 'branch' && github.ref_name != 'main'
12+
uses: ./.github/workflows/test.yml
13+
# code_quality:
14+
# if: github.ref_type == 'branch' && github.ref_name != 'main'
15+
# uses: ./.github/workflows/code_quality.yml

.github/workflows/test.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7+
8+
name: Test
9+
on:
10+
workflow_call:
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
ruby-version: ['2.7', '3.1', '3.2']
19+
gemfile: [ rails_6.1, rails_7.0, rails_7.1 ]
20+
env:
21+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up Ruby
25+
uses: ruby/setup-ruby@v1
26+
with:
27+
ruby-version: ${{ matrix.ruby-version }}
28+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
29+
- name: Run tests
30+
run: bundle exec rspec
31+
32+
- name: Archive coverage
33+
if: ${{ success() || failure() }}
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: code-coverage-report-ruby_${{ matrix.ruby-version }}-${{ matrix.gemfile }}
37+
path: ${{ github.workspace }}/coverage/
38+
39+
post_coverage:
40+
runs-on: ubuntu-latest
41+
needs: test
42+
permissions:
43+
pull-requests: write
44+
steps:
45+
- uses: actions/download-artifact@v3
46+
with:
47+
name: code-coverage-report-ruby_3.2-rails_7.1
48+
path: coverage/
49+
50+
- name: Install JQ
51+
run: sudo apt-get install -y jq
52+
53+
- name: Determine coverage
54+
id: coverage
55+
run: |
56+
# Check to see if coverage is under `result.line` or under `result.covered_percent` (older versions)
57+
coverage=$(jq -r 'if .result.line then .result.line else .result.covered_percent end' < coverage/.last_run.json)
58+
[ "${coverage}" = "null" ] && coverage="** Failed to determine coverage **"
59+
echo value="${coverage}" >> "$GITHUB_OUTPUT"
60+
61+
- uses: mshick/add-pr-comment@v2
62+
with:
63+
message: |
64+
* GitHub Actions [run \#${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
65+
66+
Test coverage: ${{ steps.coverage.outputs.value }}%

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruby 3.1.3
1+
ruby 2.7.8

0 commit comments

Comments
 (0)