Skip to content

Commit

Permalink
Also template test-make.yaml
Browse files Browse the repository at this point in the history
It turns out github actions won't let you template a matrix value into
the 'uses' of a job, so we have to template out the file
  • Loading branch information
HoloRin committed Apr 18, 2024
1 parent 89bdfa0 commit d90114f
Show file tree
Hide file tree
Showing 4 changed files with 647 additions and 146 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/test-make.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#@ load("@ytt:data", "data")
#@yaml/text-templated-strings

#@ def job_names(plugins):
#@ names = []
#@ for p in plugins:
#@ names.append("test-"+p)
#@ end
#@ return names
#@ end
---
name: Test (make)
on:
push:
branches:
- main
- v3.13.x
- v3.12.x
- v3.11.x
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
load-test-result-cache:
runs-on: ubuntu-latest
outputs:
hash: ${{ steps.hash.outputs.hash }}
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
- name: ENSURE WORKFLOWS ARE UP TO DATE
run: |
make actions-workflows
git diff --exit-code
- name: COMPUTE REPO HASH
id: hash
run: |
echo "hash=${{ hashFiles('**/*', '!.github/**/*', '!*.bazel', '!*.bzl', '!BUILD.*') }}" | tee -a $GITHUB_OUTPUT
- name: MOUNT TEST RESULT CACHE
uses: actions/[email protected]
with:
path: /home/runner/test-result-cache/
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}
restore-keys: |
${{ runner.os }}-test-result-cache-
save-always: true
- name: PREP CACHE DIR
run: |
mkdir -p /home/runner/test-result-cache/${{ steps.hash.outputs.hash }}
touch /home/runner/test-result-cache/marker
- name: UPLOAD IT AS AN ARTIFACT
uses: actions/upload-artifact@v4
with:
name: test-result-cache-subdir
#! force the archive to include the sha
#! by controlling the common prefix
path: |
/home/runner/test-result-cache/marker
/home/runner/test-result-cache/${{ steps.hash.outputs.hash }}
retention-days: 1
#@ for plugin in data.values.internal_deps:
test-(@= plugin @):
needs:
- load-test-result-cache
uses: ./.github/workflows/test-(@= plugin @).yaml
with:
trc: /home/runner/test-result-cache
hash: ${{ needs.load-test-result-cache.outputs.hash }}
ignore-dialyze-errors: #@ plugin == 'rabbitmq_ct_helpers' or plugin == 'trust_store_http'
#@ end
test-rabbit:
needs: #@ ["load-test-result-cache"] + job_names(data.values.internal_deps)
uses: ./.github/workflows/test-rabbit.yaml
with:
trc: /home/runner/test-result-cache
hash: ${{ needs.load-test-result-cache.outputs.hash }}
test-rabbitmq_cli:
needs:
- load-test-result-cache
- test-rabbit
uses: ./.github/workflows/test-rabbitmq_cli.yaml
with:
trc: /home/runner/test-result-cache
hash: ${{ needs.load-test-result-cache.outputs.hash }}
#@ for plugin in data.values.tier1_plugins:
test-(@= plugin @):
needs:
- load-test-result-cache
- test-rabbitmq_cli
uses: ./.github/workflows/test-(@= plugin @).yaml
with:
trc: /home/runner/test-result-cache
hash: ${{ needs.load-test-result-cache.outputs.hash }}
#@ end
summary-test-make:
if: always()
needs: #@ ["load-test-result-cache", "test-rabbit", "test-rabbitmq_cli"] + job_names(data.values.internal_deps + data.values.tier1_plugins)
runs-on: ubuntu-latest
steps:
- name: MOUNT TEST RESULT CACHE
uses: actions/[email protected]
with:
path: /home/runner/test-result-cache/
key: ${{ runner.os }}-test-result-cache-${{ needs.load-test-result-cache.outputs.hash }}
restore-keys: |
${{ runner.os }}-test-result-cache-
save-always: true
- name: UPDATE CACHE
uses: actions/download-artifact@v4
with:
pattern: trc-*
path: /home/runner/test-result-cache
merge-multiple: true
- name: PRINT RESULTS
run: |
set -x
tree /home/runner/test-result-cache/${{ needs.load-test-result-cache.outputs.hash }}
- name: SUMMARY
run: |
cat << 'EOF' | jq -e 'map(.result == "success") | all(.)'
${{ toJson(needs) }}
EOF
Loading

0 comments on commit d90114f

Please sign in to comment.