Skip to content

Commit 7e8e033

Browse files
authored
Merge pull request #1008 from valassi/install
v1.0.0 release: tarball creation/installation, plugin symlink management, release management
2 parents f299290 + 262b845 commit 7e8e033

File tree

634 files changed

+10759
-8493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

634 files changed

+10759
-8493
lines changed

.gitattributes

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
# github linguist by default assumes documention in an "examples" directory
1+
# SR (Aug 2020): github linguist by default assumes documention in an "examples" directory
22
examples/** -linguist-documentation
3-
3+
4+
# AV (Sep 2024): exclude all files from "Source code" release archives produced with git-archive
5+
* export-ignore

.github/workflows/archiver.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
# Copyright (C) 2020-2024 CERN and UCLouvain.
3+
# Licensed under the GNU Lesser General Public License (version 3 or later).
4+
# Created by: O. Mattelaer (Sep 2024) for the MG5aMC CUDACPP plugin.
5+
# Further modified by: A. Valassi (2024) for the MG5aMC CUDACPP plugin.
6+
7+
import subprocess
8+
import sys
9+
10+
def get_all_tags():
11+
out = subprocess.check_output(['git', 'tag']).decode()
12+
return out.split('\n')
13+
14+
def get_supported_versions(tags):
15+
versions = [ t[len(PREFIX):-len(SUFFIX)] for t in tags if t.startswith(PREFIX) and t.endswith(SUFFIX)]
16+
versions = set(versions)
17+
return versions
18+
19+
def create_infodat_file(path, versions):
20+
line = "%(version)s https://github.com/%(repo)s/releases/download/%(prefix)s%(version)s%(suffix)s/cudacpp.tar.gz\n"
21+
with open(path, 'w') as fsock:
22+
for v in versions:
23+
fsock.write(line%{'repo':GITHUB_REPO, 'prefix':PREFIX, 'version':v, 'suffix':SUFFIX})
24+
25+
if "__main__" == __name__:
26+
if len(sys.argv) != 3:
27+
print('Usage: python3 %s <repoowner/reponame> <infodat>'%sys.argv[0])
28+
sys.exit(1)
29+
print('Executing: python3 %s "%s" "%s"'%( sys.argv[0],sys.argv[1],sys.argv[2]))
30+
repo = sys.argv[1]
31+
infodat = sys.argv[2]
32+
repo_owner, repo_name = repo.split('/')
33+
###print('Repo owner:', repo_owner)
34+
###print('Repo name:', repo_name)
35+
GITHUB_REPO = '%s/%s/'%(repo_owner, repo_name)
36+
PREFIX = 'cudacpp_for'
37+
if repo_owner != 'madgraph5' : PREFIX = repo_owner + "_" + PREFIX # TEMPORARY! this will change eventually...
38+
if repo_name != 'madgraph4gpu' : raise Exception('Invalid repo_name "%s" (expect "madgraph4gpu")'%repo_name) # TEMPORARY! this will change eventually...
39+
SUFFIX = '_latest'
40+
tags = get_all_tags()
41+
###print('Tags:', tags)
42+
versions = get_supported_versions(tags)
43+
###print('Supported versions:', versions)
44+
create_infodat_file(infodat, versions)

.github/workflows/archiver.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
# Copyright (C) 2020-2024 CERN and UCLouvain.
3+
# Licensed under the GNU Lesser General Public License (version 3 or later).
4+
# Created by: A. Valassi (Sep 2024) for the MG5aMC CUDACPP plugin.
5+
# Further modified by: A. Valassi (2024) for the MG5aMC CUDACPP plugin.
6+
7+
# Path to the top directory of madgraphgpu
8+
# In the CI this would be simply $(pwd), but allow the script to be run also outside the CI
9+
echo "Executing $0 $*"
10+
topdir=$(cd $(dirname $0)/../..; pwd)
11+
12+
# Check that all git submodules have been updated
13+
cd ${topdir}
14+
if ! git submodule status | grep '^ ' > /dev/null; then
15+
echo "ERROR! There are git submodules that need to be updated"
16+
git submodule status
17+
exit 1
18+
fi
19+
mg5_commit_current=$(git submodule status | awk '/ MG5aMC\/mg5amcnlo /{print substr($1,0,7)}')
20+
21+
# Create a temporary directory and a VERSION.txt file
22+
cd ${topdir}/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT
23+
tmpdir=$(mktemp -d)
24+
outdir=${tmpdir}/CUDACPP_OUTPUT
25+
mkdir ${outdir}
26+
outfile=${outdir}/VERSION.txt
27+
touch ${outfile}
28+
dateformat='%Y-%m-%d_%H:%M:%S UTC'
29+
echo "(From CUDACPP_OUTPUT/__init__.py)" >> ${outfile}
30+
echo "cudacpp_version = $(cat __init__.py | awk '/__version__/{print $3}' | sed 's/(//' | sed 's/)//' | sed 's/,/./g')" >> ${outfile}
31+
echo "mg5_version_minimal = $(cat __init__.py | awk '/minimal_mg5amcnlo_version/{print $3}' | sed 's/(//' | sed 's/)//' | sed 's/,/./g')" >> ${outfile}
32+
echo "mg5_version_latest_validated = $(cat __init__.py | awk '/latest_validated_version/{print $3}' | sed 's/(//' | sed 's/)//' | sed 's/,/./g')" >> ${outfile}
33+
echo "" >> ${outfile}
34+
echo "(From MG5AMC/mg5amcnlo)" >> ${outfile}
35+
echo "mg5_version_current = $(cat ../../../../../MG5aMC/mg5amcnlo/VERSION | awk '/version =/{print $3}' | sed -r 's/[^0-9.]//g')" >> ${outfile}
36+
echo "mg5_commit_current = ${mg5_commit_current}" >> ${outfile}
37+
echo "" >> ${outfile}
38+
echo "TARBALL DATE: $(date -u +"${dateformat}")" >> ${outfile}
39+
echo "" >> ${outfile}
40+
TZ=UTC git --no-pager log -n1 --date=format-local:"${dateformat}" --pretty=format:'commit %h%nAuthor: %an%nAuthorDate: %ad%nCommitter: %cn%nCommitterDate: %cd%nMessage: "%s"%n' >> ${outfile}
41+
python3 -c 'print("="*132)'; cat ${outfile}; python3 -c 'print("="*132)'
42+
cp ${outfile} ${topdir}
43+
echo "VERSION.txt file available on ${topdir}/$(basename ${outfile})"
44+
45+
# Copy all relevant plugin files to the temporary directory
46+
cd ${topdir}/epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT
47+
for file in $(git ls-tree --name-only HEAD -r); do
48+
if [ "${file/acceptance_tests}" != "${file}" ]; then continue; fi # acceptance_tests are not needed for code generation
49+
mkdir -p ${outdir}/$(dirname ${file})
50+
cp -dp ${file} ${outdir}/${file} # preserve symlinks for AUTHORS, COPYING, COPYING.LESSER and COPYRIGHT
51+
done
52+
53+
# Create the tgz archive
54+
outtgz=cudacpp.tar.gz
55+
cd ${tmpdir}
56+
tar -czf ${outtgz} CUDACPP_OUTPUT
57+
mv ${outtgz} ${topdir}
58+
echo "Archive available on ${topdir}/${outtgz}"

0 commit comments

Comments
 (0)