Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 29 additions & 17 deletions .github/workflows/plugins_react_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,60 @@ 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
uses: theforeman/gha-matrix-builder@v0

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@v4
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:
path: ./projects/foreman
path: ${{ github.workspace }}/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.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: ${{ github.workspace }}/projects/plugin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a stupid question, but shouldn't be plugin a variable here?..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean {{ matrix.plugin }}? that contains a slash now and I kinda didn't want to find out which parts of the GHA Octopus do and which do not understand how to create folders correctly.

Given we're only testing one plugin at a time, there is nothing that prevents us from having it in a common folder.

- 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