From 901feb846212d3a027e831f8832a8f60bc06c517 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Wed, 1 Mar 2023 16:55:34 +0000 Subject: [PATCH] CI: Only test default deployment.yaml in forks For concrete instances of the admin guide we don't need to test all permutations, only the actual config. --- .github/workflows/pull_request.yml | 35 +++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index f6dc71c..9ffd681 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -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 @@ -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