Skip to content

Commit

Permalink
use the values from matrix.json in plugin react tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Oct 30, 2023
1 parent e407f7d commit 362fd3b
Showing 1 changed file with 37 additions and 16 deletions.
53 changes: 37 additions & 16 deletions .github/workflows/plugins_react_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,48 @@ 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: |
curl --silent --show-error --fail --output matrix.json https://raw.githubusercontent.com/theforeman/foreman/${{ github.base_ref }}/.github/matrix.json
cat >matrix_include.json <<EOF
[{"repo": "foreman-tasks", "org": "theforeman", "ruby": "2.7"}, {"repo": "katello", "org": "Katello"}]
EOF
{
echo 'matrix<<EOF'
python3 -c 'import json; matrix=json.load(open("matrix.json")); matrix["include"]=json.load(open("matrix_include.json")); print(json.dumps(matrix));'
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:
include:
- repo: katello
org: Katello
- repo: foreman-tasks
org: theforeman
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: '14.x'
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: 2.7
ruby-version: ${{ matrix.ruby }}
- name: Checkout Foreman
uses: actions/checkout@v4
with:
Expand All @@ -44,17 +65,17 @@ jobs:
- name: Install Foreman npm dependencies
run: npm ci --no-audit
working-directory: ${{ github.workspace }}/projects/foreman
- name: Checkout ${{ matrix.repo }}
- name: Checkout ${{ matrix.plugin }}
uses: actions/checkout@v4
with:
repository: ${{ matrix.org }}/${{ matrix.repo }}
path: ./projects/${{ matrix.repo }}
- name: Generate ${{ matrix.repo }} npm dependencies package-lock
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/${{ matrix.repo }}
- name: Install ${{ matrix.repo }} npm dependencies
working-directory: ${{ github.workspace }}/projects/plugin
- name: Install ${{ matrix.plugin }} npm dependencies
run: npm ci --no-audit
working-directory: ${{ github.workspace }}/projects/${{ matrix.repo }}
- name: Run ${{ matrix.plugin_repo }} tests
working-directory: ${{ github.workspace }}/projects/plugin
- name: Run ${{ matrix.plugin }} tests
run: npm test
working-directory: ${{ github.workspace }}/projects/${{ matrix.repo }}
working-directory: ${{ github.workspace }}/projects/plugin

0 comments on commit 362fd3b

Please sign in to comment.