-
Notifications
You must be signed in to change notification settings - Fork 0
adding --check-contrib to repo workflow #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
998bf4d
f196946
a487b00
6f0ea1f
6c77daa
b149f7f
81e2f74
7bcb1b4
3e9f3df
2f096ed
e727b7e
3303a08
ba1ce4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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? | ||
|
|
||
| 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 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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 | ||
| 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' |
There was a problem hiding this comment.
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')