Manually test one process gg_tt.mad (enableFPE = true) #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2020-2023 CERN and UCLouvain. | |
# Licensed under the GNU Lesser General Public License (version 3 or later). | |
# Created by: A. Valassi (Oct 2023) for the MG5aMC CUDACPP plugin. | |
# Further modified by: A. Valassi (2023) for the MG5aMC CUDACPP plugin. | |
#---------------------------------------------------------------------------------------------------------------------------------- | |
name: Test one process | |
#---------------------------------------------------------------------------------------------------------------------------------- | |
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#run-name | |
run-name: Manually test one process ${{ inputs.process }} (enableFPE = ${{ inputs.enableFPE }}) | |
#---------------------------------------------------------------------------------------------------------------------------------- | |
on: | |
# Trigger the one-process workflow from the all-processes workflow | |
# See https://stackoverflow.com/a/75337311 | |
workflow_call: | |
inputs: | |
process: # this variable is provided by the matrix in testsuite_allprocesses.yml | |
required: true | |
type: string | |
# Manually trigger the one-process workflow | |
# (the lines below are adapted rom the default github manual workflow example) | |
workflow_dispatch: | |
inputs: | |
process: | |
description: 'Physics process' | |
default: 'gg_tt.mad' | |
required: true | |
###type: string | |
type: choice | |
# FIXME? Can the list of supported processes be specified only once in oneprocess.yml or allprocesses.yml? | |
options: [gg_tt.mad, gg_ttg.mad, gg_ttgg.mad, gg_ttggg.mad, ee_mumu.mad] | |
enableFPE: | |
description: 'Enable FPE tests?' | |
default: true | |
required: true | |
type: boolean | |
#---------------------------------------------------------------------------------------------------------------------------------- | |
jobs: | |
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
# See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy | |
cleanup: | |
###if: ${{ false }} # disable the job (comment this out to enable it!) | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write # this is required to delete caches | |
contents: read | |
steps: | |
- name: cleanup_cache | |
run: | | |
gh extension install actions/gh-actions-cache | |
REPO=${{ github.repository }} | |
echo "List cache keys (start)" | |
gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }} | |
echo "List cache keys (end)" | |
###cacheKeys=$(gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }} | cut -f 1) # delete ALL caches | |
cacheKeys=$(gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }} | cut -f 1 | head --lines=-1) # keep only the most recent cache | |
set +e # do not fail while deleting cache keys | |
echo "Deleting caches..." | |
for cacheKey in $cacheKeys; do gh actions-cache delete $cacheKey -R $REPO --confirm; done | |
echo "Deleting caches... done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
testsuite: | |
runs-on: ubuntu-latest | |
needs: cleanup | |
steps: | |
- # See https://github.com/actions/checkout | |
# (NB actions/checkout needs "Allow owner and select non-owner" and "Allow actions created by github") | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: HELLO | |
run: | | |
echo "HELLO ${{ inputs.process }}! $(date)" | |
echo "Current directory is $(pwd)" | |
echo "Current git commit is $(git log --oneline -n1 | cut -d' ' -f1)" | |
# See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy | |
gh extension install actions/gh-actions-cache | |
REPO=${{ github.repository }} | |
echo "List cache keys (start)" | |
gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }} | |
echo "List cache keys (end)" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: restore_cache | |
id: cache-restore | |
# See https://github.com/actions/cache | |
# See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
CCACHE_DIR | |
DOWNLOADS | |
test/googletest | |
key: cache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }} | |
restore-keys: | |
cache-${{ runner.os }}-${{ inputs.process }} | |
- name: codegen | |
run: .github/workflows/testsuite_oneprocess.sh codegen ${{ inputs.process }} | |
- name: before_build | |
run: .github/workflows/testsuite_oneprocess.sh before_build ${{ inputs.process }} | |
- name: build | |
run: .github/workflows/testsuite_oneprocess.sh build ${{ inputs.process }} | |
- name: after_build | |
run: .github/workflows/testsuite_oneprocess.sh after_build ${{ inputs.process }} | |
- name: update_cache # update caches after the builds but before the tests (which may fail even if builds succeed) | |
id: cache-update | |
# See https://github.com/actions/cache | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
CCACHE_DIR | |
DOWNLOADS | |
test/googletest | |
key: cache-${{ runner.os }}-${{ inputs.process }}-${{ github.run_id }} | |
- name: tput_test | |
run: .github/workflows/testsuite_oneprocess.sh tput_test ${{ inputs.process }} | |
- name: tput_test_fpe | |
run: .github/workflows/testsuite_oneprocess.sh tput_test_fpe ${{ inputs.process }} | |
if: ${{ inputs.enableFPE }} | |
- name: GOODBYE | |
run: | | |
echo "GOODBYE ${{ inputs.process }}! $(date)" | |
echo "Current directory is $(pwd)" | |
echo "Current git commit is $(git log --oneline -n1 | cut -d' ' -f1)" | |
REPO=${{ github.repository }} | |
echo "List cache keys (start)" | |
gh actions-cache list -R $REPO --sort created-at --order asc --key cache-${{ runner.os }}-${{ inputs.process }} | |
echo "List cache keys (end)" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
#---------------------------------------------------------------------------------------------------------------------------------- |