Skip to content

update some cache flags #13

update some cache flags

update some cache flags #13

#@ 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
#@ def test_plugin(name, needs, suites):
test-(@= name @):
name: Test (@= name @)
needs: #@ needs
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
otp_version:
- 26.2
metadata_store:
- mnesia
- khepri
timeout-minutes: 180
env:
SUCCESS_PATH: /home/runner/test-result-cache/${{ needs.load-test-result-cache.outputs.hash }}/(@= name @)/${{ matrix.metadata_store }}/${{ matrix.otp_version }}
steps:
- name: FETCH TEST RESULT CACHE
uses: actions/download-artifact@v4
with:
name: test-result-cache-subdir
path: /home/runner/test-result-cache
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
- name: SETUP ERLANG/ELIXIR
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: 1.15
- name: BUILD
run: |
make \
RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
mkdir -p ${{ env.SUCCESS_PATH }}
- name: XREF
run: |
if [[ -f ${{ env.SUCCESS_PATH }}/xref ]]; then
echo "xref already passed for this key ${{ needs.load-test-result-cache.outputs.hash }}"
else
make -C deps/(@= name @) \
xref \
RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
touch ${{ env.SUCCESS_PATH }}/xref
fi
- name: DIALYZE
run: |
if [[ -f ${{ env.SUCCESS_PATH }}/dialyze ]]; then
echo "dialyze already passed for this key ${{ needs.load-test-result-cache.outputs.hash }}"
else
make -C deps/(@= name @) \
dialyze \
RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
touch ${{ env.SUCCESS_PATH }}/dialyze
fi
continue-on-error: #@ name == "rabbitmq_ct_helpers" or name == "trust_store_http"
- name: EUNIT
run: |
if [[ -f ${{ env.SUCCESS_PATH }}/eunit ]]; then
echo "eunit already passed for this key ${{ needs.load-test-result-cache.outputs.hash }}"
else
make -C deps/(@= name @) \
eunit \
RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
touch ${{ env.SUCCESS_PATH }}/eunit
fi
#@ for suite in suites:
- name: CT (@= suite @)
run: |
if [[ -f ${{ env.SUCCESS_PATH }}/ct-(@= suite @) ]]; then
echo "ct-(@= suite @) already passed for this key ${{ needs.load-test-result-cache.outputs.hash }}"
else
make -C deps/(@= name @) \
ct-(@= suite @) \
RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
touch ${{ env.SUCCESS_PATH }}/ct-(@= suite @)
fi
#@ end
- name: SAVE CACHE COPY
uses: actions/upload-artifact@v4.3.1
with:
name: trc-(@= name @)-${{ matrix.metadata_store }}-${{ matrix.otp_version }}
path: |
/home/runner/test-result-cache
- name: UPLOAD TEST ARTIFACTS
if: always()
uses: actions/upload-artifact@v4.3.1
with:
name: testlogs-(@= name @)-${{ matrix.metadata_store }}-${{ matrix.otp_version }}
path: deps/(@= name @)/logs/*
#@ end
#@ def test_cli(needs):
test-rabbitmq_cli:
name: Test rabbitmq_cli
needs: #@ needs
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
otp_version:
- 26.2
metadata_store:
- mnesia
- khepri
timeout-minutes: 20
env:
SUCCESS_PATH: /home/runner/test-result-cache/${{ needs.load-test-result-cache.outputs.hash }}/rabbitmq_cli/${{ matrix.metadata_store }}/${{ matrix.otp_version }}
steps:
- name: FETCH TEST RESULT CACHE
uses: actions/download-artifact@v4
with:
name: test-result-cache-subdir
path: /home/runner/test-result-cache
- name: CHECK IF ALREADY PASSED
id: check
run: |
if [[ -f ${{ env.SUCCESS_PATH }} ]]; then
echo "passed=true" | tee -a $GITHUB_OUTPUT
else
echo "passed=false" | tee -a $GITHUB_OUTPUT
fi
- name: CHECKOUT REPOSITORY
if: steps.check.outputs.passed != 'true'
uses: actions/checkout@v4
- name: SETUP ERLANG/ELIXIR
if: steps.check.outputs.passed != 'true'
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: 1.15
- name: BUILD
if: steps.check.outputs.passed != 'true'
run: |
make \
RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
- name: TEST
id: test
if: steps.check.outputs.passed != 'true'
run: |
make -C deps/rabbitmq_cli \
checks \
RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
- name: RECORD SUCCESS rabbitmq_cli
if: steps.check.outputs.passed != 'true'
run: |
set -x
mkdir -p $(dirname ${{ env.SUCCESS_PATH }})
echo "passed" > ${{ env.SUCCESS_PATH }}
- name: UPDATE CACHE
if: steps.check.outputs.passed != 'true'
uses: actions/upload-artifact@v4.3.1
with:
name: rabbitmq_cli-${{ matrix.metadata_store }}-${{ matrix.otp_version }}
path: |
/home/runner/test-result-cache
- name: UPLOAD TEST ARTIFACTS
if: always() && steps.check.outputs.passed != 'true'
uses: actions/upload-artifact@v4.3.1
with:
name: testlogs-rabbitmq_cli-${{ matrix.metadata_store }}-${{ matrix.otp_version }}
path: |
deps/rabbitmq_cli/logs/*
#@ end
---
#@ load("@ytt:template", "template")
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: SETUP ERLANG/ELIXIR
if: steps.check.outputs.passed != 'true'
uses: erlef/setup-beam@v1
with:
otp-version: 26.2
elixir-version: 1.15
- name: ENSURE WORKFLOWS ARE UP TO DATE
run: |
mkdir local-bin/
curl -L https://carvel.dev/install.sh | K14SIO_INSTALL_BIN_DIR=local-bin bash
make actions-workflows YTT=$PWD/local-bin/ytt
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/cache@v4.0.2
with:
path: /home/runner/test-result-cache/
key: ${{ runner.os }}-test-result-cache-${{ steps.hash.outputs.hash }}
restore-keys: |
${{ runner.os }}-test-result-cache-
- 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: 7
#@ for plugin in data.values.internal_deps:
_: #@ template.replace(test_plugin(plugin, ["load-test-result-cache"], data.values[plugin].suites))
#@ end
_: #@ template.replace(test_plugin("rabbit", ["load-test-result-cache"] + job_names(data.values.internal_deps), data.values.rabbit.suites))
_: #@ template.replace(test_cli(["load-test-result-cache", "test-rabbit"]))
#@ for plugin in data.values.tier1_plugins:
_: #@ template.replace(test_plugin(plugin, ["load-test-result-cache", "test-rabbitmq_cli"], data.values[plugin].suites))
#@ 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/cache@v4.0.2
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-
fail-on-cache-miss: true
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