Skip to content

CI: Only test deployment.yaml in forks #40

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

Merged
merged 1 commit into from
Nov 9, 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
35 changes: 27 additions & 8 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,35 @@ name: Build OpenStack admin guide
on:
- pull_request
jobs:
# Dynamically define test matrix.
# In openstack-admin-guide CI we want to test various configurations.
# In client admin guide CI we just want to test the actual configuration.
# https://stackoverflow.com/questions/65384420/how-do-i-make-a-github-action-matrix-element-conditional
matrix:
name: Generate test matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3

- name: Generate test matrix
id: set-matrix
run: |
echo -n "matrix={\"deployment_yaml\": [\"default\"" >> $GITHUB_OUTPUT
if [[ ${{ github.repository }} == 'stackhpc/openstack-admin-guide' ]]; then
for yaml in $(ls .github/workflows/deployment_yaml/); do
echo -n ", \"$yaml\"" >> $GITHUB_OUTPUT
done
fi
echo "]}" >> $GITHUB_OUTPUT

build:
name: Build OpenStack admin guide
needs: matrix
runs-on: ubuntu-latest
strategy:
matrix:
deployment_yaml:
- __default__
- disable-ceph
- enable-ironic
- enable-ironic-no-cleaning-or-physnet
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3

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

- name: Copy deployment.yml into place
run: cp .github/workflows/deployment_yaml/${{ matrix.deployment_yaml }}.yml source/data/deployment.yml
if: matrix.deployment_yaml != '__default__'
run: cp .github/workflows/deployment_yaml/${{ matrix.deployment_yaml }} source/data/deployment.yml
if: matrix.deployment_yaml != 'default'

- name: Build HTML
run: make html