Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…asyconfigs into 20241105144555_new_pr_Porechop02420240119
  • Loading branch information
vsc46128 vscuser committed Nov 6, 2024
2 parents 35c11c9 + b1d00ee commit 3a44c68
Show file tree
Hide file tree
Showing 16 changed files with 407 additions and 49 deletions.
62 changes: 31 additions & 31 deletions .github/workflows/tagbot.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# NOTE: In order to write comment and edit labels, this script requires workflows with write permissions.
# It should not use any untrusted third party code, or any code checked into the repository itself
# as that could indirectly grant PRs the ability to edit labels and comments on PRs.

import os
import git
import requests
import json
import difflib
from datetime import datetime
from pathlib import Path


Expand All @@ -12,8 +14,7 @@ def get_first_commit_date(repo, file_path):
if commits:
return commits[-1].committed_date
else:
print(f"{file_path} has no commit info, putting it last")
return datetime.datetime.min
raise ValueError(f'{file_path} has no commit info, this should not happen')


def sort_by_added_date(repo, file_paths):
Expand All @@ -27,17 +28,6 @@ def similar_easyconfigs(repo, new_file):
return sort_by_added_date(repo, possible_neighbours)


def diff(old, new):
with open(old, 'r') as old_file, open(new, 'r') as new_file:
old_lines = list(old_file)
new_lines = list(new_file)
return ''.join(difflib.unified_diff(
old_lines,
new_lines,
fromfile=str(old),
tofile=str(new)))


def pr_ecs(pr_diff):
new_ecs = []
changed_ecs = []
Expand All @@ -51,33 +41,38 @@ def pr_ecs(pr_diff):


GITHUB_API_URL = 'https://api.github.com'
event_path = os.getenv("GITHUB_EVENT_PATH")
token = os.getenv("GH_TOKEN")
repo = os.getenv("GITHUB_REPOSITORY")
base_branch_name = os.getenv("GITHUB_BASE_REF")
pr_ref_name = os.getenv("GITHUB_REF_NAME")
event_path = os.getenv('GITHUB_EVENT_PATH')
token = os.getenv('GH_TOKEN')
repo = os.getenv('GITHUB_REPOSITORY')
base_branch_name = os.getenv('GITHUB_BASE_REF')

with open(event_path) as f:
data = json.load(f)

pr_number = data['pull_request']['number']
# Can't rely on merge_commit_sha for pull_request_target as it might be outdated
# merge_commit_sha = data['pull_request']['merge_commit_sha']

print("PR number:", pr_number)
print("Repo:", repo)
print("Base branch name:", base_branch_name)
print("PR ref:", pr_ref_name)

gitrepo = git.Repo(".")

# Change into "pr" checkout directory to allow diffs and glob to work on the same content
os.chdir('pr')
gitrepo = git.Repo('.')

target_commit = gitrepo.commit('origin/' + base_branch_name)
pr_commit = gitrepo.commit('pull/' + pr_ref_name)
pr_diff = target_commit.diff(pr_commit)
print("Target commit ref:", target_commit)
merge_commit = gitrepo.head.commit
print("Merge commit:", merge_commit)
pr_diff = target_commit.diff(merge_commit)

new_ecs, changed_ecs = pr_ecs(pr_diff)
modified_workflow = any(item.a_path.startswith('.github/workflows/') for item in pr_diff)


print("Changed ECs:", changed_ecs)
print("Newly added ECs:", new_ecs)
print("Changed ECs:", ', '.join(str(p) for p in changed_ecs))
print("Newly added ECs:", ', '.join(str(p) for p in new_ecs))
print("Modified workflow:", modified_workflow)

new_software = 0
updated_software = 0
Expand Down Expand Up @@ -116,15 +111,20 @@ def pr_ecs(pr_diff):
comment += f'<summary>Diff against <code>{neighbour.name}</code></summary>\n\n'
comment += f'[{neighbour}](https://github.com/{repo}/blob/{base_branch_name}/{neighbour})\n\n'
comment += '```diff\n'
comment += diff(neighbour, new_file)
comment += '```\n</details>\n\n'
comment += gitrepo.git.diff(f'HEAD:{neighbour}', f'HEAD:{new_file}')
comment += '\n```\n</details>\n\n'

print("Adjusting labels")
current_labels = [label['name'] for label in data['pull_request']['labels']]

label_checks = [(changed_ecs, 'change'),
(new_software, 'new'),
(updated_software, 'update'),
(modified_workflow, 'workflow')]

