-
Notifications
You must be signed in to change notification settings - Fork 5
105 lines (76 loc) · 2.35 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: CI
on: pull_request
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run RuboCop
run: bin/rake rubocop
version-matrix:
name: Generate version matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.version-matrix.outputs.matrix }}
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Generate version matrix
id: version-matrix
run: bin/version-matrix
test:
needs: version-matrix
strategy:
matrix: ${{ fromJSON(needs.version-matrix.outputs.matrix) }}
name: Ruby ${{ matrix.ruby }} | PG ${{ matrix.pg }} | ActiveRecord ${{ matrix.activerecord }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
BUNDLE_PATH: ${{ github.workspace }}/vendor/bundle
ACTIVERECORD_VERSION: ${{ matrix.activerecord }}
PG_VERSION: ${{ matrix.pg }}
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Update Gemfile.lock
run: bin/bundle lock --update activerecord pg
- name: Install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run unit tests
run: bin/rake test:unit
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
role-session-name: pg-aws_rds_iam-ci-${{ github.run_id }}-${{ github.run_attempt }}-${{ strategy.job-index }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Run acceptance tests
run: bin/rake test:acceptance
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SECURITY_GROUP_ID: ${{ secrets.SECURITY_GROUP_ID }}
test-results:
name: Check test results
if: always()
needs:
- version-matrix
- test
runs-on: ubuntu-latest
steps:
- name: Check test results
run: test "${{ needs.test.result }}" = "success"