-
Notifications
You must be signed in to change notification settings - Fork 74
Draft: Licensing #1149
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?
Draft: Licensing #1149
Changes from 32 commits
d71d2df
957a892
5a17a45
ccc76ad
9d93837
8f86fa4
9e0475b
3e22835
f4870dc
8081eae
0191252
b3e9508
045163c
0baa570
ad96592
d98392d
053c97f
9ee00dd
4e7525b
4cbb842
a2d934b
10dc7e3
370b78c
03547d7
3607f27
cb1390f
a34bc01
42b382c
0a127de
3bb8032
31f4284
3462e07
2ce9ef5
4b26b2f
91cb66c
c0fa34b
a0e0a67
f002228
d13b1bd
22c192a
a0bf545
e37a01f
7acceb9
1f5297d
3c4d09a
c2f3fd0
d212754
6a231a2
55d5398
e36fb84
7c3e64d
cb4e9ae
76b5f2d
53ed021
fddde05
66d1320
b5f40e8
5d85d91
a9dbd33
699c1bd
faedde9
b98b983
3660d3f
59e8e54
c16b1b3
9964b7d
8273b81
0057ea3
da9751c
2eb78ea
1db2bfb
e983c0e
766b408
9c216ad
e9cd6ca
7bc7d52
7b50a87
13dc456
810a345
0d30903
07fa3af
6d69fdb
61f406d
73642f7
ac2ae96
0043536
bb1a43b
32f1a00
df9794e
b8dac3f
f1fa7c3
07d64bd
c0a5589
c731115
b431d41
2970fcd
4a79f1f
4cff99c
7769ce7
92a8a74
2e27904
d3d155a
c1e4fec
0dfc768
9a37d98
4b68e57
d68af18
7facbbf
c756a36
f389c2a
9451081
84457d3
854db89
32feb9a
7d51864
1288d33
db1197d
18b005b
1485b95
ba30cce
d9c5549
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,125 @@ | ||
| name: Check and update licenses | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| # types: [opened, synchronized] | ||
| permissions: | ||
| contents: read # we dont need to write | ||
|
|
||
| jobs: | ||
| license_update: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: eessi/github-action-eessi@v3 | ||
|
|
||
| - name: Check for missing installlations | ||
| env: | ||
| PR_NUMBER: ${{ github.event.number }} | ||
| run: | | ||
| export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${{matrix.EESSI_SOFTWARE_SUBDIR_OVERRIDE}} | ||
| source /cvmfs/software.eessi.io/versions/${EESSI_VERSION}/init/bash | ||
|
|
||
| # set $EESSI_CPU_FAMILY to the CPU architecture that corresponds to $EESSI_SOFTWARE_SUBDIR_OVERRIDE (part before the first slash), | ||
| # to prevent issues with checks in the Easybuild configuration that use this variable | ||
| export EESSI_CPU_FAMILY=${EESSI_SOFTWARE_SUBDIR_OVERRIDE%%/*} | ||
| export EESSI_PREFIX=/cvmfs/software.eessi.io/versions/${EESSI_VERSION} | ||
| export EESSI_OS_TYPE=linux | ||
| env | grep ^EESSI | sort | ||
| module load EasyBuild | ||
|
|
||
| # create a temporary directory to store the output | ||
| LOCAL_TMPDIR=$(mktemp -d) | ||
| eb_missing_out=$LOCAL_TMPDIR/eb_missing.out | ||
| echo "eb_missing_out=$LOCAL_TMPDIR/eb_missing.out" >> $GITHUB_ENV | ||
| echo "Temporary directory created: ${eb_missing_out}" | ||
| file_list=$(curl -sS \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files?per_page=100" | | ||
| jq -r '.[].filename | select(test("easystack"))') | ||
|
|
||
| for easystack_file in $file_list; do | ||
| eb_version=$(echo ${easystack_file} | sed 's/.*eb-\([0-9.]*\).*.yml/\1/g') | ||
| echo "check missing installations for ${easystack_file} with EasyBuild ${eb_version}..." | ||
| module purge | ||
| module load EasyBuild/${eb_version} | ||
| module load EESSI-extend/${EESSI_VERSION}-easybuild | ||
| which eb | ||
| ${EB:-eb} --version | ||
| ${EB:-eb} --missing --easystack ${easystack_file} 2>&1 | tee ${eb_missing_out} | ||
hvelab marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| exit_code=${PIPESTATUS[0]} | ||
| echo "exit code for eb --missing --easystack ${easystack_file} is ${exit_code}" | ||
| grep " required modules missing:" ${eb_missing_out} # > /dev/null | ||
| exit_code=$? | ||
|
|
||
| if [[ ${exit_code} -eq 0 ]]; then echo "missing installations found for ${easystack_file}!" >&2; | ||
| else | ||
| echo "no missing installations found for ${easystack_file}." | ||
| exit 0 | ||
| fi | ||
| done | ||
|
|
||
| - name: Check for modules existing in licenses.json file | ||
hvelab marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| run: | | ||
| if [ -s licenses/licenses.json ]; then | ||
| echo "licenses.json file exists, checking for modules that are not in the file..." | ||
| echo "tmp file check: ${eb_missing_out}" | ||
| # cat ${eb_missing_out} | ||
| grep -oP '^\* \K[^ ]+' "${eb_missing_out}" | sort -u > missing_modules.txt | ||
| echo "Modules to check" | ||
| cat missing_modules.txt | ||
|
|
||
| # Check if module exists as key in JSON | ||
|
||
| while read -r module; do | ||
| if ! jq -e --arg key "$module" 'has($key)' "licenses/licenses.json" > /dev/null; then | ||
| missing_modules+=("$module") | ||
| fi | ||
| done < missing_modules.txt | ||
|
|
||
| echo $missing_modules > missing_modules.txt | ||
| echo "Modules not in licenses.json: ${missing_modules[@]}" | ||
|
|
||
| else | ||
| echo "licenses.json file does not exist? what happened?" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name : Search sources for missing modules | ||
| run: | | ||
| if [ -s missing_modules.txt ]; then | ||
| echo "Searching sources for missing modules..." | ||
| # Generates a "modules_results.json" file | ||
| module load Python-bundle-PyPI/2023.06-GCCcore-12.3.0 | ||
| python licenses/parsing_easyconfigs.py missing_modules.txt | ||
| cat modules_results.json | ||
| fi | ||
|
|
||
| - name : Try to fetch the license | ||
| run: | | ||
| if [ -s modules_results.json ]; then | ||
| echo "modules_results.json file exists, trying to fetch the license..." | ||
| module load Python-bundle-PyPI/2023.06-GCCcore-12.3.0 | ||
| module load BeautifulSoup/4.12.2-GCCcore-12.3.0 | ||
| python licenses/parse_licenses.py modules_results.json | ||
| cat licenses_test.json | ||
| else | ||
| echo "modules_results.json file does not exist, skipping license fetch." | ||
| fi | ||
|
|
||
| - name: Check for missing licenses | ||
| run: | | ||
| grep -3 "not found" licenses_test.json | ||
| exit_code=$? | ||
| if [[ ${exit_code} -ne 0 ]]; then | ||
| echo "No missing licenses found." | ||
| else | ||
| echo "Missing licenses found, please check the licenses.json file." | ||
hvelab marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| exit 1 | ||
| fi | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| see https://spdx.org/licenses | ||
|
|
||
| Python function to download SPDX list of licenses is available in `spdx.py` |
Uh oh!
There was an error while loading. Please reload this page.