labels_add = []
labels_del = []
for condition, label in [(changed_ecs, 'change'), (new_software, 'new'), (updated_software, 'update')]:
for condition, label in label_checks:
if condition and label not in current_labels:
labels_add.append(label)
elif not condition and label in current_labels:
Expand Down
34 changes: 29 additions & 5 deletions .github/workflows/tagbot.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
name: Tagbot
on: [pull_request]
on: [pull_request_target]

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
tagbot:
# Note: can't rely on github.event.pull_request.merge_commit_sha because pull_request_target
# does not wait for github mergability check, and the value is outdated.
# Instead we merge manually in a temporary subdir "pr"
runs-on: ubuntu-24.04
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Checkout base branch for workflow scripts
uses: actions/checkout@v4

- name: Checkout PR for computing diff into "pr" subdirectory
uses: actions/checkout@v4
with:
ref: "${{ github.event.pull_request.head.sha }}"
path: 'pr'
fetch-depth: 0

- name: Attempt test merge
id: merge
run: |
git config user.name "github-workflow"
git config user.email "[email protected]"
git merge --no-commit --no-ff origin/${{ github.event.pull_request.base.ref }}
continue-on-error: true
working-directory: pr

- run: |
# Make sure the script is unmodified
echo "8be2d295e8436ce557acc8a4d3b82a639913ae65de0d1a76871f21359b4e8d9f .github/workflows/tagbot.py"|sha256sum --check --status
- name: Abort if merge failed
if: steps.merge.outcome == 'failure'
run: |
echo "Merge conflict detected, failing job."
exit 1
- name: set up Python
uses: actions/setup-python@v5
Expand Down
48 changes: 48 additions & 0 deletions easybuild/easyconfigs/a/ASE/ASE-3.23.0-gfbf-2023b.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
easyblock = 'PythonBundle'

name = 'ASE'
version = '3.23.0'

homepage = 'https://wiki.fysik.dtu.dk/ase'
description = """ASE is a python package providing an open source Atomic Simulation Environment
in the Python scripting language.
From version 3.20.1 we also include the ase-ext package, it contains optional reimplementations
in C of functions in ASE. ASE uses it automatically when installed."""

toolchain = {'name': 'gfbf', 'version': '2023b'}

dependencies = [
('Python', '3.11.5'),
('Python-bundle-PyPI', '2023.10'),
('SciPy-bundle', '2023.11'),
('Flask', '3.0.0'),
('matplotlib', '3.8.2'),
('Tkinter', '%(pyver)s'), # Needed by GUI of ASE
('spglib-python', '2.5.0'), # optional
]

use_pip = True
sanity_pip_check = True

exts_list = [
('pytest-mock', '3.14.0', {
'checksums': ['2719255a1efeceadbc056d6bf3df3d1c5015530fb40cf347c0f9afac88410bd0'],
}),
('ase', version, {
'checksums': ['91a2aa31d89bd90b0efdfe4a7e84264f32828b2abfc9f38e65e041ad76fec8ae'],
}),
('ase-ext', '20.9.0', {
'checksums': ['a348b0e42cf9fdd11f04b3df002b0bf150002c8df2698ff08d3c8fc7a1223aed'],
}),
]

sanity_check_paths = {
'files': ['bin/ase'],
'dirs': ['lib/python%(pyshortver)s/site-packages'],
}

# make sure Tkinter is available, otherwise 'ase gui' will not work
sanity_check_commands = ["python -c 'import tkinter' "]

moduleclass = 'chem'
25 changes: 25 additions & 0 deletions easybuild/easyconfigs/g/GSL/GSL-2.8-GCC-13.3.0.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
easyblock = 'ConfigureMake'

name = 'GSL'
version = '2.8'

homepage = 'https://www.gnu.org/software/gsl/'
description = """The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers.
The library provides a wide range of mathematical routines such as random number generators, special functions
and least-squares fitting."""

toolchain = {'name': 'GCC', 'version': '13.3.0'}
toolchainopts = {'unroll': True, 'pic': True}

source_urls = [GNU_SOURCE]
sources = [SOURCELOWER_TAR_GZ]
checksums = ['6a99eeed15632c6354895b1dd542ed5a855c0f15d9ad1326c6fe2b2c9e423190']

sanity_check_paths = {
'files': ['bin/%s' % x for x in ['gsl-config', 'gsl-histogram', 'gsl-randist']] +
['include/gsl/gsl_types.h'] +
['lib/lib%s.%s' % (x, SHLIB_EXT) for x in ['gsl', 'gslcblas']],
'dirs': [],
}

moduleclass = 'numlib'
27 changes: 27 additions & 0 deletions easybuild/easyconfigs/n/ncdu/ncdu-1.20-GCC-13.3.0.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
easyblock = 'ConfigureMake'

name = 'ncdu'
version = '1.20'

homepage = 'https://dev.yorhel.nl/ncdu'
description = """Ncdu is a disk usage analyzer with an ncurses interface. It is designed to find space hogs on a
remote server where you don't have an entire graphical setup available, but it is a useful tool even on regular
desktop systems. Ncdu aims to be fast, simple and easy to use, and should be able to run in any minimal POSIX-like
environment with ncurses installed."""

