From 2969ad8721839de28d05f1e4a9f9c1cf92145df8 Mon Sep 17 00:00:00 2001 From: Andrea Valassi Date: Mon, 30 Oct 2023 18:53:25 +0100 Subject: [PATCH] [actions] first successful basic integration of one tput test (missing: cache ccache, build all processes, etc) --- .github/workflows/manual.sh | 109 +++++++++++++++++++++++++---------- .github/workflows/manual.yml | 8 ++- 2 files changed, 84 insertions(+), 33 deletions(-) diff --git a/.github/workflows/manual.sh b/.github/workflows/manual.sh index 29c2c6eeb8..a66248a9fc 100755 --- a/.github/workflows/manual.sh +++ b/.github/workflows/manual.sh @@ -10,12 +10,29 @@ # Automatic exit on error set -e +# Usage +function usage() { + echo "Usage: $(basename $0) codegen|tput" + exit 1 +} + +# Check input arguments +if [ "$1" == "codegen" ]; then + stage=$1 + shift +elif [ "$1" == "tput" ]; then + stage=$1 + shift +else + usage +fi + # Exit status status=0 # Initialise echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -echo "[manual.sh] starting at $(date)" +echo "[manual.sh] $stage starting at $(date)" echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" echo @@ -34,40 +51,72 @@ topdir=$(pwd) #echo "Contents of MG5aMC/mg5amcnlo (end)" # Code generation -cd ${topdir}/epochX/cudacpp -processes="$(git ls-tree --name-only HEAD *.mad *.sa)" -###processes="gg_tt.mad" -for proc in $processes; do - echo - echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" - echo "Code generation for ${proc}" - echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" - if [ "${proc%.mad}" != "${proc}" ]; then - # Generate code and check clang formatting - ./CODEGEN/generateAndCompare.sh -q ${proc%.mad} --mad - elif [ "${proc%.sa}" != "${proc}" ]; then - # Generate code and check clang formatting - ./CODEGEN/generateAndCompare.sh -q ${proc%.sa} - else - echo "WARNING! SKIP process directory '${proc}' because it does not end in .mad or .sa" - fi - # Check if there are any differences to the current repo - git checkout HEAD ${proc}/CODEGEN*.txt - if [ "${proc%.mad}" != "${proc}" ]; then - git checkout HEAD ${proc}/Cards/me5_configuration.txt - ###sed -i 's/DEFAULT_F2PY_COMPILER=f2py.*/DEFAULT_F2PY_COMPILER=f2py3/' ${proc}/Source/make_opts - git checkout HEAD ${proc}/Source/make_opts - fi +if [ "$stage" == "codegen" ]; then + cd ${topdir}/epochX/cudacpp + ###processes="$(git ls-tree --name-only HEAD *.mad *.sa)" + processes="gg_tt.mad" # FOR QUICK TESTS + for proc in $processes; do + echo + echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" + echo "Code generation for ${proc}" + echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" + if [ "${proc%.mad}" != "${proc}" ]; then + # Generate code and check clang formatting + ./CODEGEN/generateAndCompare.sh -q ${proc%.mad} --mad + elif [ "${proc%.sa}" != "${proc}" ]; then + # Generate code and check clang formatting + ./CODEGEN/generateAndCompare.sh -q ${proc%.sa} + else + echo "WARNING! SKIP process directory '${proc}' because it does not end in .mad or .sa" + fi + # Check if there are any differences to the current repo + git checkout HEAD ${proc}/CODEGEN*.txt + if [ "${proc%.mad}" != "${proc}" ]; then + git checkout HEAD ${proc}/Cards/me5_configuration.txt + ###sed -i 's/DEFAULT_F2PY_COMPILER=f2py.*/DEFAULT_F2PY_COMPILER=f2py3/' ${proc}/Source/make_opts + git checkout HEAD ${proc}/Source/make_opts + fi + echo + echo "git diff (start)" + git diff --exit-code + echo "git diff (end)" + done +fi + +# Tput tests (build, runTest.exe, check.exe, gcheck.exe) +if [ "$stage" == "tput" ]; then + cd ${topdir}/epochX/cudacpp + # Install ccache echo - echo "git diff (start)" - git diff --exit-code - echo "git diff (end)" -done + echo "wget -q https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3-linux-x86_64.tar.xz" + wget -q https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3-linux-x86_64.tar.xz + echo + echo "tar -xvf ccache-4.8.3-linux-x86_64.tar.xz" + tar -xvf ccache-4.8.3-linux-x86_64.tar.xz + export PATH=$(pwd)/ccache-4.8.3-linux-x86_64:$PATH + # Configure ccache + mkdir $(pwd)/CCACHE_DIR + export CCACHE_DIR=$(pwd)/CCACHE_DIR + echo + echo "ccache --version | head -1" + ccache --version | head -1 + echo + echo "ccache -s" + ccache -s + # Configure CXX + echo + echo "g++ --version" + g++ --version + export CXX=g++ + # Build and test + echo "./tput/teeThroughputX.sh -makej -ggtt -makeclean" + ./tput/teeThroughputX.sh -makej -ggtt -makeclean +fi # Finalise echo echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" -if [ $status -eq 0 ]; then +if [ $status -eq 0 ]; then # keep this just in case, but 'set -e' causes immediate exit on any error echo "[manual.sh] $stage finished with status=$status (OK) at $(date)" else echo "[manual.sh] $stage finished with status=$status (NOT OK) at $(date)" diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index a1dd7986b9..7499ffbbd9 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -18,7 +18,7 @@ on: # type: string jobs: - codegen: + manualtestsuite: runs-on: ubuntu-latest steps: # See https://github.com/actions/checkout @@ -27,7 +27,9 @@ jobs: - uses: actions/checkout@v4 with: submodules: 'true' - - name: codegen_step - run: echo Current directory is $(pwd); echo execute .github/workflows/manual.sh; .github/workflows/manual.sh + #- name: codegen_step + # run: .github/workflows/manual.sh codegen + - name: tput_step + run: .github/workflows/manual.sh tput #- name: Send greeting # run: echo "Hello ${{ inputs.name }}"