From 30a2707e56898436de760fee42be473fcfc399a3 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Thu, 29 Oct 2026 18:27:31 +0100 Subject: [PATCH 1/2] Do a simple loop for archdetect CI --- .github/workflows/tests_archdetect.yml | 137 +++++++++++++------------ 1 file changed, 72 insertions(+), 65 deletions(-) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 81257a7f..0a41a14e 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -6,80 +6,87 @@ on: pull_request: permissions: contents: read # to fetch code (actions/checkout) + jobs: build: runs-on: ubuntu-24.04 - strategy: - matrix: - proc_cpuinfo: - - x86_64/intel/haswell/archspec-linux-E5-2680-v3 - - x86_64/intel/sapphirerapids/AWS-Rocky8-8488C - - x86_64/intel/skylake_avx512/archspec-linux-6132 - - x86_64/amd/zen2/Azure-CentOS7-7V12 - - x86_64/amd/zen3/Azure-CentOS7-7V73X - - x86_64/amd/zen4/Azure-Alma8-9V33X - - x86_64/amd/zen4/Shinx-RHEL8-9654 - - x86_64/amd/zen5/AWS-Rocky9-9R45 - - x86_64/amd/zen5/RUG-AlmaLinux8-9575F - - aarch64/a64fx/Deucalion-Rocky85 - - aarch64/neoverse_n1/Azure-Ubuntu20-Altra - - aarch64/neoverse_n1/AWS-awslinux-graviton2 - - aarch64/neoverse_v1/AWS-awslinux-graviton3 - - aarch64/nvidia/grace/Jureca-Rocky95 - - aarch64/google/axion/GCP-axion - - riscv64/sifive/premier-Ubuntu24 - - riscv64/spacemit/bananaf3-Armbian - - riscv64/spacemit/bananaf3-k6.6 - # commented out since these targets are currently not supported in software.eessi.io repo - # (and some tests assume that the corresponding subdirectory in software layer is there) - # - ppc64le/power9le/unknown-power9le - fail-fast: false steps: - - name: checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Mount EESSI CernVM-FS pilot repository - uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 - with: + - name: Mount EESSI CernVM-FS pilot repository + uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 + with: cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb cvmfs_http_proxy: DIRECT cvmfs_repositories: software.eessi.io - - name: test eessi_archdetect.sh - run: | - export EESSI_MACHINE_TYPE=${{matrix.proc_cpuinfo}} - export EESSI_MACHINE_TYPE=${EESSI_MACHINE_TYPE%%/*} - export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}}.cpuinfo - # check that printing of best match works correctly - CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) - if [[ $CPU_ARCH == "$( cat ./tests/archdetect/${{matrix.proc_cpuinfo}}.output )" ]]; then - echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCH" - else - echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCH" >&2 + - name: Test eessi_archdetect.sh + shell: bash + run: | + set -e + + proc_cpuinfos=( + "x86_64/intel/haswell/archspec-linux-E5-2680-v3" + "x86_64/intel/sapphirerapids/AWS-Rocky8-8488C" + "x86_64/intel/skylake_avx512/archspec-linux-6132" + "x86_64/amd/zen2/Azure-CentOS7-7V12" + "x86_64/amd/zen3/Azure-CentOS7-7V73X" + "x86_64/amd/zen4/Azure-Alma8-9V33X" + "x86_64/amd/zen4/Shinx-RHEL8-9654" + "x86_64/amd/zen5/AWS-Rocky9-9R45" + "x86_64/amd/zen5/RUG-AlmaLinux8-9575F" + "aarch64/a64fx/Deucalion-Rocky85" + "aarch64/neoverse_n1/Azure-Ubuntu20-Altra" + "aarch64/neoverse_n1/AWS-awslinux-graviton2" + "aarch64/neoverse_v1/AWS-awslinux-graviton3" + "aarch64/nvidia/grace/Jureca-Rocky95" + "aarch64/google/axion/GCP-axion" + "riscv64/sifive/premier-Ubuntu24" + "riscv64/spacemit/bananaf3-Armbian" + "riscv64/spacemit/bananaf3-k6.6" + ) + + for proc_cpuinfo in "${proc_cpuinfos[@]}"; do + echo "::group::Testing $proc_cpuinfo" + + export EESSI_MACHINE_TYPE="${proc_cpuinfo%%/*}" + export EESSI_PROC_CPUINFO="./tests/archdetect/${proc_cpuinfo}.cpuinfo" + + CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) + expected=$(cat "./tests/archdetect/${proc_cpuinfo}.output") + if [[ "$CPU_ARCH" == "$expected" ]]; then + echo "Test for $proc_cpuinfo PASSED: $CPU_ARCH" + else + echo "Test for $proc_cpuinfo FAILED: $CPU_ARCH (expected: $expected)" >&2 exit 1 - fi - # check that $EESSI_SOFTWARE_SUBDIR_OVERRIDE is honored - export EESSI_SOFTWARE_SUBDIR_OVERRIDE='dummy/cpu' - CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) - if [[ $CPU_ARCH == "${EESSI_SOFTWARE_SUBDIR_OVERRIDE}" ]]; then - echo "Test for picking up on \$EESSI_SOFTWARE_SUBDIR_OVERRIDE PASSED" - else - echo "Test for picking up on \$EESSI_SOFTWARE_SUBDIR_OVERRIDE FAILED" >&2 + fi + + export EESSI_SOFTWARE_SUBDIR_OVERRIDE='dummy/cpu' + CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) + if [[ "$CPU_ARCH" == "$EESSI_SOFTWARE_SUBDIR_OVERRIDE" ]]; then + echo "Test for picking up on EESSI_SOFTWARE_SUBDIR_OVERRIDE PASSED" + else + echo "Test for picking up on EESSI_SOFTWARE_SUBDIR_OVERRIDE FAILED" >&2 exit 1 - fi - unset EESSI_SOFTWARE_SUBDIR_OVERRIDE - # check that printing of all matches works correctly (-a option for cpupath action) - CPU_ARCHES=$(./init/eessi_archdetect.sh -a cpupath) - if [[ $CPU_ARCHES == "$( cat ./tests/archdetect/${{matrix.proc_cpuinfo}}.all.output )" ]]; then - echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCHES" - else - echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCHES" >&2 + fi + unset EESSI_SOFTWARE_SUBDIR_OVERRIDE + + CPU_ARCHES=$(./init/eessi_archdetect.sh -a cpupath) + expected_all=$(cat "./tests/archdetect/${proc_cpuinfo}.all.output") + if [[ "$CPU_ARCHES" == "$expected_all" ]]; then + echo "Test for $proc_cpuinfo PASSED: $CPU_ARCHES" + else + echo "Test for $proc_cpuinfo FAILED: $CPU_ARCHES (expected: $expected_all)" >&2 exit 1 - fi - # Check all those architectures actually exist (if this EESSI version has been populated already) - if [ -d ${EESSI_PREFIX}/software/linux ]; then - for dir in $(echo "$CPU_ARCHES" | tr ':' '\n'); do - # Search all EESSI versions as we may drop support at some point - ls -d ${EESSI_PREFIX}/software/linux/${dir} - done - fi + fi + + if [[ -d "${EESSI_PREFIX}/software/linux" ]]; then + while IFS= read -r dir; do + ls -d "${EESSI_PREFIX}/software/linux/${dir}" + done < <(tr ':' '\n' <<< "$CPU_ARCHES") + fi + + echo "::endgroup::" + done + From 2f395cc5436e12662f64afdf853e41bf58526331 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Thu, 29 Oct 2026 18:38:39 +0100 Subject: [PATCH 2/2] Update .github/workflows/tests_archdetect.yml --- .github/workflows/tests_archdetect.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 0a41a14e..6bed0b24 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -62,12 +62,13 @@ jobs: exit 1 fi + # check that $EESSI_SOFTWARE_SUBDIR_OVERRIDE is honored export EESSI_SOFTWARE_SUBDIR_OVERRIDE='dummy/cpu' CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) - if [[ "$CPU_ARCH" == "$EESSI_SOFTWARE_SUBDIR_OVERRIDE" ]]; then - echo "Test for picking up on EESSI_SOFTWARE_SUBDIR_OVERRIDE PASSED" + if [[ "$CPU_ARCH" == "${EESSI_SOFTWARE_SUBDIR_OVERRIDE}" ]]; then + echo "Test for picking up on \$EESSI_SOFTWARE_SUBDIR_OVERRIDE PASSED" else - echo "Test for picking up on EESSI_SOFTWARE_SUBDIR_OVERRIDE FAILED" >&2 + echo "Test for picking up on \$EESSI_SOFTWARE_SUBDIR_OVERRIDE FAILED" >&2 exit 1 fi unset EESSI_SOFTWARE_SUBDIR_OVERRIDE