diff --git a/.github/workflows/pr_analysis.yml b/.github/workflows/pr_analysis.yml new file mode 100644 index 0000000000..cdd4caca50 --- /dev/null +++ b/.github/workflows/pr_analysis.yml @@ -0,0 +1,102 @@ +# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions +name: Analysis of a pull request +on: [push, pull_request, workflow_dispatch] +permissions: + contents: read # to fetch code (actions/checkout) +jobs: + pilot: + runs-on: ubuntu-20.04 + permissions: + contents: read + pull-requests: write + strategy: + fail-fast: false + matrix: + EESSI_VERSION: + - 2023.06 + EESSI_SOFTWARE_SUBDIR: + - x86_64/generic + # - aarch64/generic + # - x86_64/amd/zen2 + # - x86_64/intel/broadwell + # - x86_64/intel/cascadelake + # - x86_64/intel/skylake_avx512 + EASYSTACK_FILE: + # - eessi-2023.06-eb-4.7.2-2021a.yml + # - eessi-2023.06-eb-4.7.2-2021b.yml + # - eessi-2023.06-eb-4.7.2-2022a.yml + # - eessi-2023.06-eb-4.7.2-2022b.yml + # - eessi-2023.06-eb-4.7.2-system.yml + # - eessi-2023.06-eb-4.8.0-system.yml + - eessi-2023.06-eb-4.8.1-2022a.yml + # - eessi-2023.06-eb-4.8.1-system.yml + python: [3.7] # ScanCode-Toolkit requires Python 3.7 or newer + steps: + - name: Install dependencies for ScanCode-Toolkit + run: | + sudo apt install python-dev bzip2 xz-utils zlib1g libxml2-dev libxslt1-dev libpopt0 + + - name: set up Python + uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0 + with: + python-version: ${{matrix.python}} + architecture: x64 + + - name: upgrade base tools + run: | + pip install --user --upgrade pip setuptools wheel + + - name: Install ScanCode-Toolkit + run: | + pip install --user scancode-toolkit + + - name: Check out software-layer repository + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + + - name: Mount EESSI CernVM-FS pilot repository + uses: cvmfs-contrib/github-action-cvmfs@d4641d0d591c9a5c3be23835ced2fb648b44c04b # v3.1 + with: + cvmfs_config_package: https://github.com/NorESSI/filesystem-layer/releases/download/latest/cvmfs-config-nessi_latest_all.deb + cvmfs_http_proxy: DIRECT + cvmfs_repositories: pilot.nessi.no + + - name: Determine missing installations + if: '!cancelled()' + run: | + export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${{matrix.EESSI_SOFTWARE_SUBDIR}} + source /cvmfs/pilot.nessi.no/versions/${{matrix.EESSI_VERSION}}/init/bash + module load EasyBuild + eb --version + export EESSI_PREFIX=/cvmfs/pilot.nessi.no/versions/${{matrix.EESSI_VERSION}} + export EESSI_OS_TYPE=linux + env | grep ^EESSI | sort + source configure_easybuild + EB_MISSING_OUT=eb_missing.out + echo "eb start" + eb --missing --easystack ${{matrix.EASYSTACK_FILE}} > ${EB_MISSING_OUT} || true + echo "eb done" + PR_UPDATE_FILE=$(mktemp ${{matrix.EASYSTACK_FILE}}.XXX) + echo "PR_UPDATE_FILE=${PR_UPDATE_FILE}" >> "${GITHUB_ENV}" + echo "# PR analysis for arch ${{matrix.EESSI_SOFTWARE_SUBDIR}}" > ${PR_UPDATE_FILE} + echo "grep start" + if [[ $(grep '.* out of .* required modules missing:' ${EB_MISSING_OUT}) ]]; then + # there may be multiple sections with the above search string + # we grab all lines listing missing modules and print a list of + # unique modules only + MISSING_MODULES=$(grep '^* ' ${EB_MISSING_OUT} | sort -u) + echo "found $(echo ${MISSING_MODULES} | wc -l) modules missing:" + echo "found $(echo ${MISSING_MODULES} | wc -l) modules missing:" >> ${PR_UPDATE_FILE} + echo "${MISSING_MODULES}" + echo "${MISSING_MODULES}" >> ${PR_UPDATE_FILE} + else + echo "no modules missing" + echo "no modules missing" > ${PR_UPDATE_FILE} + fi + + - name: Update PR description + uses: nefrob/pr-description@eb00e54af678cf0d50a5b8fdd54b557c9cd8ddc5 + with: + content: ${PR_UPDATE_FILE} + regex: "# PR analysis for arch ${{matrix.EESSI_SOFTWARE_SUBDIR}}.*" + regexFlags: i + token: ${{ secrets.GITHUB_TOKEN }}