-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
1 parent
19262bd
commit c186ca9
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"postgresql": ["12"], | ||
"ruby": ["2.7"], | ||
"node": ["14"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
name: Foreman | ||
|
||
on: | ||
- pull_request | ||
|
||
env: | ||
RAILS_ENV: test | ||
DATABASE_URL: postgresql://postgres:password@localhost/test | ||
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true | ||
BUNDLE_WITHOUT: "console:development:journald" | ||
|
||
jobs: | ||
setup_matrix: | ||
name: Setup matrix | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.build_matrix.outputs.matrix }} | ||
steps: | ||
- name: Build test matrix | ||
id: build_matrix | ||
uses: theforeman/gha-matrix-builder@v0 | ||
test: | ||
name: "Ruby ${{ matrix.ruby }} and Node ${{ matrix.node }} on PostgreSQL ${{ matrix.postgresql }}" | ||
runs-on: ubuntu-latest | ||
needs: setup_matrix | ||
services: | ||
postgres: | ||
image: 'postgres:${{ matrix.postgresql }}' | ||
ports: ['5432:5432'] | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
env: | ||
POSTGRES_PASSWORD: password | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJson(needs.setup_matrix.outputs.matrix) }} | ||
steps: | ||
- run: sudo apt-get update | ||
- run: sudo apt-get -qq -y install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev libvirt-dev | ||
- name: "Check out Foreman" | ||
uses: actions/checkout@v4 | ||
- name: "Set up Ruby ${{ matrix.ruby }}" | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby }} | ||
bundler-cache: true | ||
- name: Archive Gemfile.lock | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Gemfile-ruby-${{ matrix.ruby }}-node-${{ matrix.node }}-pg-${{ matrix.postgresql }}.lock | ||
path: Gemfile.lock | ||
- name: "Set up Node ${{ matrix.node }}" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- name: Prepare test env | ||
run: | | ||
bundle exec rake db:create | ||
bundle exec rake db:migrate | ||
- name: Run unit tests | ||
run: bundle exec rake test:units | ||
- name: Run functional tests | ||
run: bundle exec rake test:functionals | ||
- name: Run graphql tests | ||
run: bundle exec rake test:graphql |