Skip to content

Commit 7778a58

Browse files
authored
Merge pull request #40 from stackhpc/client-ci
CI: Only test deployment.yaml in forks
2 parents a4d5520 + 901feb8 commit 7778a58

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

.github/workflows/pull_request.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,35 @@ name: Build OpenStack admin guide
33
on:
44
- pull_request
55
jobs:
6+
# Dynamically define test matrix.
7+
# In openstack-admin-guide CI we want to test various configurations.
8+
# In client admin guide CI we just want to test the actual configuration.
9+
# https://stackoverflow.com/questions/65384420/how-do-i-make-a-github-action-matrix-element-conditional
10+
matrix:
11+
name: Generate test matrix
12+
runs-on: ubuntu-latest
13+
outputs:
14+
matrix: ${{ steps.set-matrix.outputs.matrix }}
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Generate test matrix
19+
id: set-matrix
20+
run: |
21+
echo -n "matrix={\"deployment_yaml\": [\"default\"" >> $GITHUB_OUTPUT
22+
if [[ ${{ github.repository }} == 'stackhpc/openstack-admin-guide' ]]; then
23+
for yaml in $(ls .github/workflows/deployment_yaml/); do
24+
echo -n ", \"$yaml\"" >> $GITHUB_OUTPUT
25+
done
26+
fi
27+
echo "]}" >> $GITHUB_OUTPUT
28+
629
build:
730
name: Build OpenStack admin guide
31+
needs: matrix
832
runs-on: ubuntu-latest
933
strategy:
10-
matrix:
11-
deployment_yaml:
12-
- __default__
13-
- disable-ceph
14-
- enable-ironic
15-
- enable-ironic-no-cleaning-or-physnet
34+
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
1635
steps:
1736
- uses: actions/checkout@v3
1837

@@ -24,8 +43,8 @@ jobs:
2443
run: pip3 install -r requirements.txt
2544

2645
- name: Copy deployment.yml into place
27-
run: cp .github/workflows/deployment_yaml/${{ matrix.deployment_yaml }}.yml source/data/deployment.yml
28-
if: matrix.deployment_yaml != '__default__'
46+
run: cp .github/workflows/deployment_yaml/${{ matrix.deployment_yaml }} source/data/deployment.yml
47+
if: matrix.deployment_yaml != 'default'
2948

3049
- name: Build HTML
3150
run: make html

0 commit comments

Comments
 (0)