Skip to content

use the values from matrix.json in plugin react tests #2344

use the values from matrix.json in plugin react tests

use the values from matrix.json in plugin react tests #2344

name: (non-blocking) React on plugins
on:
pull_request:
branches: [develop]
paths:
- 'webpack/**'
- 'package.json'
- 'config/webpack.config.js'
- '.github/workflows/plugins_react_tests.yml'
permissions:
contents: read
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
run: |
{
echo 'matrix<<EOF'
curl --silent --show-error --fail https://raw.githubusercontent.com/theforeman/foreman/${{ github.base_ref }}/.github/matrix.json
echo 'EOF'
} >> "$GITHUB_OUTPUT"
test:
name: ${{ matrix.plugin }} with Ruby ${{ matrix.ruby }} and Node ${{ matrix.node }}
runs-on: ubuntu-latest
needs: setup_matrix
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJson(needs.setup_matrix.outputs.matrix).ruby }}
node: ${{ fromJson(needs.setup_matrix.outputs.matrix).node }}
plugin:
- theforeman/foreman-tasks
- Katello/katello
steps:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
# We could update the postinstall action for foreman to look for an environment variable for plugin webpack dirs
# before kicking off the ruby script to find them, this would eliminate the ruby dep and running `npm install` in plugins.
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Checkout Foreman
uses: actions/checkout@v4
with:
path: ./projects/foreman
- name: Generate Foreman npm dependencies package-lock
run: npm install --package-lock-only --no-audit
working-directory: ${{ github.workspace }}/projects/foreman
- name: Install Foreman npm dependencies
run: npm ci --no-audit
working-directory: ${{ github.workspace }}/projects/foreman
- name: Checkout ${{ matrix.plugin }}
uses: actions/checkout@v4
with:
repository: ${{ matrix.plugin }}
path: ./projects/plugin
- name: Generate ${{ matrix.plugin }} npm dependencies package-lock
run: npm install --package-lock-only --no-audit
working-directory: ${{ github.workspace }}/projects/plugin
- name: Install ${{ matrix.plugin }} npm dependencies
run: npm ci --no-audit
working-directory: ${{ github.workspace }}/projects/plugin
- name: Run ${{ matrix.plugin }} tests
run: npm test
working-directory: ${{ github.workspace }}/projects/plugin