foreman/.github/workflows/foreman.yml @ 42e7178b
b26b09f5 | Oleh Fedorenko | ---
|
|
name: Foreman
|
|||
on:
|
|||
38e2c55c | Evgeni Golov | pull_request:
|
|
push:
|
|||
branches:
|
|||
- 'develop'
|
|||
- '*-stable'
|
|||
b26b09f5 | Oleh Fedorenko | ||
env:
|
|||
RAILS_ENV: test
|
|||
DATABASE_URL: postgresql://postgres:password@localhost/test
|
|||
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
|
|||
BUNDLE_WITHOUT: "console:development:journald"
|
|||
9f8202b7 | Evgeni Golov | concurrency:
|
|
group: ${{ github.ref_name }}-${{ github.workflow }}
|
|||
cancel-in-progress: true
|
|||
b26b09f5 | Oleh Fedorenko | 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
|
|||
1cfbb451 | Evgeni Golov | ||
b3b6aa38 | Evgeni Golov | rubocop:
|
|
name: Rubocop
|
|||
needs: setup_matrix
|
|||
runs-on: ubuntu-latest
|
|||
env:
|
|||
BUNDLE_WITHOUT: assets:console:development:dynflow_sidekiq:ec2:journald:jsonp:libvirt:openid:openstack:ovirt:redis:service:telemetry:vmware
|
|||
steps:
|
|||
- uses: actions/checkout@v4
|
|||
- name: Setup Ruby
|
|||
uses: ruby/setup-ruby@v1
|
|||
with:
|
|||
ruby-version: ${{ fromJson(needs.setup_matrix.outputs.matrix).ruby[0] }}
|
|||
bundler-cache: true
|
|||
- name: Run rubocop
|
|||
run: bundle exec rubocop -P
|
|||
1cfbb451 | Evgeni Golov | tests:
|
|
name: "${{ matrix.task }} - Ruby ${{ matrix.ruby }} and Node ${{ matrix.node }} on PostgreSQL ${{ matrix.postgresql }}"
|
|||
b26b09f5 | Oleh Fedorenko | runs-on: ubuntu-latest
|
|
b3b6aa38 | Evgeni Golov | needs:
|
|
- setup_matrix
|
|||
- rubocop
|
|||
b26b09f5 | Oleh Fedorenko | 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
|
|||
1cfbb451 | Evgeni Golov | 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'
|
|||
740a46d1 | Evgeni Golov | - 'webpack:compile test:integration'
|
|
4283fb48 | Evgeni Golov | - 'db:seed'
|
|
1c0ecb53 | Evgeni Golov | - 'assets:precompile RAILS_ENV=production DATABASE_URL=nulldb://nohost'
|
|
a1142ab9 | Evgeni Golov | - 'test:external'
|
|
b26b09f5 | Oleh Fedorenko | steps:
|
|
- run: sudo apt-get update
|
|||
- run: sudo apt-get -qq -y install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev libvirt-dev
|
|||
c3170233 | dependabot[bot] | - name: generate artifact suffix
|
|
run: echo "ARTIFACT_SUFFIX=$(echo 'ruby-${{ matrix.ruby }}-node-${{ matrix.node }}-pg-${{ matrix.postgresql }}-${{ matrix.task }}' | tr -cd '[:alnum:]-.')" >> "${GITHUB_ENV}"
|
|||
b26b09f5 | Oleh Fedorenko | - 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
|
|||
c3170233 | dependabot[bot] | uses: actions/upload-artifact@v4
|
|
b26b09f5 | Oleh Fedorenko | with:
|
|
c3170233 | dependabot[bot] | name: Gemfile-${{ env.ARTIFACT_SUFFIX }}.lock
|
|
b26b09f5 | Oleh Fedorenko | path: Gemfile.lock
|
|
- name: "Set up Node ${{ matrix.node }}"
|
|||
uses: actions/setup-node@v4
|
|||
with:
|
|||
node-version: ${{ matrix.node }}
|
|||
740a46d1 | Evgeni Golov | - name: Setup NPM Cache
|
|
7716613e | dependabot[bot] | uses: actions/cache@v4
|
|
740a46d1 | Evgeni Golov | with:
|
|
path: ~/.npm
|
|||
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package.json') }}
|
|||
restore-keys: |
|
|||
${{ runner.os }}-node-${{ matrix.node }}-
|
|||
if: contains(matrix.task, 'compile')
|
|||
- name: Generate package-lock.json
|
|||
run: npm install --package-lock-only --no-audit
|
|||
if: contains(matrix.task, 'compile')
|
|||
- name: Archive package-lock.json
|
|||
c3170233 | dependabot[bot] | uses: actions/upload-artifact@v4
|
|
740a46d1 | Evgeni Golov | with:
|
|
c3170233 | dependabot[bot] | name: package-lock-${{ env.ARTIFACT_SUFFIX }}.json
|
|
740a46d1 | Evgeni Golov | path: package-lock.json
|
|
if: contains(matrix.task, 'compile')
|
|||
- name: Install NPM packages
|
|||
run: npm ci --no-audit
|
|||
if: contains(matrix.task, 'compile')
|
|||
a1142ab9 | Evgeni Golov | - name: Install external test dependencies
|
|
run: |
|
|||
pip3 install pykickstart
|
|||
sudo apt-get -qq -y install --no-install-recommends grub-common
|
|||
if: contains(matrix.task, 'external')
|
|||
b26b09f5 | Oleh Fedorenko | - name: Prepare test env
|
|
run: |
|
|||
bundle exec rake db:create
|
|||
bundle exec rake db:migrate
|
|||
1cfbb451 | Evgeni Golov | - name: Run rake ${{ matrix.task }}
|
|
run: bundle exec rake ${{ matrix.task }}
|
|||
42e7178b | Evgeni Golov | katello:
|
|
name: Katello
|
|||
needs:
|
|||
- rubocop
|
|||
uses: theforeman/actions/.github/workflows/foreman_plugin.yml@v0
|
|||
with:
|
|||
plugin: katello
|
|||
plugin_repository: Katello/katello
|
|||
foreman_version: ${{ github.ref }}
|
|||
postgresql_container: ghcr.io/theforeman/postgresql-evr
|
|||
test_existing_database: false
|
|||
1cfbb451 | Evgeni Golov | result:
|
|
name: Test suite
|
|||
runs-on: ubuntu-latest
|
|||
42e7178b | Evgeni Golov | needs:
|
|
- tests
|
|||
- katello
|
|||
1cfbb451 | Evgeni Golov | steps:
|
|
- run: echo Test suite completed
|