From 998bf4d2d9633d31e11843bc0f87a122f074dd7e Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 11:28:14 +0100 Subject: [PATCH 01/13] adding check-contrib workflow --- .github/workflows/check-contrib.yml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/check-contrib.yml diff --git a/.github/workflows/check-contrib.yml b/.github/workflows/check-contrib.yml new file mode 100644 index 00000000..598e8f91 --- /dev/null +++ b/.github/workflows/check-contrib.yml @@ -0,0 +1,33 @@ +name: check-contrib + +on: [push, pull_request] # would you need to define PRs containing .eb files? + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + check-contrib: + name: Run EasyBuild check-contrib + runs-on: ubuntu-22.04 + + steps: + - name: Check out source repository + uses: actions/checkout@v4 + + - name: Set up Python env + uses: actions/setup-python@v5 + with: + python-version: '3.8' + + - name: Upgrade pip + run: python -m pip install --upgrade pip + + - name: Install EasyBuild and pycodestyle # needed for check-contrib + run: pip install easybuild pycodestyle + + - name: Run check-contrib + run: | + for file in $(find . -name '*.eb'); do + echo "Checking $file" + eb "$file" --check-contrib + done From f1969460ae4a1d28cd6a7b17e25ec036e4dcf7d0 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 11:30:53 +0100 Subject: [PATCH 02/13] pin eb version --- .github/workflows/check-contrib.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-contrib.yml b/.github/workflows/check-contrib.yml index 598e8f91..f1c1ee59 100644 --- a/.github/workflows/check-contrib.yml +++ b/.github/workflows/check-contrib.yml @@ -23,7 +23,7 @@ jobs: run: python -m pip install --upgrade pip - name: Install EasyBuild and pycodestyle # needed for check-contrib - run: pip install easybuild pycodestyle + run: pip install easybuild==4.9.4 pycodestyle - name: Run check-contrib run: | From a487b002c1360fb2367ae3dbcd6a6e2fd1d29dd7 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 11:34:41 +0100 Subject: [PATCH 03/13] add example eb file --- .../p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb diff --git a/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb new file mode 100644 index 00000000..aa84a50d --- /dev/null +++ b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb @@ -0,0 +1,33 @@ +name = 'pybind11' +version = '2.12.0' + +homepage = 'https://pybind11.readthedocs.io' +description = """pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, + mainly to create Python bindings of existing C++ code.""" + +toolchain = {'name': 'GCC', 'version': '12.3.0'} + +source_urls = ['https://github.com/pybind/pybind11/archive/'] +sources = ['v%(version)s.tar.gz'] +patches = [ + 'pybind11-2.10.3_require-catch.patch', +] +checksums = [ + {'v2.12.0.tar.gz': 'bf8f242abd1abcd375d516a7067490fb71abd79519a282d22b6e4d19282185a7'}, + {'pybind11-2.10.3_require-catch.patch': '4a27ba3ef1d5c535d120d6178a6e876ae678e4899a07500aab37908357b0b60b'}, +] + +builddependencies = [ + ('CMake', '3.26.3'), + # Test dependencies + ('Eigen', '3.4.0'), + ('Catch2', '2.13.9'), + ('Python-bundle-PyPI', '2023.06'), # to provide pytest +] + +dependencies = [ + ('Boost', '1.82.0'), + ('Python', '3.11.3'), +] + +moduleclass = 'lib' From 6f0ea1fc4b9080040a882117464ecd23064d77a6 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 12:20:57 +0100 Subject: [PATCH 04/13] add required deps and update eb file check --- .github/workflows/check-contrib.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-contrib.yml b/.github/workflows/check-contrib.yml index f1c1ee59..32938816 100644 --- a/.github/workflows/check-contrib.yml +++ b/.github/workflows/check-contrib.yml @@ -13,6 +13,8 @@ jobs: steps: - name: Check out source repository uses: actions/checkout@v4 + # with: + # fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} - name: Set up Python env uses: actions/setup-python@v5 @@ -22,12 +24,18 @@ jobs: - name: Upgrade pip run: python -m pip install --upgrade pip - - name: Install EasyBuild and pycodestyle # needed for check-contrib - run: pip install easybuild==4.9.4 pycodestyle - - - name: Run check-contrib + - name: Install EasyBuild and required deps + run: | + pip install easybuild==4.9.4 pycodestyle + sudo apt-get install -y lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev + sudo apt install -y curl + LMOD_VERSION=8.7.4 + curl -OL https://github.com/surak/Lmod/releases/download/${LMOD_VERSION}/lmod_${LMOD_VERSION}_all.deb + sudo apt install -y ./lmod_${LMOD_VERSION}_all.deb + + - name: check-contrib modified .ebs only run: | - for file in $(find . -name '*.eb'); do - echo "Checking $file" + CHANGED_EBS=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.eb$' || true) + for file in $CHANGED_EBS; do eb "$file" --check-contrib done From 6c77daa6d203a837620b40f77ec7db8cf38ed9ca Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 12:28:16 +0100 Subject: [PATCH 05/13] test --- easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb index aa84a50d..35ce178e 100644 --- a/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb +++ b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb @@ -19,7 +19,7 @@ checksums = [ builddependencies = [ ('CMake', '3.26.3'), - # Test dependencies + # Test dependencies - bla bla ('Eigen', '3.4.0'), ('Catch2', '2.13.9'), ('Python-bundle-PyPI', '2023.06'), # to provide pytest From b149f7fb59e58c98c2de5a10426f63506c846cb0 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 12:28:39 +0100 Subject: [PATCH 06/13] test --- .github/workflows/check-contrib.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-contrib.yml b/.github/workflows/check-contrib.yml index 32938816..6007fe0b 100644 --- a/.github/workflows/check-contrib.yml +++ b/.github/workflows/check-contrib.yml @@ -34,6 +34,7 @@ jobs: sudo apt install -y ./lmod_${LMOD_VERSION}_all.deb - name: check-contrib modified .ebs only + # this is too broad and runs this action on any change, rather than just eb run: | CHANGED_EBS=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.eb$' || true) for file in $CHANGED_EBS; do From 81e2f743f454c3846d88aa0e3dfa3570c1c04bf2 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 14:38:33 +0100 Subject: [PATCH 07/13] try fixing git commit check --- .github/workflows/check-contrib.yml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-contrib.yml b/.github/workflows/check-contrib.yml index 6007fe0b..62660c88 100644 --- a/.github/workflows/check-contrib.yml +++ b/.github/workflows/check-contrib.yml @@ -13,8 +13,8 @@ jobs: steps: - name: Check out source repository uses: actions/checkout@v4 - # with: - # fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} + with: + fetch-depth: 2 # shallow but deep enough to diff last commit - name: Set up Python env uses: actions/setup-python@v5 @@ -33,10 +33,26 @@ jobs: curl -OL https://github.com/surak/Lmod/releases/download/${LMOD_VERSION}/lmod_${LMOD_VERSION}_all.deb sudo apt install -y ./lmod_${LMOD_VERSION}_all.deb - - name: check-contrib modified .ebs only - # this is too broad and runs this action on any change, rather than just eb + - name: Run --check-contrib + env: + BEFORE_SHA: ${{ github.event.before }} + AFTER_SHA: ${{ github.sha }} run: | - CHANGED_EBS=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.eb$' || true) + echo "Fetching prior commit for diff" + git fetch origin "$BEFORE_SHA" + + echo "Checking for modified .eb files" + CHANGED_EBS=$(git diff --name-only --diff-filter=d "$BEFORE_SHA" "$AFTER_SHA" -- '*.eb' || echo "") + + if [ -z "$CHANGED_EBS" ]; then + echo "No .eb files changed. Skipping check-contrib." + exit 0 + fi + + echo "Files to check:" + printf '%s\n' "$CHANGED_EBS" + for file in $CHANGED_EBS; do - eb "$file" --check-contrib + echo "Checking $file" + eb "$file" --check-contrib || exit 1 # Fail fast on errors done From 7bcb1b49037b460ffab0288e1ba453136bf7a072 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 14:41:41 +0100 Subject: [PATCH 08/13] take 2 testing the github action --- easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb index 35ce178e..622b0759 100644 --- a/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb +++ b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb @@ -19,7 +19,7 @@ checksums = [ builddependencies = [ ('CMake', '3.26.3'), - # Test dependencies - bla bla + # Test dependencies - bla bla # 1441, 1804, add another line to test check-contrib ('Eigen', '3.4.0'), ('Catch2', '2.13.9'), ('Python-bundle-PyPI', '2023.06'), # to provide pytest From 3e9f3df92029310eb431404d63c364ff6e52efd9 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 15:21:30 +0100 Subject: [PATCH 09/13] fix lmod install issues --- .github/workflows/check-contrib.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-contrib.yml b/.github/workflows/check-contrib.yml index 62660c88..dc36a78a 100644 --- a/.github/workflows/check-contrib.yml +++ b/.github/workflows/check-contrib.yml @@ -14,7 +14,7 @@ jobs: - name: Check out source repository uses: actions/checkout@v4 with: - fetch-depth: 2 # shallow but deep enough to diff last commit + fetch-depth: 2 # shallow but deep enough to diff last commit; I don't want to have do to fetch-depth: 0 and get the full history - name: Set up Python env uses: actions/setup-python@v5 @@ -26,13 +26,26 @@ jobs: - name: Install EasyBuild and required deps run: | + echo "Installing easybuild and pycodestyle" pip install easybuild==4.9.4 pycodestyle + + echo "Installing LMOD" sudo apt-get install -y lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev sudo apt install -y curl LMOD_VERSION=8.7.4 curl -OL https://github.com/surak/Lmod/releases/download/${LMOD_VERSION}/lmod_${LMOD_VERSION}_all.deb sudo apt install -y ./lmod_${LMOD_VERSION}_all.deb + # default install location via sudo apt goes to /usr/lmod + export PATH="/usr/lmod/$LMOD_VERSION/libexec:$PATH" + export MOD_INIT="/usr/lmod/$LMOD_VERSION/init/bash" + echo $MOD_INIT > mod_init; echo $PATH > path + source $(cat $HOME/mod_init); type module + export EASYBUILD_MODULES_TOOL=Lmod + + # Verify LMOD install + which lmod ; lmod --version + - name: Run --check-contrib env: BEFORE_SHA: ${{ github.event.before }} @@ -52,6 +65,9 @@ jobs: echo "Files to check:" printf '%s\n' "$CHANGED_EBS" + # check eb is available + eb --version; eb --show-config + for file in $CHANGED_EBS; do echo "Checking $file" eb "$file" --check-contrib || exit 1 # Fail fast on errors From 2f096ed52331fbd476ad8e242bc139ee5f876a7c Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 15:33:45 +0100 Subject: [PATCH 10/13] fixing variables --- .github/workflows/check-contrib.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-contrib.yml b/.github/workflows/check-contrib.yml index dc36a78a..577ea27b 100644 --- a/.github/workflows/check-contrib.yml +++ b/.github/workflows/check-contrib.yml @@ -39,8 +39,10 @@ jobs: # default install location via sudo apt goes to /usr/lmod export PATH="/usr/lmod/$LMOD_VERSION/libexec:$PATH" export MOD_INIT="/usr/lmod/$LMOD_VERSION/init/bash" - echo $MOD_INIT > mod_init; echo $PATH > path - source $(cat $HOME/mod_init); type module + + echo $MOD_INIT > "$GITHUB_WORKSPACE/mod_init" + echo $PATH > "$GITHUB_WORKSPACE/path" + source $(cat "$GITHUB_WORKSPACE/mod_init") ; type module export EASYBUILD_MODULES_TOOL=Lmod # Verify LMOD install From e727b7e3d64691ba685d2f2879c83c6886d73d96 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 15:42:48 +0100 Subject: [PATCH 11/13] test again --- easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb index 622b0759..430f4802 100644 --- a/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb +++ b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb @@ -20,7 +20,7 @@ checksums = [ builddependencies = [ ('CMake', '3.26.3'), # Test dependencies - bla bla # 1441, 1804, add another line to test check-contrib - ('Eigen', '3.4.0'), + ('Eigen', '3.4.0'), # 1542, 1804, add another line to test check-contrib ('Catch2', '2.13.9'), ('Python-bundle-PyPI', '2023.06'), # to provide pytest ] From 3303a08b43004c19374a1c7a1606da45fc9410a0 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 15:50:14 +0100 Subject: [PATCH 12/13] add lmod vars to eb run step --- .github/workflows/check-contrib.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/check-contrib.yml b/.github/workflows/check-contrib.yml index 577ea27b..e3273a1d 100644 --- a/.github/workflows/check-contrib.yml +++ b/.github/workflows/check-contrib.yml @@ -52,7 +52,14 @@ jobs: env: BEFORE_SHA: ${{ github.event.before }} AFTER_SHA: ${{ github.sha }} + LMOD_VERSION: 8.7.4 + MOD_INIT: "/usr/lmod/$LMOD_VERSION/init/bash" + run: | + export PATH="/usr/lmod/$LMOD_VERSION/libexec:$PATH" + echo $MOD_INIT > "$GITHUB_WORKSPACE/mod_init" + echo $PATH > "$GITHUB_WORKSPACE/path" + echo "Fetching prior commit for diff" git fetch origin "$BEFORE_SHA" From ba1ce4fb4d26fb4a19c8d58bc8a47a6a9c8173d1 Mon Sep 17 00:00:00 2001 From: Chris Greasley Date: Tue, 8 Apr 2025 15:53:57 +0100 Subject: [PATCH 13/13] testing --- easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb index 430f4802..1f197cb1 100644 --- a/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb +++ b/easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb @@ -21,7 +21,7 @@ builddependencies = [ ('CMake', '3.26.3'), # Test dependencies - bla bla # 1441, 1804, add another line to test check-contrib ('Eigen', '3.4.0'), # 1542, 1804, add another line to test check-contrib - ('Catch2', '2.13.9'), + ('Catch2', '2.13.9'),# 1550, 1804, add another line to test check-contrib ('Python-bundle-PyPI', '2023.06'), # to provide pytest ]