-
Notifications
You must be signed in to change notification settings - Fork 993
76 lines (72 loc) · 2.91 KB
/
plugins_react_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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: |
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"}, {"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.org }}/${{ matrix.repo }} with Ruby ${{ matrix.ruby }} and Node ${{ matrix.node }}
runs-on: ubuntu-latest
needs: setup_matrix
timeout-minutes: 20
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup_matrix.outputs.matrix) }}
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.repo }}
uses: actions/checkout@v4
with:
repository: ${{ matrix.org }}/${{ matrix.repo }}
path: ./projects/${{ matrix.repo }}
- name: Generate ${{ matrix.repo }} 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
run: npm ci --no-audit
working-directory: ${{ github.workspace }}/projects/${{ matrix.repo }}
- name: Run ${{ matrix.plugin_repo }} tests
run: npm test
working-directory: ${{ github.workspace }}/projects/${{ matrix.repo }}