Skip to content

Commit b26b09f

Browse files
ofedorenekohlevgeni
committed
Fixes #36913 - Set up GHA with matrix to run test on Ruby 2.7
Co-Authored-by: Ewoud Kohl van Wijngaarden <[email protected]> Co-Authored-by: Evgeni Golov <[email protected]>
1 parent 19262bd commit b26b09f

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/matrix.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"postgresql": ["12"],
23
"ruby": ["2.7"],
34
"node": ["14"]
45
}

.github/workflows/foreman.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: Foreman
3+
4+
on:
5+
- pull_request
6+
7+
env:
8+
RAILS_ENV: test
9+
DATABASE_URL: postgresql://postgres:password@localhost/test
10+
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
11+
BUNDLE_WITHOUT: "console:development:journald"
12+
13+
jobs:
14+
setup_matrix:
15+
name: Setup matrix
16+
runs-on: ubuntu-latest
17+
outputs:
18+
matrix: ${{ steps.build_matrix.outputs.matrix }}
19+
steps:
20+
- name: Build test matrix
21+
id: build_matrix
22+
uses: theforeman/gha-matrix-builder@v0
23+
test:
24+
name: "Ruby ${{ matrix.ruby }} and Node ${{ matrix.node }} on PostgreSQL ${{ matrix.postgresql }}"
25+
runs-on: ubuntu-latest
26+
needs: setup_matrix
27+
services:
28+
postgres:
29+
image: 'postgres:${{ matrix.postgresql }}'
30+
ports: ['5432:5432']
31+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
32+
env:
33+
POSTGRES_PASSWORD: password
34+
strategy:
35+
fail-fast: false
36+
matrix: ${{ fromJson(needs.setup_matrix.outputs.matrix) }}
37+
steps:
38+
- run: sudo apt-get update
39+
- run: sudo apt-get -qq -y install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev libvirt-dev
40+
- name: "Check out Foreman"
41+
uses: actions/checkout@v4
42+
- name: "Set up Ruby ${{ matrix.ruby }}"
43+
uses: ruby/setup-ruby@v1
44+
with:
45+
ruby-version: ${{ matrix.ruby }}
46+
bundler-cache: true
47+
- name: Archive Gemfile.lock
48+
uses: actions/upload-artifact@v3
49+
with:
50+
name: Gemfile-ruby-${{ matrix.ruby }}-node-${{ matrix.node }}-pg-${{ matrix.postgresql }}.lock
51+
path: Gemfile.lock
52+
- name: "Set up Node ${{ matrix.node }}"
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: ${{ matrix.node }}
56+
- name: Prepare test env
57+
run: |
58+
bundle exec rake db:create
59+
bundle exec rake db:migrate
60+
- name: Run unit tests
61+
run: bundle exec rake test:units
62+
- name: Run functional tests
63+
run: bundle exec rake test:functionals
64+
- name: Run graphql tests
65+
run: bundle exec rake test:graphql

0 commit comments

Comments
 (0)