Skip to content

run integration tests as part of the GHA matrix #40

run integration tests as part of the GHA matrix

run integration tests as part of the GHA matrix #40

Workflow file for this run

---
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"
concurrency:
group: ${{ github.ref_name }}-${{ github.workflow }}
cancel-in-progress: true
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
tests:
name: "${{ matrix.task }} - 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:
ruby: ${{ fromJson(needs.setup_matrix.outputs.matrix).ruby }}
node: ${{ fromJson(needs.setup_matrix.outputs.matrix).node }}
postgresql: ${{ fromJson(needs.setup_matrix.outputs.matrix).postgresql }}
task:
- 'test:units'
- 'test:functionals'
- 'test:graphql'
- 'webpack:compile test:integration'
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: Setup Cache
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Generate package-lock.json
run: npm install --package-lock-only --no-audit --loglevel verbose
- name: Install NPM packages
run: npm ci --no-audit --loglevel verbose
- name: Prepare test env
run: |
bundle exec rake db:create
bundle exec rake db:migrate
- name: Run rake ${{ matrix.task }}
run: bundle exec rake ${{ matrix.task }}
result:
name: Test suite
runs-on: ubuntu-latest
needs: tests
steps:
- run: echo Test suite completed