Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/check-contrib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: check-contrib

on: [push, pull_request] # would you need to define PRs containing .eb files?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the workflow is triggered on all push and pull request events, should I add a conditional to only run the check-contrib step if .eb files are modified?

e.g. if: contains(github.event.pull_request.changed_files, '.eb')


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
with:
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
with:
python-version: '3.8'

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install EasyBuild and required deps
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add caching for Python dependencies using actions/cache@v3 to speed up subsequent runs.

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This install section is a bit messy. It can be tidied up. Add neater lines to a variable and then

$APT_APPS_INSTALL _LIST= lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev curl
sudo apt-get install -y $APT_APPS_INSTALL_LIST

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 > "$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
which lmod ; lmod --version

- name: Run --check-contrib
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"

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"

# 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
done
33 changes: 33 additions & 0 deletions easyconfigs/p/pybind11/pybind11-2.12.0-GCC-12.3.0.eb
Original file line number Diff line number Diff line change
@@ -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 - 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'),# 1550, 1804, add another line to test check-contrib
('Python-bundle-PyPI', '2023.06'), # to provide pytest
]

dependencies = [
('Boost', '1.82.0'),
('Python', '3.11.3'),
]

moduleclass = 'lib'
Loading