toolchain = {'name': 'GCC', 'version': '13.3.0'}

source_urls = ['https://dev.yorhel.nl/download/']
sources = [SOURCE_TAR_GZ]
checksums = ['5fe2bb841abe72374bb242dbb93293c4ae053078432d896a7481b2ff10be9572']

dependencies = [
('ncurses', '6.5'),
]

sanity_check_paths = {
'files': ['bin/%(name)s'],
'dirs': [],
}

moduleclass = 'tools'
24 changes: 24 additions & 0 deletions easybuild/easyconfigs/n/networkx/networkx-3.4.2-gfbf-2024a.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
easyblock = 'PythonPackage'

name = 'networkx'
version = '3.4.2'

homepage = 'https://pypi.python.org/pypi/networkx'
description = """NetworkX is a Python package for the creation, manipulation,
and study of the structure, dynamics, and functions of complex networks."""

toolchain = {'name': 'gfbf', 'version': '2024a'}

sources = [SOURCE_TAR_GZ]
checksums = ['307c3669428c5362aab27c8a1260aa8f47c4e91d3891f48be0141738d8d053e1']

dependencies = [
('Python', '3.12.3'),
('SciPy-bundle', '2024.05'), # required for numpy, scipy, ...
]

use_pip = True
download_dep_fail = True
sanity_pip_check = True

moduleclass = 'tools'
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name = 'OpenBLAS'
version = '0.3.27'
versionsuffix = '-seq-iface64'

homepage = 'https://www.openblas.net/'
description = "OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version."

toolchain = {'name': 'GCC', 'version': '13.2.0'}

source_urls = [
# order matters, trying to download the large.tgz/timing.tgz LAPACK tarballs from GitHub causes trouble
'https://www.netlib.org/lapack/timing/',
'https://github.com/xianyi/OpenBLAS/archive/',
]
sources = ['v%(version)s.tar.gz']
patches = [
('large.tgz', '.'),
('timing.tgz', '.'),
'OpenBLAS-0.3.15_workaround-gcc-miscompilation.patch',
'OpenBLAS-0.3.21_fix-order-vectorization.patch',
'OpenBLAS-0.3.26_lapack_qr_noninittest.patch',
'OpenBLAS-0.3.27_fix_zscal.patch',
'OpenBLAS-0.3.27_riscv-drop-static-fortran-flag.patch',
]
checksums = [
{'v0.3.27.tar.gz': 'aa2d68b1564fe2b13bc292672608e9cdeeeb6dc34995512e65c3b10f4599e897'},
{'large.tgz': 'f328d88b7fa97722f271d7d0cfea1c220e0f8e5ed5ff01d8ef1eb51d6f4243a1'},
{'timing.tgz': '999c65f8ea8bd4eac7f1c7f3463d4946917afd20a997807300fe35d70122f3af'},
{'OpenBLAS-0.3.15_workaround-gcc-miscompilation.patch':
'e6b326fb8c4a8a6fd07741d9983c37a72c55c9ff9a4f74a80e1352ce5f975971'},
{'OpenBLAS-0.3.21_fix-order-vectorization.patch':
'08af834e5d60441fd35c128758ed9c092ba6887c829e0471ecd489079539047d'},
{'OpenBLAS-0.3.26_lapack_qr_noninittest.patch': '4781bf1d7b239374fd8069e15b4e2c0ef0e8efaa1a7d4c33557bd5b27e5de77c'},
{'OpenBLAS-0.3.27_fix_zscal.patch': '9210d7b66538dabaddbe1bfceb16f8225708856f60876ca5561b19d3599f9fd1'},
{'OpenBLAS-0.3.27_riscv-drop-static-fortran-flag.patch':
'f374e41efffd592ab1c9034df9e7abf1045ed151f4fc0fd0da618ce9826f2d4b'},
]

builddependencies = [
('make', '4.4.1'),
# required by LAPACK test suite
('Python', '3.11.5'),
]

# INTERFACE64=1 needs if you link OpenBLAS for fortran code compied with 64 bit integers (-i8)
# This would be in intel library naming convention ilp64
# The USE_OPENMP=0 and USE_THREAD=0 needs for the single threaded version
# The USE_LOCKING=1 needs for thread safe version (if threaded software calls OpenBLAS, without it
# OpenBLAS is not thread safe (so only single threaded software would be able to use it)
buildopts = "INTERFACE64=1 USE_OPENMP=0 USE_THREAD=0 USE_LOCKING=1 "
testopts = buildopts
installopts = buildopts

run_lapack_tests = True
max_failing_lapack_tests_num_errors = 150

# extensive testing can be enabled by uncommenting the line below
# runtest = 'PATH=.:$PATH lapack-timing'

moduleclass = 'numlib'
Loading

0 comments on commit 3a44c68

Please sign in to comment.