|
| 1 | +# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions |
| 2 | +name: Check whether eb_hooks.py script is up-to-date |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | +permissions: |
| 8 | + contents: read # to fetch code (actions/checkout) |
| 9 | +env: |
| 10 | + EESSI_VERSION: '2023.06' |
| 11 | +jobs: |
| 12 | + check_eb_hooks: |
| 13 | + runs-on: ubuntu-24.04 |
| 14 | + steps: |
| 15 | + - name: Check out software-layer repository |
| 16 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 17 | + with: |
| 18 | + fetch-depth: 0 # Fetch all history for all branches and tags |
| 19 | + |
| 20 | + - name: Show host system info |
| 21 | + run: | |
| 22 | + echo "/proc/cpuinfo:" |
| 23 | + cat /proc/cpuinfo |
| 24 | + echo |
| 25 | + echo "lscpu:" |
| 26 | + lscpu |
| 27 | +
|
| 28 | + - name: Mount EESSI CernVM-FS pilot repository |
| 29 | + uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 |
| 30 | + with: |
| 31 | + cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb |
| 32 | + cvmfs_http_proxy: DIRECT |
| 33 | + cvmfs_repositories: software.eessi.io |
| 34 | + |
| 35 | + - name: Check that EasyBuild hook is up to date |
| 36 | + if: ${{ github.event_name == 'pull_request' }} |
| 37 | + run: | |
| 38 | + FILE="eb_hooks.py" |
| 39 | + TEMP_FILE="$(mktemp)" |
| 40 | +
|
| 41 | + # Fetch base branch |
| 42 | + git fetch origin ${{ github.base_ref }} |
| 43 | +
|
| 44 | + # Check if the hooks has changed in the PR |
| 45 | + if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^$FILE$"; then |
| 46 | + echo "Hooks changed in PR. Using PR version." |
| 47 | + cp "$FILE" "$TEMP_FILE" |
| 48 | + else |
| 49 | + echo "File not changed in PR. Using default branch version." |
| 50 | + git show origin/${{ github.base_ref }}:$FILE > "$TEMP_FILE" |
| 51 | + fi |
| 52 | +
|
| 53 | + # Compare the hooks to what is shipped in the repository |
| 54 | + # (it is overkill, but harmless, to do this for every architecture) |
| 55 | + export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${{matrix.EESSI_SOFTWARE_SUBDIR_OVERRIDE}} |
| 56 | + source /cvmfs/software.eessi.io/versions/${EESSI_VERSION}/init/bash |
| 57 | + module load EESSI-extend |
| 58 | + diff "$TEMP_FILE" "$EASYBUILD_HOOKS" |
0 commit comments