From 23e3c87bc1810b641752218bf784dff7bbf0cf69 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 16:52:44 +0100 Subject: [PATCH 001/105] Add first version of diff report --- tools/generate_report.py | 203 +++++++++++++++++++++++++++++++++++++++ tools/utils.py | 47 +++++++++ 2 files changed, 250 insertions(+) create mode 100644 tools/generate_report.py diff --git a/tools/generate_report.py b/tools/generate_report.py new file mode 100644 index 000000000..fbbcf3b64 --- /dev/null +++ b/tools/generate_report.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python3 + +############################################################################# +## +## This file is part of GAP, a system for computational discrete algebra. +## +## Copyright of GAP belongs to its developers, whose names are too numerous +## to list here. Please refer to the COPYRIGHT file for details. +## +## SPDX-License-Identifier: GPL-2.0-or-later +## + +# Run this script on main branch with data and gh-pages worktree + +""" +This script compares the current test-status.json with a previous version, +generates a main report.md along with + a test-status-diff.json, + a html-redirect, and + a badge. +""" + +from utils import warning, error, symlink, string_to_bool + +import sys +import os +import glob +import json +from datetime import datetime + +################################################################################ +# Arguments and Paths +num_args = len(sys.argv) + +if num_args < 1 or num_args > 4: + error('Unknown number of arguments') + +# relative paths to report directories from ROOT +ROOT = 'data/reports' +DIR_LAST_REPORT_REL = '/latest' +OVERRIDE_LAST = True + +if num_args > 1: DIR_REPORT_REL = sys.argv[1] +if num_args > 2: DIR_LAST_REPORT_REL = sys.argv[2] +if num_args > 3: OVERRIDE_LAST = string_to_bool(sys.argv[3]) + +DIR_REPORT = os.path.realpath(os.path.join(ROOT, DIR_REPORT_REL)) +DIR_LAST_REPORT_SYMBOLIC = os.path.join(ROOT, DIR_LAST_REPORT_REL) +DIR_LAST_REPORT = os.path.realpath(DIR_LAST_REPORT_SYMBOLIC) +os.makedirs(DIR_LAST_REPORT, exist_ok = True) + +REPORT_PATH = os.path.join(DIR_REPORT, 'test-status.json') +LAST_REPORT_PATH = os.path.join(DIR_LAST_REPORT, 'test-status.json') + +if OVERRIDE_LAST: + DIR_BADGE = os.path.join('data/badges', DIR_LAST_REPORT_REL) + os.makedirs(DIR_BADGE, exist_ok = True) + + DIR_REDIRECT = os.path.join('gh-pages', DIR_LAST_REPORT_REL) + os.makedirs(DIR_BADGE, exist_ok = True) + +################################################################################ +# Read current and previous test-status +with open(REPORT_PATH, 'r') as f: + REPORT = json.load(f) + +if os.path.isfile(LAST_REPORT_PATH): + with open(LAST_REPORT_PATH, 'r') as f: + LAST_REPORT = json.load(f) +else: # deal with the first run of this script + LAST_REPORT = {'pkgs': {}} + +REPO = REPORT['repo'] + +################################################################################ +# Generate report.md and test-status-diff.json +REPORT_DIFF = {} +REPORT_DIFF['current'] = REPORT_PATH.split('data/')[1] +REPORT_DIFF['last'] = LAST_REPORT_PATH.split('data/')[1] +REPORT_DIFF['total'] = REPORT['total'] +REPORT_DIFF['failure'] = REPORT['failure'] +REPORT_DIFF['success'] = REPORT['success'] +REPORT_DIFF['skipped'] = REPORT['skipped'] + +with open(DIR_REPORT+'/report.md', 'w') as f: + # Header + f.write('# Package Evaluation Report\n\n') + f.write('## Job Properties\n\n') + f.write('*Commits:* %s vs %s\n\n' % (REPORT['hash'], LAST_REPORT['hash']) ) + f.write('*Current Test Status generated by Workflow:* %s\n\n' % REPORT['workflow']) + f.write('In total, %d packages were tested, out of which %d succeeded, %d failed and %d were skipped.\n\n' % (REPORT['total'], REPORT['success'], REPORT['failure'], REPORT['skipped'])) + + PKGS = REPORT['pkgs'] + LAST_PKGS = LAST_REPORT['pkgs'] + + ############################################################################ + # New Packages + PKGS_NEW = [pkg for pkg in PKGS.keys() if + not pkg in LAST_PKGS.keys()] + + REPORT_DIFF['new'] = len(PKGS_NEW) + if len(PKGS_NEW) > 0: + f.write('## New Packages\n\n') + for pkg in PKGS_NEW: + status = PKGS[pkg]['status'] + f.write('- %s : %s
\n' % (pkg, status)) + + ############################################################################ + # Removed Packages + PKGS_REMOVED = [pkg for pkg in LAST_PKGS.keys() if + not pkg in PKGS.keys()] + + REPORT_DIFF['removed'] = len(PKGS_REMOVED) + if len(PKGS_REMOVED) > 0: + f.write('## Removed Packages\n\n') + for pkg in PKGS_REMOVED: + status = LAST_PKGS[pkg]['status'] + f.write('- %s : %s
\n' % (pkg, status)) + + ############################################################################ + # Changed Status Packages + for STATUS, STATUS_MSG, STATUS_HEADER in [ + ('failure', 'failed', ':exclamation: Packages now failing'), + ('success', 'succeeded', ':heavy_check_mark: Packages now succeeding'), + ('skipped', 'skipped', ':heavy_multiplication_x: Packages that now skipped')]: + PKGS_FILTERED = [pkg for pkg in PKGS.keys() if + pkg in LAST_PKGS.keys() and + PKGS[pkg]['status'] != LAST_PKGS[pkg]['status'] and + PKGS[pkg]['status'] == STATUS] + + REPORT_DIFF[STATUS+'_changed'] = len(PKGS_FILTERED) + if len(PKGS_FILTERED) > 0: + f.write('## %s\n\n' % STATUS_HEADER) + f.write('%d package(s) %s tests only on the current version.' % (len(PKGS_FILTERED), STATUS_MSG)) + f.write('
Click to expand!\n\n') + for pkg in PKGS_FILTERED: + version = PKGS[pkg]['version'] + last_status = LAST_PKGS[pkg]['status'] + last_version = LAST_PKGS[pkg]['version'] + f.write('- %s %s vs %s %s (%s)
\n' % (pkg, version, pkg, last_version, last_status)) + f.write('
\n\n') + + ############################################################################ + # Same Status Packages + for STATUS, STATUS_MSG, STATUS_HEADER in [ + ('failure', 'failed', ':exclamation: Packages still failing'), + ('success', 'succeeded', ':heavy_check_mark: Packages still succeeding'), + ('skipped', 'skipped', ':heavy_minus_sign: Packages that still skipped')]: + PKGS_FILTERED = [pkg for pkg in PKGS.keys() if + pkg in LAST_PKGS.keys() and + PKGS[pkg]['status'] == LAST_PKGS[pkg]['status'] and + PKGS[pkg]['status'] == STATUS] + + REPORT_DIFF[STATUS+'_same'] = len(PKGS_FILTERED) + if len(PKGS_FILTERED) > 0: + f.write('## %s\n\n' % STATUS_HEADER) + f.write('%d package(s) %s tests also on the previous version.' % (len(PKGS_FILTERED), STATUS_MSG)) + f.write('
Click to expand!\n\n') + for pkg in PKGS_FILTERED: + version = PKGS[pkg]['version'] + f.write('- %s %s
\n' % (pkg, version)) + f.write('
\n\n') + +# Write test-status-diff.json +with open(DIR_REPORT+'/test-status-diff.json', 'w') as f: + json.dump(REPORT_DIFF, f, ensure_ascii=False, indent=2) + +################################################################################ +# Update Latest +if OVERRIDE_LAST: + symlink(DIR_REPORT, DIR_LAST_REPORT_SYMBOLIC, overwrite=True) + + ############################################################################ + # Generate html redirect + with open(os.path.join(DIR_REDIRECT, 'redirect.html'), 'w') as f: + f.write(''' + + + Redirecting to latest report + + + ''' % (REPO+'/blob/'+DIR_REPORT+'/report.md', REPO+'/'+DIR_REPORT+'/report.md')) + + ############################################################################ + # Generate badge + relativeFailures = 1 - REPORT['success'] / REPORT['total'] + if relativeFailures > 0.05: + color = 'critical' + elif relativeFailures > 0: + color = 'important' + else: + color = 'success' + + BADGE = { + 'schemaVersion' : 1, + 'label': 'Tests', + 'message': '%d/%d passing' % (REPORT['success'], REPORT['total']), + 'color': color, + 'namedLogo': "github" + } + + with open(os.path.join(DIR_BADGE, 'badge.json'), 'w') as f: + json.dump(BADGE, f, ensure_ascii=False, indent=2) \ No newline at end of file diff --git a/tools/utils.py b/tools/utils.py index c0bd0193e..45e77eef9 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -88,3 +88,50 @@ def archive_name(pkg_name: str) -> str: def archive_url(pkg_name: str) -> str: pkg_json = metadata(pkg_name) return pkg_json["ArchiveURL"] + pkg_json["ArchiveFormats"].split(" ")[0] + +# https://stackoverflow.com/questions/8299386/modifying-a-symlink-in-python/55742015#55742015 +def symlink(target, link_name, overwrite=False): + ''' + Create a symbolic link named link_name pointing to target. + If link_name exists then FileExistsError is raised, unless overwrite=True. + When trying to overwrite a directory, IsADirectoryError is raised. + ''' + + if not overwrite: + os.symlink(target, link_name) + return + + # os.replace() may fail if files are on different filesystems + link_dir = os.path.dirname(link_name) + + # Create link to target with temporary filename + while True: + temp_link_name = tempfile.mktemp(dir=link_dir) + + # os.* functions mimic as closely as possible system functions + # The POSIX symlink() returns EEXIST if link_name already exists + # https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html + try: + os.symlink(target, temp_link_name) + break + except FileExistsError: + pass + + # Replace link_name with temp_link_name + try: + # Pre-empt os.replace on a directory with a nicer message + if not os.path.islink(link_name) and os.path.isdir(link_name): + raise IsADirectoryError(f"Cannot symlink over existing directory: '{link_name}'") + os.replace(temp_link_name, link_name) + except: + if os.path.islink(temp_link_name): + os.remove(temp_link_name) + raise + +def string_to_bool(string): + if string.lower().strip() in ['1', 'true']: + return True + elif string.lower().strip() in ['0', 'false']: + return False + else: + error("Unknown string representation of bool") \ No newline at end of file From fb635eadf0328e2cf91898283e80fd79f45ffdac Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 17:34:18 +0100 Subject: [PATCH 002/105] Add example report action --- .github/workflows/report.yml | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/report.yml diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml new file mode 100644 index 000000000..d89f243d8 --- /dev/null +++ b/.github/workflows/report.yml @@ -0,0 +1,58 @@ +name: "Test generation of comparison reports" + +on: + workflow_dispatch: + +jobs: + test: + name: "Run Tests" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: "Generate Test Results" + uses: ./.github/workflows/test-all.yml + + + report: + name: "Create Report" + runs-on: ubuntu-latest + needs: test + steps: + - uses: actions/checkout@v2 + + - name: "Set up Python 3.7" + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: "Create data and gh-pages worktree" + run: | + git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} + git fetch + git branch --track data origin/data + git worktree add data origin/data + git branch --track gh-pages origin/gh-pages + git worktree add gh-pages origin/gh-pages + + - name: "Generate report" + id: report + run: | + HASH=$(jq -r '.hash' <<< ${{ needs.test.outputs.test-status }}) + DIR="data/reports/manual/${HASH}" + echo ${{ needs.test.outputs.test-status }} > "${DIR}/test-status.json" + python pkg-report.py ${DIR} + + - name: "Push report" + id: push-report + run: | + git config --global user.name 'github-actions' + git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + cd data + git add -A + git commit -m "Automated report" + git push origin HEAD:data + cd ../gh-pages + git add -A + git commit -m "Update redirect" + git push origin HEAD:gh-pages From c07db7bd20491d3940a0cd29b9ae645ece47904b Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 17:38:52 +0100 Subject: [PATCH 003/105] Trigger via push, so I can see the workflow --- .github/workflows/report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index d89f243d8..b64e74a0a 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -2,6 +2,7 @@ name: "Test generation of comparison reports" on: workflow_dispatch: + push: jobs: test: From 1e0c63c5332712dedd88c5d3e89b22135d253c63 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 17:42:44 +0100 Subject: [PATCH 004/105] Commit --- .github/workflows/report.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index b64e74a0a..01e11c098 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -7,12 +7,7 @@ on: jobs: test: name: "Run Tests" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: "Generate Test Results" - uses: ./.github/workflows/test-all.yml + uses: ./.github/workflows/test-all.yml report: From a654f46074205532dc9a985287b3853ffde22772 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 17:47:44 +0100 Subject: [PATCH 005/105] Enable faster tests --- .github/workflows/test-all.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 78caf3c46..816de673a 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -196,9 +196,9 @@ jobs: for PKG in packages/${{ github.event.inputs.pkg-test-glob || inputs.pkg-test-glob }}/meta.json; do PKG=${PKG%"/meta.json"} PKG=${PKG#"packages/"} - # if [[ ${PKG} == anupq ]]; then - # break # FIXME: HACK for faster testing, remove before merge - # fi + if [[ ${PKG} == anupq ]]; then + break # FIXME: HACK for faster testing, remove before merge + fi # skip packages without a TestFile if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then echo "Skipping ${PKG}" From d1baf57b47f2002dddbcbc677c13dceb9ea2307c Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 17:59:35 +0100 Subject: [PATCH 006/105] Make Dir --- .github/workflows/report.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 01e11c098..40033cbf2 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -36,6 +36,7 @@ jobs: run: | HASH=$(jq -r '.hash' <<< ${{ needs.test.outputs.test-status }}) DIR="data/reports/manual/${HASH}" + mkdir -p ${DIR} echo ${{ needs.test.outputs.test-status }} > "${DIR}/test-status.json" python pkg-report.py ${DIR} @@ -50,5 +51,5 @@ jobs: git push origin HEAD:data cd ../gh-pages git add -A - git commit -m "Update redirect" + git commit -m "Automated redirect" git push origin HEAD:gh-pages From 2d4a4f81c26f2876bbc21d9ac9cfb567bcc13fb5 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 18:03:06 +0100 Subject: [PATCH 007/105] Fix report not starting --- .github/workflows/report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 40033cbf2..e6c1cea9f 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -14,6 +14,7 @@ jobs: name: "Create Report" runs-on: ubuntu-latest needs: test + if: ${{ always() }} steps: - uses: actions/checkout@v2 From c2cafc70dcf41af5c7bd6bc5f10e5f91fd0084d8 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 18:13:01 +0100 Subject: [PATCH 008/105] Try to fix reading json --- .github/workflows/report.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index e6c1cea9f..58a35fd34 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -35,7 +35,8 @@ jobs: - name: "Generate report" id: report run: | - HASH=$(jq -r '.hash' <<< ${{ needs.test.outputs.test-status }}) + JSON=${{ needs.test.outputs.test-status }} + HASH=$(jq -r '.hash' <<< ${JSON}) DIR="data/reports/manual/${HASH}" mkdir -p ${DIR} echo ${{ needs.test.outputs.test-status }} > "${DIR}/test-status.json" From 5a8ba84989da6f8ffded8864f3d5fb32f46fed69 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 18:26:36 +0100 Subject: [PATCH 009/105] Try to print test output --- .github/workflows/report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 58a35fd34..a3403e323 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -35,6 +35,7 @@ jobs: - name: "Generate report" id: report run: | + echo ${{ needs.test.outputs.test-status }} JSON=${{ needs.test.outputs.test-status }} HASH=$(jq -r '.hash' <<< ${JSON}) DIR="data/reports/manual/${HASH}" From 442aa64cc30b9215ddabe846d0dd92100c001b75 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 18:41:32 +0100 Subject: [PATCH 010/105] Experiment with workflow outputs --- .github/workflows/report-caller.yml | 24 ++++++++++++++++++++++++ .github/workflows/report.yml | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/report-caller.yml diff --git a/.github/workflows/report-caller.yml b/.github/workflows/report-caller.yml new file mode 100644 index 000000000..d8b386b30 --- /dev/null +++ b/.github/workflows/report-caller.yml @@ -0,0 +1,24 @@ +name: "Test all packages" + +on: + workflow_dispatch: + workflow_call: + outputs: + test-status: + description: "The test-status report" + value: ${{ jobs.report.outputs.test-status }} + +jobs: + report: + name: "Report" + runs-on: ubuntu-latest + outputs: + test-status: ${{ steps.test-status.outputs.test-status }} + steps: + - uses: actions/checkout@v2 + + - name: "Output test-status" + id: test-status + run: | + TEST_STATUS="{\"status\": \"failure\", }" + echo "::set-output name=test-status::$TEST_STATUS" diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index a3403e323..6b51b2822 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -7,7 +7,7 @@ on: jobs: test: name: "Run Tests" - uses: ./.github/workflows/test-all.yml + uses: ./.github/workflows/report-caller.yml report: From 2839177b735eb5f863f577ce66d387e77a2c2b22 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 18:47:14 +0100 Subject: [PATCH 011/105] Use jq for correct escaping in json string --- .github/workflows/report-caller.yml | 24 ------------------------ .github/workflows/report.yml | 3 +-- .github/workflows/test-all.yml | 2 +- 3 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/report-caller.yml diff --git a/.github/workflows/report-caller.yml b/.github/workflows/report-caller.yml deleted file mode 100644 index d8b386b30..000000000 --- a/.github/workflows/report-caller.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: "Test all packages" - -on: - workflow_dispatch: - workflow_call: - outputs: - test-status: - description: "The test-status report" - value: ${{ jobs.report.outputs.test-status }} - -jobs: - report: - name: "Report" - runs-on: ubuntu-latest - outputs: - test-status: ${{ steps.test-status.outputs.test-status }} - steps: - - uses: actions/checkout@v2 - - - name: "Output test-status" - id: test-status - run: | - TEST_STATUS="{\"status\": \"failure\", }" - echo "::set-output name=test-status::$TEST_STATUS" diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 6b51b2822..58a35fd34 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -7,7 +7,7 @@ on: jobs: test: name: "Run Tests" - uses: ./.github/workflows/report-caller.yml + uses: ./.github/workflows/test-all.yml report: @@ -35,7 +35,6 @@ jobs: - name: "Generate report" id: report run: | - echo ${{ needs.test.outputs.test-status }} JSON=${{ needs.test.outputs.test-status }} HASH=$(jq -r '.hash' <<< ${JSON}) DIR="data/reports/manual/${HASH}" diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 816de673a..b43fd5a78 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -355,5 +355,5 @@ jobs: - name: "Output test-status" id: test-status run: | - TEST_STATUS=$(cat test-status.json) + TEST_STATUS=$(cat test-status.json | jq -aRs) echo "::set-output name=test-status::$TEST_STATUS" From e34845762f1df7e2bc9592eaaf687e8039ecafaa Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 18:59:32 +0100 Subject: [PATCH 012/105] Try to fix json reading again --- .github/workflows/report.yml | 4 ++-- .github/workflows/test-all.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 58a35fd34..f351190db 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -35,11 +35,11 @@ jobs: - name: "Generate report" id: report run: | - JSON=${{ needs.test.outputs.test-status }} + JSON=$(echo ${{ needs.test.outputs.test-status }}) HASH=$(jq -r '.hash' <<< ${JSON}) DIR="data/reports/manual/${HASH}" mkdir -p ${DIR} - echo ${{ needs.test.outputs.test-status }} > "${DIR}/test-status.json" + echo ${JSON} > "${DIR}/test-status.json" python pkg-report.py ${DIR} - name: "Push report" diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index b43fd5a78..816de673a 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -355,5 +355,5 @@ jobs: - name: "Output test-status" id: test-status run: | - TEST_STATUS=$(cat test-status.json | jq -aRs) + TEST_STATUS=$(cat test-status.json) echo "::set-output name=test-status::$TEST_STATUS" From e0fbd5cfef59cdf5b047fb34fdb1f23cd32eef90 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 21:16:59 +0100 Subject: [PATCH 013/105] Add minimal working example for testing purpose --- .github/workflows/report-caller.yml | 24 +++++++++++++++++++ .github/workflows/report.yml | 16 +++++++++---- test-status.json | 37 +++++++++++++++++++++++++++++ tools/generate_report.py | 8 +++---- tools/utils.py | 1 + 5 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/report-caller.yml create mode 100644 test-status.json diff --git a/.github/workflows/report-caller.yml b/.github/workflows/report-caller.yml new file mode 100644 index 000000000..daf65e452 --- /dev/null +++ b/.github/workflows/report-caller.yml @@ -0,0 +1,24 @@ +name: "Test all packages" + +on: + workflow_dispatch: + workflow_call: + outputs: + test-status: + description: "The test-status report" + value: ${{ jobs.report.outputs.test-status }} + +jobs: + report: + name: "Report" + runs-on: ubuntu-latest + outputs: + test-status: ${{ steps.test-status.outputs.test-status }} + steps: + - uses: actions/checkout@v2 + + - name: "Output test-status" + id: test-status + run: | + TEST_STATUS=$(cat test-status.json | jq -aRs) + echo "::set-output name=test-status::$TEST_STATUS" diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index f351190db..b9ca4295a 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -7,13 +7,15 @@ on: jobs: test: name: "Run Tests" - uses: ./.github/workflows/test-all.yml + uses: ./.github/workflows/report-caller.yml report: name: "Create Report" runs-on: ubuntu-latest needs: test + env: + test-status: ${{ fromJson(needs.test.outputs.test-status) }} if: ${{ always() }} steps: - uses: actions/checkout@v2 @@ -23,6 +25,10 @@ jobs: with: python-version: 3.7 + - name: "Install package distribution tools" + run: | + python -m pip install -r tools/requirements.txt + - name: "Create data and gh-pages worktree" run: | git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} @@ -35,12 +41,14 @@ jobs: - name: "Generate report" id: report run: | - JSON=$(echo ${{ needs.test.outputs.test-status }}) + JSON='${{ env.test-status }}' HASH=$(jq -r '.hash' <<< ${JSON}) - DIR="data/reports/manual/${HASH}" + echo ${HASH} + DIR_REL="manual/${HASH}" + DIR="data/reports/${DIR_REL}" mkdir -p ${DIR} echo ${JSON} > "${DIR}/test-status.json" - python pkg-report.py ${DIR} + python tools/generate_report.py ${DIR_REL} - name: "Push report" id: push-report diff --git a/test-status.json b/test-status.json new file mode 100644 index 000000000..a6282ffb6 --- /dev/null +++ b/test-status.json @@ -0,0 +1,37 @@ +{ + "repo": "https://github.com/FriedrichRober/PackageDistro", + "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", + "hash": "2ab91d36fdb5394e4d3491hadg74bd415c55e06", + "hash_short": "2ab91d3", + "date": "2022-03-17 18:31:03.988758", + "pkgs": { + "ace": { + "status_default": "success", + "status_only_needed": "success", + "version": "5.5", + "archive_url": "https://github.com/gap-packages/ace/releases/download/v5.4/ace-5.4", + "archive_sha256": "7dc9ca0d1807511e9e931b471809db2fe9bc7956153f62dd60f1798c6a615a87", + "status": "success" + }, + "aclib": { + "status_default": "failure", + "status_only_needed": "success", + "version": "1.3.4", + "archive_url": "https://github.com/gap-packages/aclib/releases/download/v1.3.2/aclib-1.3.2", + "archive_sha256": "f672d0aee19f22b411352835a4730a6f88eecad7d79d8452b273f381b03e1a7b", + "status": "failure" + }, + "agt": { + "status_default": "success", + "status_only_needed": "failure", + "version": "0.2", + "archive_url": "https://github.com/gap-packages/AGT/releases/download/v0.2/AGT-0.2", + "archive_sha256": "d7d5564328eceadb2420524fdb7d4c8f1261e95490950858f31dcca89b8675ae", + "status": "failure" + } + }, + "total": 3, + "success": 1, + "failure": 2, + "skipped": 0 +} \ No newline at end of file diff --git a/tools/generate_report.py b/tools/generate_report.py index fbbcf3b64..65e24be65 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -37,7 +37,8 @@ # relative paths to report directories from ROOT ROOT = 'data/reports' -DIR_LAST_REPORT_REL = '/latest' +os.makedirs(ROOT, exist_ok = True) +DIR_LAST_REPORT_REL = 'latest' OVERRIDE_LAST = True if num_args > 1: DIR_REPORT_REL = sys.argv[1] @@ -47,7 +48,6 @@ DIR_REPORT = os.path.realpath(os.path.join(ROOT, DIR_REPORT_REL)) DIR_LAST_REPORT_SYMBOLIC = os.path.join(ROOT, DIR_LAST_REPORT_REL) DIR_LAST_REPORT = os.path.realpath(DIR_LAST_REPORT_SYMBOLIC) -os.makedirs(DIR_LAST_REPORT, exist_ok = True) REPORT_PATH = os.path.join(DIR_REPORT, 'test-status.json') LAST_REPORT_PATH = os.path.join(DIR_LAST_REPORT, 'test-status.json') @@ -57,7 +57,7 @@ os.makedirs(DIR_BADGE, exist_ok = True) DIR_REDIRECT = os.path.join('gh-pages', DIR_LAST_REPORT_REL) - os.makedirs(DIR_BADGE, exist_ok = True) + os.makedirs(DIR_REDIRECT, exist_ok = True) ################################################################################ # Read current and previous test-status @@ -68,7 +68,7 @@ with open(LAST_REPORT_PATH, 'r') as f: LAST_REPORT = json.load(f) else: # deal with the first run of this script - LAST_REPORT = {'pkgs': {}} + LAST_REPORT = {'pkgs': {}, 'hash': 'Unknown'} REPO = REPORT['repo'] diff --git a/tools/utils.py b/tools/utils.py index 45e77eef9..432dbcdea 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -11,6 +11,7 @@ import json import os import sys +import tempfile from accepts import accepts from os.path import join From 94a341b3875f7d9a8a4d9e487ded989691bdee68 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 21:20:33 +0100 Subject: [PATCH 014/105] First test-status --- test-status.json | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/test-status.json b/test-status.json index a6282ffb6..41c56eeb3 100644 --- a/test-status.json +++ b/test-status.json @@ -1,37 +1 @@ -{ - "repo": "https://github.com/FriedrichRober/PackageDistro", - "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", - "hash": "2ab91d36fdb5394e4d3491hadg74bd415c55e06", - "hash_short": "2ab91d3", - "date": "2022-03-17 18:31:03.988758", - "pkgs": { - "ace": { - "status_default": "success", - "status_only_needed": "success", - "version": "5.5", - "archive_url": "https://github.com/gap-packages/ace/releases/download/v5.4/ace-5.4", - "archive_sha256": "7dc9ca0d1807511e9e931b471809db2fe9bc7956153f62dd60f1798c6a615a87", - "status": "success" - }, - "aclib": { - "status_default": "failure", - "status_only_needed": "success", - "version": "1.3.4", - "archive_url": "https://github.com/gap-packages/aclib/releases/download/v1.3.2/aclib-1.3.2", - "archive_sha256": "f672d0aee19f22b411352835a4730a6f88eecad7d79d8452b273f381b03e1a7b", - "status": "failure" - }, - "agt": { - "status_default": "success", - "status_only_needed": "failure", - "version": "0.2", - "archive_url": "https://github.com/gap-packages/AGT/releases/download/v0.2/AGT-0.2", - "archive_sha256": "d7d5564328eceadb2420524fdb7d4c8f1261e95490950858f31dcca89b8675ae", - "status": "failure" - } - }, - "total": 3, - "success": 1, - "failure": 2, - "skipped": 0 -} \ No newline at end of file +{ "repo": "https://github.com/FriedrichRober/PackageDistro", "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", "hash": "2a691d5db5394e4d3491858bd6755bd415c55e06", "hash_short": "2a691d5", "date": "2022-03-17 17:31:03.988758", "pkgs": { "ace": { "status_default": "failure", "status_only_needed": "success", "version": "5.4", "archive_url": "https://github.com/gap-packages/ace/releases/download/v5.4/ace-5.4", "archive_sha256": "7dc9ca0d1807511e9e931b471809db2fe9bc7956153f62dd60f1798c6a615a87", "status": "failure" }, "aclib": { "status_default": "success", "status_only_needed": "success", "version": "1.3.2", "archive_url": "https://github.com/gap-packages/aclib/releases/download/v1.3.2/aclib-1.3.2", "archive_sha256": "f672d0aee19f22b411352835a4730a6f88eecad7d79d8452b273f381b03e1a7b", "status": "success" }, "agt": { "status_default": "success", "status_only_needed": "failure", "version": "0.2", "archive_url": "https://github.com/gap-packages/AGT/releases/download/v0.2/AGT-0.2", "archive_sha256": "d7d5564328eceadb2420524fdb7d4c8f1261e95490950858f31dcca89b8675ae", "status": "failure" } }, "total": 3, "success": 1, "failure": 2, "skipped": 0 } From 42b1637ab6e93865665814802ede6ce01304b174 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 21:21:31 +0100 Subject: [PATCH 015/105] Second test-status --- test-status.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-status.json b/test-status.json index 41c56eeb3..b0d322691 100644 --- a/test-status.json +++ b/test-status.json @@ -1 +1 @@ -{ "repo": "https://github.com/FriedrichRober/PackageDistro", "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", "hash": "2a691d5db5394e4d3491858bd6755bd415c55e06", "hash_short": "2a691d5", "date": "2022-03-17 17:31:03.988758", "pkgs": { "ace": { "status_default": "failure", "status_only_needed": "success", "version": "5.4", "archive_url": "https://github.com/gap-packages/ace/releases/download/v5.4/ace-5.4", "archive_sha256": "7dc9ca0d1807511e9e931b471809db2fe9bc7956153f62dd60f1798c6a615a87", "status": "failure" }, "aclib": { "status_default": "success", "status_only_needed": "success", "version": "1.3.2", "archive_url": "https://github.com/gap-packages/aclib/releases/download/v1.3.2/aclib-1.3.2", "archive_sha256": "f672d0aee19f22b411352835a4730a6f88eecad7d79d8452b273f381b03e1a7b", "status": "success" }, "agt": { "status_default": "success", "status_only_needed": "failure", "version": "0.2", "archive_url": "https://github.com/gap-packages/AGT/releases/download/v0.2/AGT-0.2", "archive_sha256": "d7d5564328eceadb2420524fdb7d4c8f1261e95490950858f31dcca89b8675ae", "status": "failure" } }, "total": 3, "success": 1, "failure": 2, "skipped": 0 } +{ "repo": "https://github.com/FriedrichRober/PackageDistro", "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", "hash": "2ab91d36fdb5394e4d3491hadg74bd415c55e06", "hash_short": "2ab91d3", "date": "2022-03-17 18:31:03.988758", "pkgs": { "ace": { "status_default": "success", "status_only_needed": "success", "version": "5.5", "archive_url": "https://github.com/gap-packages/ace/releases/download/v5.4/ace-5.4", "archive_sha256": "7dc9ca0d1807511e9e931b471809db2fe9bc7956153f62dd60f1798c6a615a87", "status": "success" }, "aclib": { "status_default": "failure", "status_only_needed": "success", "version": "1.3.4", "archive_url": "https://github.com/gap-packages/aclib/releases/download/v1.3.2/aclib-1.3.2", "archive_sha256": "f672d0aee19f22b411352835a4730a6f88eecad7d79d8452b273f381b03e1a7b", "status": "failure" }, "agt": { "status_default": "success", "status_only_needed": "failure", "version": "0.2", "archive_url": "https://github.com/gap-packages/AGT/releases/download/v0.2/AGT-0.2", "archive_sha256": "d7d5564328eceadb2420524fdb7d4c8f1261e95490950858f31dcca89b8675ae", "status": "failure" } }, "total": 3, "success": 1, "failure": 2, "skipped": 0 } From edcf4ccf3edf049cc2b7f8913be27b3d402aa110 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 21:30:00 +0100 Subject: [PATCH 016/105] Adjust name of folders --- .github/workflows/report.yml | 7 ++++--- tools/generate_report.py | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index b9ca4295a..6540bfb1d 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -42,9 +42,10 @@ jobs: id: report run: | JSON='${{ env.test-status }}' - HASH=$(jq -r '.hash' <<< ${JSON}) - echo ${HASH} - DIR_REL="manual/${HASH}" + HASH=$(jq -r '.hash_short' <<< ${JSON}) + DATE=$(jq -r '.date' <<< ${JSON}) + DATE=$(echo $DATE | sed 's/ /-/g' | cut -d '.' -f1) + DIR_REL="manual/${HASH}-${DATE}" DIR="data/reports/${DIR_REL}" mkdir -p ${DIR} echo ${JSON} > "${DIR}/test-status.json" diff --git a/tools/generate_report.py b/tools/generate_report.py index 65e24be65..9a5388b52 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -24,9 +24,7 @@ import sys import os -import glob import json -from datetime import datetime ################################################################################ # Arguments and Paths From 210bd45cc5beccfab2524bfbc8acdbe229e1d002 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 21:37:56 +0100 Subject: [PATCH 017/105] Pretty print test-status.json with jq --- .github/workflows/report.yml | 2 +- test-status.json | 38 +++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 6540bfb1d..5375956e7 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -48,7 +48,7 @@ jobs: DIR_REL="manual/${HASH}-${DATE}" DIR="data/reports/${DIR_REL}" mkdir -p ${DIR} - echo ${JSON} > "${DIR}/test-status.json" + jq <<< ${JSON} > "${DIR}/test-status.json" python tools/generate_report.py ${DIR_REL} - name: "Push report" diff --git a/test-status.json b/test-status.json index b0d322691..f103f0dbd 100644 --- a/test-status.json +++ b/test-status.json @@ -1 +1,37 @@ -{ "repo": "https://github.com/FriedrichRober/PackageDistro", "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", "hash": "2ab91d36fdb5394e4d3491hadg74bd415c55e06", "hash_short": "2ab91d3", "date": "2022-03-17 18:31:03.988758", "pkgs": { "ace": { "status_default": "success", "status_only_needed": "success", "version": "5.5", "archive_url": "https://github.com/gap-packages/ace/releases/download/v5.4/ace-5.4", "archive_sha256": "7dc9ca0d1807511e9e931b471809db2fe9bc7956153f62dd60f1798c6a615a87", "status": "success" }, "aclib": { "status_default": "failure", "status_only_needed": "success", "version": "1.3.4", "archive_url": "https://github.com/gap-packages/aclib/releases/download/v1.3.2/aclib-1.3.2", "archive_sha256": "f672d0aee19f22b411352835a4730a6f88eecad7d79d8452b273f381b03e1a7b", "status": "failure" }, "agt": { "status_default": "success", "status_only_needed": "failure", "version": "0.2", "archive_url": "https://github.com/gap-packages/AGT/releases/download/v0.2/AGT-0.2", "archive_sha256": "d7d5564328eceadb2420524fdb7d4c8f1261e95490950858f31dcca89b8675ae", "status": "failure" } }, "total": 3, "success": 1, "failure": 2, "skipped": 0 } +{ + "repo": "https://github.com/FriedrichRober/PackageDistro", + "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", + "hash": "2ab91d36fdb5394e4d3491hadg74bd415c55e06", + "hash_short": "2ab91d3", + "date": "2022-03-17 18:31:03.988758", + "pkgs": { + "ace": { + "status_default": "success", + "status_only_needed": "success", + "version": "5.5", + "archive_url": "https://github.com/gap-packages/ace/releases/download/v5.4/ace-5.4", + "archive_sha256": "7dc9ca0d1807511e9e931b471809db2fe9bc7956153f62dd60f1798c6a615a87", + "status": "success" + }, + "aclib": { + "status_default": "failure", + "status_only_needed": "success", + "version": "1.3.4", + "archive_url": "https://github.com/gap-packages/aclib/releases/download/v1.3.2/aclib-1.3.2", + "archive_sha256": "f672d0aee19f22b411352835a4730a6f88eecad7d79d8452b273f381b03e1a7b", + "status": "failure" + }, + "agt": { + "status_default": "success", + "status_only_needed": "failure", + "version": "0.2", + "archive_url": "https://github.com/gap-packages/AGT/releases/download/v0.2/AGT-0.2", + "archive_sha256": "d7d5564328eceadb2420524fdb7d4c8f1261e95490950858f31dcca89b8675ae", + "status": "failure" + } + }, + "total": 3, + "success": 1, + "failure": 2, + "skipped": 0 +} From 22292bb5203266403a6b9baac9428afa984b35ca Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 21:53:26 +0100 Subject: [PATCH 018/105] Change folder naming slightly --- .github/workflows/report.yml | 2 +- tools/generate_report.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 5375956e7..8ee85071a 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -45,7 +45,7 @@ jobs: HASH=$(jq -r '.hash_short' <<< ${JSON}) DATE=$(jq -r '.date' <<< ${JSON}) DATE=$(echo $DATE | sed 's/ /-/g' | cut -d '.' -f1) - DIR_REL="manual/${HASH}-${DATE}" + DIR_REL="manual/${DATE}-${HASH}" DIR="data/reports/${DIR_REL}" mkdir -p ${DIR} jq <<< ${JSON} > "${DIR}/test-status.json" diff --git a/tools/generate_report.py b/tools/generate_report.py index 9a5388b52..c4a51d5df 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -73,8 +73,8 @@ ################################################################################ # Generate report.md and test-status-diff.json REPORT_DIFF = {} -REPORT_DIFF['current'] = REPORT_PATH.split('data/')[1] -REPORT_DIFF['last'] = LAST_REPORT_PATH.split('data/')[1] +REPORT_DIFF['current'] = REPORT_PATH +REPORT_DIFF['last'] = LAST_REPORT_PATH REPORT_DIFF['total'] = REPORT['total'] REPORT_DIFF['failure'] = REPORT['failure'] REPORT_DIFF['success'] = REPORT['success'] @@ -84,8 +84,13 @@ # Header f.write('# Package Evaluation Report\n\n') f.write('## Job Properties\n\n') - f.write('*Commits:* %s vs %s\n\n' % (REPORT['hash'], LAST_REPORT['hash']) ) - f.write('*Current Test Status generated by Workflow:* %s\n\n' % REPORT['workflow']) + f.write('*Testing:* [%s](%s) vs [%s](%s)\n\n' % ( + REPORT_DIFF['current'].split('reports/')[1].split('/test-status.json')[0], + os.path.join(REPO, 'blob', REPORT_DIFF['current']), + REPORT_DIFF['last'].split('reports/')[1].split('/test-status.json')[0], + os.path.join(REPO, 'blob', REPORT_DIFF['last']) + )) + f.write('*Generated by Workflow:* %s\n\n' % REPORT['workflow']) f.write('In total, %d packages were tested, out of which %d succeeded, %d failed and %d were skipped.\n\n' % (REPORT['total'], REPORT['success'], REPORT['failure'], REPORT['skipped'])) PKGS = REPORT['pkgs'] From 56e46a33c9942b82a4f339e3adec9808db7e8b73 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 17 Mar 2022 21:56:16 +0100 Subject: [PATCH 019/105] Fix Report paths --- tools/generate_report.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index c4a51d5df..99fbd4ab0 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -73,8 +73,8 @@ ################################################################################ # Generate report.md and test-status-diff.json REPORT_DIFF = {} -REPORT_DIFF['current'] = REPORT_PATH -REPORT_DIFF['last'] = LAST_REPORT_PATH +REPORT_DIFF['current'] = REPORT_PATH.split('data/')[1] +REPORT_DIFF['last'] = LAST_REPORT_PATH.split('data/')[1] REPORT_DIFF['total'] = REPORT['total'] REPORT_DIFF['failure'] = REPORT['failure'] REPORT_DIFF['success'] = REPORT['success'] @@ -86,9 +86,9 @@ f.write('## Job Properties\n\n') f.write('*Testing:* [%s](%s) vs [%s](%s)\n\n' % ( REPORT_DIFF['current'].split('reports/')[1].split('/test-status.json')[0], - os.path.join(REPO, 'blob', REPORT_DIFF['current']), + os.path.join(REPO, 'blob/data', REPORT_DIFF['current']), REPORT_DIFF['last'].split('reports/')[1].split('/test-status.json')[0], - os.path.join(REPO, 'blob', REPORT_DIFF['last']) + os.path.join(REPO, 'blob/data', REPORT_DIFF['last']) )) f.write('*Generated by Workflow:* %s\n\n' % REPORT['workflow']) f.write('In total, %d packages were tested, out of which %d succeeded, %d failed and %d were skipped.\n\n' % (REPORT['total'], REPORT['success'], REPORT['failure'], REPORT['skipped'])) From f990ffd876974fcea367f4077e58b91d263df7eb Mon Sep 17 00:00:00 2001 From: Friedrich Rober <37139927+FriedrichRober@users.noreply.github.com> Date: Fri, 18 Mar 2022 09:03:53 +0100 Subject: [PATCH 020/105] Fix num_args Co-authored-by: Max Horn --- tools/generate_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index 99fbd4ab0..68ebf9d87 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -30,7 +30,7 @@ # Arguments and Paths num_args = len(sys.argv) -if num_args < 1 or num_args > 4: +if num_args <= 1 or num_args > 4: error('Unknown number of arguments') # relative paths to report directories from ROOT From bddd6a54a6cd42e3c48afc7410488e2b880941f0 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:05:28 +0100 Subject: [PATCH 021/105] Update report-caller.yml --- .github/workflows/report-caller.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/report-caller.yml b/.github/workflows/report-caller.yml index daf65e452..f33a0a421 100644 --- a/.github/workflows/report-caller.yml +++ b/.github/workflows/report-caller.yml @@ -1,7 +1,6 @@ -name: "Test all packages" +name: "Test report.yml" on: - workflow_dispatch: workflow_call: outputs: test-status: @@ -20,5 +19,5 @@ jobs: - name: "Output test-status" id: test-status run: | - TEST_STATUS=$(cat test-status.json | jq -aRs) + TEST_STATUS=$(cat test-status.json | jq -aR) echo "::set-output name=test-status::$TEST_STATUS" From cfdbe741065439dc3dc67c2c8e6f30def63e2c00 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:11:41 +0100 Subject: [PATCH 022/105] Lowercase in generate_report.py --- tools/generate_report.py | 182 +++++++++++++++++++-------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index 68ebf9d87..5ae779065 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -33,160 +33,160 @@ if num_args <= 1 or num_args > 4: error('Unknown number of arguments') -# relative paths to report directories from ROOT -ROOT = 'data/reports' -os.makedirs(ROOT, exist_ok = True) -DIR_LAST_REPORT_REL = 'latest' -OVERRIDE_LAST = True +# relative paths to report directories from root +root = 'data/reports' +os.makedirs(root, exist_ok = True) +dir_last_report_rel = 'latest' +override_last = True -if num_args > 1: DIR_REPORT_REL = sys.argv[1] -if num_args > 2: DIR_LAST_REPORT_REL = sys.argv[2] -if num_args > 3: OVERRIDE_LAST = string_to_bool(sys.argv[3]) +if num_args > 1: dir_report_rel = sys.argv[1] +if num_args > 2: dir_last_report_rel = sys.argv[2] +if num_args > 3: override_last = string_to_bool(sys.argv[3]) -DIR_REPORT = os.path.realpath(os.path.join(ROOT, DIR_REPORT_REL)) -DIR_LAST_REPORT_SYMBOLIC = os.path.join(ROOT, DIR_LAST_REPORT_REL) -DIR_LAST_REPORT = os.path.realpath(DIR_LAST_REPORT_SYMBOLIC) +dir_report = os.path.realpath(os.path.join(root, dir_report_rel)) +dir_last_report_symbolic = os.path.join(root, dir_last_report_rel) +dir_last_report = os.path.realpath(dir_last_report_symbolic) -REPORT_PATH = os.path.join(DIR_REPORT, 'test-status.json') -LAST_REPORT_PATH = os.path.join(DIR_LAST_REPORT, 'test-status.json') +report_path = os.path.join(dir_report, 'test-status.json') +last_report_path = os.path.join(dir_last_report, 'test-status.json') -if OVERRIDE_LAST: - DIR_BADGE = os.path.join('data/badges', DIR_LAST_REPORT_REL) - os.makedirs(DIR_BADGE, exist_ok = True) +if override_last: + dir_badge = os.path.join('data/badges', dir_last_report_rel) + os.makedirs(dir_badge, exist_ok = True) - DIR_REDIRECT = os.path.join('gh-pages', DIR_LAST_REPORT_REL) - os.makedirs(DIR_REDIRECT, exist_ok = True) + dir_redirect = os.path.join('gh-pages', dir_last_report_rel) + os.makedirs(dir_redirect, exist_ok = True) ################################################################################ # Read current and previous test-status -with open(REPORT_PATH, 'r') as f: - REPORT = json.load(f) +with open(report_path, 'r') as f: + report = json.load(f) -if os.path.isfile(LAST_REPORT_PATH): - with open(LAST_REPORT_PATH, 'r') as f: - LAST_REPORT = json.load(f) +if os.path.isfile(last_report_path): + with open(last_report_path, 'r') as f: + last_report = json.load(f) else: # deal with the first run of this script - LAST_REPORT = {'pkgs': {}, 'hash': 'Unknown'} + last_report = {'pkgs': {}, 'hash': 'Unknown'} -REPO = REPORT['repo'] +repo = report['repo'] ################################################################################ # Generate report.md and test-status-diff.json -REPORT_DIFF = {} -REPORT_DIFF['current'] = REPORT_PATH.split('data/')[1] -REPORT_DIFF['last'] = LAST_REPORT_PATH.split('data/')[1] -REPORT_DIFF['total'] = REPORT['total'] -REPORT_DIFF['failure'] = REPORT['failure'] -REPORT_DIFF['success'] = REPORT['success'] -REPORT_DIFF['skipped'] = REPORT['skipped'] - -with open(DIR_REPORT+'/report.md', 'w') as f: +report_diff = {} +report_diff['current'] = report_path.split('data/')[1] +report_diff['last'] = last_report_path.split('data/')[1] +report_diff['total'] = report['total'] +report_diff['failure'] = report['failure'] +report_diff['success'] = report['success'] +report_diff['skipped'] = report['skipped'] + +with open(dir_report+'/report.md', 'w') as f: # Header f.write('# Package Evaluation Report\n\n') f.write('## Job Properties\n\n') f.write('*Testing:* [%s](%s) vs [%s](%s)\n\n' % ( - REPORT_DIFF['current'].split('reports/')[1].split('/test-status.json')[0], - os.path.join(REPO, 'blob/data', REPORT_DIFF['current']), - REPORT_DIFF['last'].split('reports/')[1].split('/test-status.json')[0], - os.path.join(REPO, 'blob/data', REPORT_DIFF['last']) + report_diff['current'].split('reports/')[1].split('/test-status.json')[0], + os.path.join(repo, 'blob/data', report_diff['current']), + report_diff['last'].split('reports/')[1].split('/test-status.json')[0], + os.path.join(repo, 'blob/data', report_diff['last']) )) - f.write('*Generated by Workflow:* %s\n\n' % REPORT['workflow']) - f.write('In total, %d packages were tested, out of which %d succeeded, %d failed and %d were skipped.\n\n' % (REPORT['total'], REPORT['success'], REPORT['failure'], REPORT['skipped'])) + f.write('*Generated by Workflow:* %s\n\n' % report['workflow']) + f.write('In total, %d packages were tested, out of which %d succeeded, %d failed and %d were skipped.\n\n' % (report['total'], report['success'], report['failure'], report['skipped'])) - PKGS = REPORT['pkgs'] - LAST_PKGS = LAST_REPORT['pkgs'] + pkgs = report['pkgs'] + last_pkgs = last_report['pkgs'] ############################################################################ # New Packages - PKGS_NEW = [pkg for pkg in PKGS.keys() if - not pkg in LAST_PKGS.keys()] + pkgs_new = [pkg for pkg in pkgs.keys() if + not pkg in last_pkgs.keys()] - REPORT_DIFF['new'] = len(PKGS_NEW) - if len(PKGS_NEW) > 0: + report_diff['new'] = len(pkgs_new) + if len(pkgs_new) > 0: f.write('## New Packages\n\n') - for pkg in PKGS_NEW: - status = PKGS[pkg]['status'] + for pkg in pkgs_new: + status = pkgs[pkg]['status'] f.write('- %s : %s
\n' % (pkg, status)) ############################################################################ # Removed Packages - PKGS_REMOVED = [pkg for pkg in LAST_PKGS.keys() if - not pkg in PKGS.keys()] + pkgs_removed = [pkg for pkg in last_pkgs.keys() if + not pkg in pkgs.keys()] - REPORT_DIFF['removed'] = len(PKGS_REMOVED) - if len(PKGS_REMOVED) > 0: + report_diff['removed'] = len(pkgs_removed) + if len(pkgs_removed) > 0: f.write('## Removed Packages\n\n') - for pkg in PKGS_REMOVED: - status = LAST_PKGS[pkg]['status'] + for pkg in pkgs_removed: + status = last_pkgs[pkg]['status'] f.write('- %s : %s
\n' % (pkg, status)) ############################################################################ # Changed Status Packages - for STATUS, STATUS_MSG, STATUS_HEADER in [ + for status, status_msg, status_header in [ ('failure', 'failed', ':exclamation: Packages now failing'), ('success', 'succeeded', ':heavy_check_mark: Packages now succeeding'), ('skipped', 'skipped', ':heavy_multiplication_x: Packages that now skipped')]: - PKGS_FILTERED = [pkg for pkg in PKGS.keys() if - pkg in LAST_PKGS.keys() and - PKGS[pkg]['status'] != LAST_PKGS[pkg]['status'] and - PKGS[pkg]['status'] == STATUS] - - REPORT_DIFF[STATUS+'_changed'] = len(PKGS_FILTERED) - if len(PKGS_FILTERED) > 0: - f.write('## %s\n\n' % STATUS_HEADER) - f.write('%d package(s) %s tests only on the current version.' % (len(PKGS_FILTERED), STATUS_MSG)) + pkgs_filtered = [pkg for pkg in pkgs.keys() if + pkg in last_pkgs.keys() and + pkgs[pkg]['status'] != last_pkgs[pkg]['status'] and + pkgs[pkg]['status'] == status] + + report_diff[status+'_changed'] = len(pkgs_filtered) + if len(pkgs_filtered) > 0: + f.write('## %s\n\n' % status_header) + f.write('%d package(s) %s tests only on the current version.' % (len(pkgs_filtered), status_msg)) f.write('
Click to expand!\n\n') - for pkg in PKGS_FILTERED: - version = PKGS[pkg]['version'] - last_status = LAST_PKGS[pkg]['status'] - last_version = LAST_PKGS[pkg]['version'] + for pkg in pkgs_filtered: + version = pkgs[pkg]['version'] + last_status = last_pkgs[pkg]['status'] + last_version = last_pkgs[pkg]['version'] f.write('- %s %s vs %s %s (%s)
\n' % (pkg, version, pkg, last_version, last_status)) f.write('
\n\n') ############################################################################ # Same Status Packages - for STATUS, STATUS_MSG, STATUS_HEADER in [ + for status, status_msg, status_header in [ ('failure', 'failed', ':exclamation: Packages still failing'), ('success', 'succeeded', ':heavy_check_mark: Packages still succeeding'), ('skipped', 'skipped', ':heavy_minus_sign: Packages that still skipped')]: - PKGS_FILTERED = [pkg for pkg in PKGS.keys() if - pkg in LAST_PKGS.keys() and - PKGS[pkg]['status'] == LAST_PKGS[pkg]['status'] and - PKGS[pkg]['status'] == STATUS] - - REPORT_DIFF[STATUS+'_same'] = len(PKGS_FILTERED) - if len(PKGS_FILTERED) > 0: - f.write('## %s\n\n' % STATUS_HEADER) - f.write('%d package(s) %s tests also on the previous version.' % (len(PKGS_FILTERED), STATUS_MSG)) + pkgs_filtered = [pkg for pkg in pkgs.keys() if + pkg in last_pkgs.keys() and + pkgs[pkg]['status'] == last_pkgs[pkg]['status'] and + pkgs[pkg]['status'] == status] + + report_diff[status+'_same'] = len(pkgs_filtered) + if len(pkgs_filtered) > 0: + f.write('## %s\n\n' % status_header) + f.write('%d package(s) %s tests also on the previous version.' % (len(pkgs_filtered), status_msg)) f.write('
Click to expand!\n\n') - for pkg in PKGS_FILTERED: - version = PKGS[pkg]['version'] + for pkg in pkgs_filtered: + version = pkgs[pkg]['version'] f.write('- %s %s
\n' % (pkg, version)) f.write('
\n\n') # Write test-status-diff.json -with open(DIR_REPORT+'/test-status-diff.json', 'w') as f: - json.dump(REPORT_DIFF, f, ensure_ascii=False, indent=2) +with open(dir_report+'/test-status-diff.json', 'w') as f: + json.dump(report_diff, f, ensure_ascii=False, indent=2) ################################################################################ # Update Latest -if OVERRIDE_LAST: - symlink(DIR_REPORT, DIR_LAST_REPORT_SYMBOLIC, overwrite=True) +if override_last: + symlink(dir_report, dir_last_report_symbolic, overwrite=True) ############################################################################ # Generate html redirect - with open(os.path.join(DIR_REDIRECT, 'redirect.html'), 'w') as f: + with open(os.path.join(dir_redirect, 'redirect.html'), 'w') as f: f.write(''' Redirecting to latest report - ''' % (REPO+'/blob/'+DIR_REPORT+'/report.md', REPO+'/'+DIR_REPORT+'/report.md')) + ''' % (repo+'/blob/'+dir_report+'/report.md', repo+'/'+dir_report+'/report.md')) ############################################################################ # Generate badge - relativeFailures = 1 - REPORT['success'] / REPORT['total'] + relativeFailures = 1 - report['success'] / report['total'] if relativeFailures > 0.05: color = 'critical' elif relativeFailures > 0: @@ -194,13 +194,13 @@ else: color = 'success' - BADGE = { + badge = { 'schemaVersion' : 1, 'label': 'Tests', - 'message': '%d/%d passing' % (REPORT['success'], REPORT['total']), + 'message': '%d/%d passing' % (report['success'], report['total']), 'color': color, 'namedLogo': "github" } - with open(os.path.join(DIR_BADGE, 'badge.json'), 'w') as f: - json.dump(BADGE, f, ensure_ascii=False, indent=2) \ No newline at end of file + with open(os.path.join(dir_badge, 'badge.json'), 'w') as f: + json.dump(badge, f, ensure_ascii=False, indent=2) \ No newline at end of file From 0e50f412990742cf006177a4631287ce01d53817 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:14:01 +0100 Subject: [PATCH 023/105] Lowercase in generate_test_status.py --- tools/generate_test_status.py | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tools/generate_test_status.py b/tools/generate_test_status.py index 90f68b065..eace3e76a 100644 --- a/tools/generate_test_status.py +++ b/tools/generate_test_status.py @@ -39,34 +39,34 @@ ################################################################################ # Collect the job-status of each package from _reports/ -FILES = [] -for FILE in glob.glob('_reports/**/*.json', recursive=True): - FILES.append(FILE) +files = [] +for file in glob.glob('_reports/**/*.json', recursive=True): + files.append(file) -FILES.sort() +files.sort() -PKG_STATUS = {} +pkgs = {} -for FILE in FILES: - with open(FILE, 'r', encoding='utf-8', errors='ignore') as f: +for file in files: + with open(file, 'r', encoding='utf-8', errors='ignore') as f: data = json.load(f) - PKG_STATUS[os.path.splitext(os.path.basename(FILE))[0]] = data + pkgs[os.path.splitext(os.path.basename(file))[0]] = data ################################################################################ # Generate main test-status.json # General Information -REPORT = {} -REPORT['repo'] = repo -REPORT['workflow'] = repo+'/actions/runs/'+runID -REPORT['hash'] = hash -REPORT['hash_short'] = hash_short -REPORT['date'] = str(datetime.now()) +report = {} +report['repo'] = repo +report['workflow'] = repo+'/actions/runs/'+runID +report['hash'] = hash +report['hash_short'] = hash_short +report['date'] = str(datetime.now()) # Package Information -for pkg, data in PKG_STATUS.items(): +for pkg, data in pkgs.items(): with open(os.path.join('packages', pkg, 'meta.json'), 'r') as f: meta = json.load(f) data['version'] = meta['Version'] @@ -86,25 +86,25 @@ else: # all are 'success' data['status'] = 'success' -REPORT['pkgs'] = PKG_STATUS +report['pkgs'] = pkgs # Summary Information -REPORT['total'] = 0 -REPORT['success'] = 0 -REPORT['failure'] = 0 -REPORT['skipped'] = 0 +report['total'] = 0 +report['success'] = 0 +report['failure'] = 0 +report['skipped'] = 0 -for pkg, data in PKG_STATUS.items(): - REPORT['total'] += 1 +for pkg, data in pkgs.items(): + report['total'] += 1 status = data['status'] if status == 'success': - REPORT['success'] += 1 + report['success'] += 1 elif status == 'failure': - REPORT['failure'] += 1 + report['failure'] += 1 elif status == 'skipped': - REPORT['skipped'] += 1 + report['skipped'] += 1 else: warning('Unknown job status detected for pkg \"'+pkg+'\"') with open('test-status.json', 'w') as f: - json.dump(REPORT, f, ensure_ascii=False, indent=2) + json.dump(report, f, ensure_ascii=False, indent=2) From 8cf0344ca4470f7c39ad7bd20eae0417faa87a5f Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:14:57 +0100 Subject: [PATCH 024/105] Add empty line at end --- tools/generate_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index 5ae779065..da2fc0a2f 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -203,4 +203,4 @@ } with open(os.path.join(dir_badge, 'badge.json'), 'w') as f: - json.dump(badge, f, ensure_ascii=False, indent=2) \ No newline at end of file + json.dump(badge, f, ensure_ascii=False, indent=2) From a6cd75f49018c3c4b0bd27dae5dcf9283db5e8ea Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:15:51 +0100 Subject: [PATCH 025/105] Simplify pkgs_new and pkgs_removed --- tools/generate_report.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index da2fc0a2f..4abea1a56 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -98,8 +98,7 @@ ############################################################################ # New Packages - pkgs_new = [pkg for pkg in pkgs.keys() if - not pkg in last_pkgs.keys()] + pkgs_new = pkgs.keys() - last_pkgs.keys() report_diff['new'] = len(pkgs_new) if len(pkgs_new) > 0: @@ -110,8 +109,7 @@ ############################################################################ # Removed Packages - pkgs_removed = [pkg for pkg in last_pkgs.keys() if - not pkg in pkgs.keys()] + pkgs_removed = last_pkgs.keys() - pkgs.keys() report_diff['removed'] = len(pkgs_removed) if len(pkgs_removed) > 0: From cced0119a606e9f6a9beda2b3a02fbac253bc671 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:17:30 +0100 Subject: [PATCH 026/105] Update name in report-caller.yml --- .github/workflows/report-caller.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/report-caller.yml b/.github/workflows/report-caller.yml index f33a0a421..2d92ee6a2 100644 --- a/.github/workflows/report-caller.yml +++ b/.github/workflows/report-caller.yml @@ -1,4 +1,4 @@ -name: "Test report.yml" +name: "Helper for testing report.yml" on: workflow_call: From f03017d9c83c9ca35876dde82efb69fb7fd73417 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:20:23 +0100 Subject: [PATCH 027/105] Simplify github commands --- .github/workflows/report.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 8ee85071a..f488a8966 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -34,9 +34,9 @@ jobs: git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} git fetch git branch --track data origin/data - git worktree add data origin/data + git worktree add data data git branch --track gh-pages origin/gh-pages - git worktree add gh-pages origin/gh-pages + git worktree add gh-pages gh-pages - name: "Generate report" id: report @@ -59,8 +59,8 @@ jobs: cd data git add -A git commit -m "Automated report" - git push origin HEAD:data + git push cd ../gh-pages git add -A git commit -m "Automated redirect" - git push origin HEAD:gh-pages + git push From 9f2fe5c86c38b49a5eea67bcafcf4cd2f01c633a Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:21:00 +0100 Subject: [PATCH 028/105] Fix report-caller.yml --- .github/workflows/report-caller.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/report-caller.yml b/.github/workflows/report-caller.yml index 2d92ee6a2..472ba00c4 100644 --- a/.github/workflows/report-caller.yml +++ b/.github/workflows/report-caller.yml @@ -19,5 +19,5 @@ jobs: - name: "Output test-status" id: test-status run: | - TEST_STATUS=$(cat test-status.json | jq -aR) + TEST_STATUS=$(cat test-status.json | jq -aRs) echo "::set-output name=test-status::$TEST_STATUS" From 2b20c4bf8e1aa5fa6b6e9ded335c6dd61b2bc737 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:23:29 +0100 Subject: [PATCH 029/105] Update test-status.json --- test-status.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-status.json b/test-status.json index f103f0dbd..4969a4550 100644 --- a/test-status.json +++ b/test-status.json @@ -3,7 +3,7 @@ "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", "hash": "2ab91d36fdb5394e4d3491hadg74bd415c55e06", "hash_short": "2ab91d3", - "date": "2022-03-17 18:31:03.988758", + "date": "2022-03-21 18:31:03.988758", "pkgs": { "ace": { "status_default": "success", From 4623c0401fb813a3de15215b410d699bdae8cdac Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:34:04 +0100 Subject: [PATCH 030/105] Save id in test-status.json --- .github/workflows/report.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index f488a8966..2481593c5 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -41,14 +41,19 @@ jobs: - name: "Generate report" id: report run: | + # Generate id for test-status + ROOT="data/reports" JSON='${{ env.test-status }}' HASH=$(jq -r '.hash_short' <<< ${JSON}) DATE=$(jq -r '.date' <<< ${JSON}) DATE=$(echo $DATE | sed 's/ /-/g' | cut -d '.' -f1) DIR_REL="manual/${DATE}-${HASH}" - DIR="data/reports/${DIR_REL}" + DIR="${ROOT}/${DIR_REL}" + JSON=$(echo ${JSON} | jq '.id |= ["${DIR_REL}"] + .') + # Write test-status mkdir -p ${DIR} jq <<< ${JSON} > "${DIR}/test-status.json" + # Generate report python tools/generate_report.py ${DIR_REL} - name: "Push report" From 3bb5dffccaa4727bdd03a6e95bde5a467ea114df Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:36:08 +0100 Subject: [PATCH 031/105] Update test-status.json --- test-status.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-status.json b/test-status.json index 4969a4550..920323d06 100644 --- a/test-status.json +++ b/test-status.json @@ -3,7 +3,7 @@ "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", "hash": "2ab91d36fdb5394e4d3491hadg74bd415c55e06", "hash_short": "2ab91d3", - "date": "2022-03-21 18:31:03.988758", + "date": "2022-03-22 18:31:03.988758", "pkgs": { "ace": { "status_default": "success", From 36c4da7609e50dd90e87c3f03547765f4a081f10 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:37:48 +0100 Subject: [PATCH 032/105] Update report-caller.yml --- .github/workflows/report-caller.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/report-caller.yml b/.github/workflows/report-caller.yml index 472ba00c4..38b409022 100644 --- a/.github/workflows/report-caller.yml +++ b/.github/workflows/report-caller.yml @@ -16,6 +16,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: "Generate test-status.json" + id: report + run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") + - name: "Output test-status" id: test-status run: | From 72823adcd8f991fd18c883e3dd2760fab79e360d Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:38:21 +0100 Subject: [PATCH 033/105] Update _reports for debugging --- _reports/reports-ace/ace.json | 4 ++++ _reports/reports-aclib/aclib.json | 4 ++++ _reports/reports-agt/agt.json | 4 ++++ test-status.json | 37 ------------------------------- 4 files changed, 12 insertions(+), 37 deletions(-) create mode 100644 _reports/reports-ace/ace.json create mode 100644 _reports/reports-aclib/aclib.json create mode 100644 _reports/reports-agt/agt.json delete mode 100644 test-status.json diff --git a/_reports/reports-ace/ace.json b/_reports/reports-ace/ace.json new file mode 100644 index 000000000..d1e342b7e --- /dev/null +++ b/_reports/reports-ace/ace.json @@ -0,0 +1,4 @@ +{ + "status_default": "failure", + "status_only_needed": "success" +} diff --git a/_reports/reports-aclib/aclib.json b/_reports/reports-aclib/aclib.json new file mode 100644 index 000000000..b71c4df75 --- /dev/null +++ b/_reports/reports-aclib/aclib.json @@ -0,0 +1,4 @@ +{ + "status_default": "success", + "status_only_needed": "success" +} diff --git a/_reports/reports-agt/agt.json b/_reports/reports-agt/agt.json new file mode 100644 index 000000000..3b6681361 --- /dev/null +++ b/_reports/reports-agt/agt.json @@ -0,0 +1,4 @@ +{ + "status_default": "success", + "status_only_needed": "failure" +} diff --git a/test-status.json b/test-status.json deleted file mode 100644 index 920323d06..000000000 --- a/test-status.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "repo": "https://github.com/FriedrichRober/PackageDistro", - "workflow": "https://github.com/FriedrichRober/PackageDistro/actions/runs/Unknown", - "hash": "2ab91d36fdb5394e4d3491hadg74bd415c55e06", - "hash_short": "2ab91d3", - "date": "2022-03-22 18:31:03.988758", - "pkgs": { - "ace": { - "status_default": "success", - "status_only_needed": "success", - "version": "5.5", - "archive_url": "https://github.com/gap-packages/ace/releases/download/v5.4/ace-5.4", - "archive_sha256": "7dc9ca0d1807511e9e931b471809db2fe9bc7956153f62dd60f1798c6a615a87", - "status": "success" - }, - "aclib": { - "status_default": "failure", - "status_only_needed": "success", - "version": "1.3.4", - "archive_url": "https://github.com/gap-packages/aclib/releases/download/v1.3.2/aclib-1.3.2", - "archive_sha256": "f672d0aee19f22b411352835a4730a6f88eecad7d79d8452b273f381b03e1a7b", - "status": "failure" - }, - "agt": { - "status_default": "success", - "status_only_needed": "failure", - "version": "0.2", - "archive_url": "https://github.com/gap-packages/AGT/releases/download/v0.2/AGT-0.2", - "archive_sha256": "d7d5564328eceadb2420524fdb7d4c8f1261e95490950858f31dcca89b8675ae", - "status": "failure" - } - }, - "total": 3, - "success": 1, - "failure": 2, - "skipped": 0 -} From 68a9b9b10074b70ba007adeea2d86fbc6e06806a Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:39:21 +0100 Subject: [PATCH 034/105] Update report-caller.yml --- .github/workflows/report-caller.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/report-caller.yml b/.github/workflows/report-caller.yml index 38b409022..9a968f54f 100644 --- a/.github/workflows/report-caller.yml +++ b/.github/workflows/report-caller.yml @@ -16,6 +16,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: "Install package distribution tools" + run: | + python -m pip install -r tools/requirements.txt + - name: "Generate test-status.json" id: report run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") From 114539765c5882f2363e2cd857c5fa99c0e49e02 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:43:17 +0100 Subject: [PATCH 035/105] FIX: write id --- .github/workflows/report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 2481593c5..ca4e82a1d 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -49,7 +49,7 @@ jobs: DATE=$(echo $DATE | sed 's/ /-/g' | cut -d '.' -f1) DIR_REL="manual/${DATE}-${HASH}" DIR="${ROOT}/${DIR_REL}" - JSON=$(echo ${JSON} | jq '.id |= ["${DIR_REL}"] + .') + JSON=$(echo ${JSON} | jq --argjson id "$DIR_REL" '.id |= $id + .') # Write test-status mkdir -p ${DIR} jq <<< ${JSON} > "${DIR}/test-status.json" From 471a19a1591e43717f22998c7f61c75c5922c809 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 12:59:47 +0100 Subject: [PATCH 036/105] Simplify report directories --- tools/generate_report.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index 4abea1a56..c73c05eca 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -66,15 +66,15 @@ with open(last_report_path, 'r') as f: last_report = json.load(f) else: # deal with the first run of this script - last_report = {'pkgs': {}, 'hash': 'Unknown'} + last_report = {'pkgs': {}, 'hash': 'Unknown', 'id': 'NULL'} repo = report['repo'] ################################################################################ # Generate report.md and test-status-diff.json report_diff = {} -report_diff['current'] = report_path.split('data/')[1] -report_diff['last'] = last_report_path.split('data/')[1] +report_diff['current'] = report['id'] +report_diff['last'] = last_report['id'] report_diff['total'] = report['total'] report_diff['failure'] = report['failure'] report_diff['success'] = report['success'] @@ -85,10 +85,10 @@ f.write('# Package Evaluation Report\n\n') f.write('## Job Properties\n\n') f.write('*Testing:* [%s](%s) vs [%s](%s)\n\n' % ( - report_diff['current'].split('reports/')[1].split('/test-status.json')[0], - os.path.join(repo, 'blob/data', report_diff['current']), - report_diff['last'].split('reports/')[1].split('/test-status.json')[0], - os.path.join(repo, 'blob/data', report_diff['last']) + report_diff['current'], + os.path.join(repo, 'blob', root, report_diff['current']), + report_diff['last'], + os.path.join(repo, 'blob', root, report_diff['last']) )) f.write('*Generated by Workflow:* %s\n\n' % report['workflow']) f.write('In total, %d packages were tested, out of which %d succeeded, %d failed and %d were skipped.\n\n' % (report['total'], report['success'], report['failure'], report['skipped'])) From aec46723480c94b9d0a686e7cbf5d3f23fdf965f Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 13:09:50 +0100 Subject: [PATCH 037/105] FIX: wrong argument in jq --- .github/workflows/report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index ca4e82a1d..28be27bc5 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -49,7 +49,7 @@ jobs: DATE=$(echo $DATE | sed 's/ /-/g' | cut -d '.' -f1) DIR_REL="manual/${DATE}-${HASH}" DIR="${ROOT}/${DIR_REL}" - JSON=$(echo ${JSON} | jq --argjson id "$DIR_REL" '.id |= $id + .') + JSON=$(echo ${JSON} | jq --arg id $DIR_REL '.id |= $id + .') # Write test-status mkdir -p ${DIR} jq <<< ${JSON} > "${DIR}/test-status.json" From 1fb5072f1003857a7892d29bbcfe27321c54d193 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 13:11:01 +0100 Subject: [PATCH 038/105] Print raw json in test-all.yml --- .github/workflows/test-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 816de673a..b43fd5a78 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -355,5 +355,5 @@ jobs: - name: "Output test-status" id: test-status run: | - TEST_STATUS=$(cat test-status.json) + TEST_STATUS=$(cat test-status.json | jq -aRs) echo "::set-output name=test-status::$TEST_STATUS" From 87206891c7ad7f4c3883193c0e8149e05e7f23d0 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 13:12:23 +0100 Subject: [PATCH 039/105] Update default last_report --- tools/generate_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index c73c05eca..74edc7dd0 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -66,7 +66,7 @@ with open(last_report_path, 'r') as f: last_report = json.load(f) else: # deal with the first run of this script - last_report = {'pkgs': {}, 'hash': 'Unknown', 'id': 'NULL'} + last_report = {'pkgs': {}, 'id': 'NULL'} repo = report['repo'] From 84289a1070478606c296368e28bae7ecdb91743f Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 13:16:40 +0100 Subject: [PATCH 040/105] Change default behaviour to not overwrite latest report --- tools/generate_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index 74edc7dd0..7685f93c5 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -37,7 +37,7 @@ root = 'data/reports' os.makedirs(root, exist_ok = True) dir_last_report_rel = 'latest' -override_last = True +override_last = False if num_args > 1: dir_report_rel = sys.argv[1] if num_args > 2: dir_last_report_rel = sys.argv[2] From 0e074c234146c7167da6a44b332bc6fbd6dece54 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 13:17:04 +0100 Subject: [PATCH 041/105] Adjust calling the generate_report script --- .github/workflows/report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 28be27bc5..efe2fc041 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -54,7 +54,7 @@ jobs: mkdir -p ${DIR} jq <<< ${JSON} > "${DIR}/test-status.json" # Generate report - python tools/generate_report.py ${DIR_REL} + python tools/generate_report.py ${DIR_REL} latest True - name: "Push report" id: push-report From a70b8b84668c2678fda4346fe92b63cf55b6bc04 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 13:18:41 +0100 Subject: [PATCH 042/105] Try out False option --- .github/workflows/report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index efe2fc041..8d5e2619b 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -54,7 +54,7 @@ jobs: mkdir -p ${DIR} jq <<< ${JSON} > "${DIR}/test-status.json" # Generate report - python tools/generate_report.py ${DIR_REL} latest True + python tools/generate_report.py ${DIR_REL} latest False - name: "Push report" id: push-report From 6deea109a9ba018b9ee04c854fa4e812cabad31c Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 13:22:14 +0100 Subject: [PATCH 043/105] Add warning comment about trying to push to gh-pages --- .github/workflows/report.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 8d5e2619b..0329f3829 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -54,7 +54,7 @@ jobs: mkdir -p ${DIR} jq <<< ${JSON} > "${DIR}/test-status.json" # Generate report - python tools/generate_report.py ${DIR_REL} latest False + python tools/generate_report.py ${DIR_REL} latest True - name: "Push report" id: push-report @@ -65,6 +65,7 @@ jobs: git add -A git commit -m "Automated report" git push + # CAUTION: Use this only if generate report overwrites latest! cd ../gh-pages git add -A git commit -m "Automated redirect" From bb47208d5f5aed6494f6e47abde4e369341d5643 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 21 Mar 2022 13:40:42 +0100 Subject: [PATCH 044/105] Update _reports for testing --- _reports/reports-aclib/aclib.json | 2 +- _reports/reports-agt/agt.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_reports/reports-aclib/aclib.json b/_reports/reports-aclib/aclib.json index b71c4df75..3b6681361 100644 --- a/_reports/reports-aclib/aclib.json +++ b/_reports/reports-aclib/aclib.json @@ -1,4 +1,4 @@ { "status_default": "success", - "status_only_needed": "success" + "status_only_needed": "failure" } diff --git a/_reports/reports-agt/agt.json b/_reports/reports-agt/agt.json index 3b6681361..b71c4df75 100644 --- a/_reports/reports-agt/agt.json +++ b/_reports/reports-agt/agt.json @@ -1,4 +1,4 @@ { "status_default": "success", - "status_only_needed": "failure" + "status_only_needed": "success" } From 03ec3c36baf4aead0ddaa160225db24e3be8b6aa Mon Sep 17 00:00:00 2001 From: Friedrich Rober <37139927+FriedrichRober@users.noreply.github.com> Date: Thu, 24 Mar 2022 10:34:19 +0100 Subject: [PATCH 045/105] Add empty line to tools/utils.py Co-authored-by: Max Horn --- tools/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/utils.py b/tools/utils.py index 432dbcdea..cac2e38d6 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -135,4 +135,4 @@ def string_to_bool(string): elif string.lower().strip() in ['0', 'false']: return False else: - error("Unknown string representation of bool") \ No newline at end of file + error("Unknown string representation of bool") From df48a11fa0aa1232675eb48774b82c16de1a0ee1 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 24 Mar 2022 11:20:15 +0100 Subject: [PATCH 046/105] WIP: Seperate generate_report and update_latest_report --- .github/workflows/report-caller.yml | 31 ---------- .github/workflows/report.yml | 32 +++++----- .github/workflows/test-all.yml | 8 +-- tools/generate_report.py | 55 +---------------- tools/update_latest_report.py | 93 +++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 106 deletions(-) delete mode 100644 .github/workflows/report-caller.yml create mode 100644 tools/update_latest_report.py diff --git a/.github/workflows/report-caller.yml b/.github/workflows/report-caller.yml deleted file mode 100644 index 9a968f54f..000000000 --- a/.github/workflows/report-caller.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: "Helper for testing report.yml" - -on: - workflow_call: - outputs: - test-status: - description: "The test-status report" - value: ${{ jobs.report.outputs.test-status }} - -jobs: - report: - name: "Report" - runs-on: ubuntu-latest - outputs: - test-status: ${{ steps.test-status.outputs.test-status }} - steps: - - uses: actions/checkout@v2 - - - name: "Install package distribution tools" - run: | - python -m pip install -r tools/requirements.txt - - - name: "Generate test-status.json" - id: report - run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") - - - name: "Output test-status" - id: test-status - run: | - TEST_STATUS=$(cat test-status.json | jq -aRs) - echo "::set-output name=test-status::$TEST_STATUS" diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 0329f3829..ed07b9e99 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -5,17 +5,9 @@ on: push: jobs: - test: - name: "Run Tests" - uses: ./.github/workflows/report-caller.yml - - report: - name: "Create Report" + name: "Report" runs-on: ubuntu-latest - needs: test - env: - test-status: ${{ fromJson(needs.test.outputs.test-status) }} if: ${{ always() }} steps: - uses: actions/checkout@v2 @@ -29,6 +21,10 @@ jobs: run: | python -m pip install -r tools/requirements.txt + - name: "Generate test-status.json" + id: test-status + run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") + - name: "Create data and gh-pages worktree" run: | git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} @@ -43,7 +39,7 @@ jobs: run: | # Generate id for test-status ROOT="data/reports" - JSON='${{ env.test-status }}' + JSON=$(cat test-status.json) HASH=$(jq -r '.hash_short' <<< ${JSON}) DATE=$(jq -r '.date' <<< ${JSON}) DATE=$(echo $DATE | sed 's/ /-/g' | cut -d '.' -f1) @@ -54,7 +50,11 @@ jobs: mkdir -p ${DIR} jq <<< ${JSON} > "${DIR}/test-status.json" # Generate report - python tools/generate_report.py ${DIR_REL} latest True + python tools/generate_report.py ${DIR_REL} latest + + # - name: "Update latest report" + # run: | + # python tools/update_latest_report.py ${DIR_REL} latest - name: "Push report" id: push-report @@ -65,8 +65,8 @@ jobs: git add -A git commit -m "Automated report" git push - # CAUTION: Use this only if generate report overwrites latest! - cd ../gh-pages - git add -A - git commit -m "Automated redirect" - git push + # # CAUTION: Use this only if generate report overwrites latest! + # cd ../gh-pages + # git add -A + # git commit -m "Automated redirect" + # git push diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index b43fd5a78..49ecedeb9 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -349,11 +349,5 @@ jobs: python -m pip install -r tools/requirements.txt - name: "Generate test-status.json" - id: report - run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") - - - name: "Output test-status" id: test-status - run: | - TEST_STATUS=$(cat test-status.json | jq -aRs) - echo "::set-output name=test-status::$TEST_STATUS" + run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") diff --git a/tools/generate_report.py b/tools/generate_report.py index 7685f93c5..095d65be5 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -14,13 +14,10 @@ """ This script compares the current test-status.json with a previous version, -generates a main report.md along with - a test-status-diff.json, - a html-redirect, and - a badge. +and generates a main report.md along with a test-status-diff.json. """ -from utils import warning, error, symlink, string_to_bool +from utils import error import sys import os @@ -30,18 +27,16 @@ # Arguments and Paths num_args = len(sys.argv) -if num_args <= 1 or num_args > 4: +if num_args <= 1 or num_args > 3: error('Unknown number of arguments') # relative paths to report directories from root root = 'data/reports' os.makedirs(root, exist_ok = True) dir_last_report_rel = 'latest' -override_last = False if num_args > 1: dir_report_rel = sys.argv[1] if num_args > 2: dir_last_report_rel = sys.argv[2] -if num_args > 3: override_last = string_to_bool(sys.argv[3]) dir_report = os.path.realpath(os.path.join(root, dir_report_rel)) dir_last_report_symbolic = os.path.join(root, dir_last_report_rel) @@ -50,13 +45,6 @@ report_path = os.path.join(dir_report, 'test-status.json') last_report_path = os.path.join(dir_last_report, 'test-status.json') -if override_last: - dir_badge = os.path.join('data/badges', dir_last_report_rel) - os.makedirs(dir_badge, exist_ok = True) - - dir_redirect = os.path.join('gh-pages', dir_last_report_rel) - os.makedirs(dir_redirect, exist_ok = True) - ################################################################################ # Read current and previous test-status with open(report_path, 'r') as f: @@ -165,40 +153,3 @@ # Write test-status-diff.json with open(dir_report+'/test-status-diff.json', 'w') as f: json.dump(report_diff, f, ensure_ascii=False, indent=2) - -################################################################################ -# Update Latest -if override_last: - symlink(dir_report, dir_last_report_symbolic, overwrite=True) - - ############################################################################ - # Generate html redirect - with open(os.path.join(dir_redirect, 'redirect.html'), 'w') as f: - f.write(''' - - - Redirecting to latest report - - - ''' % (repo+'/blob/'+dir_report+'/report.md', repo+'/'+dir_report+'/report.md')) - - ############################################################################ - # Generate badge - relativeFailures = 1 - report['success'] / report['total'] - if relativeFailures > 0.05: - color = 'critical' - elif relativeFailures > 0: - color = 'important' - else: - color = 'success' - - badge = { - 'schemaVersion' : 1, - 'label': 'Tests', - 'message': '%d/%d passing' % (report['success'], report['total']), - 'color': color, - 'namedLogo': "github" - } - - with open(os.path.join(dir_badge, 'badge.json'), 'w') as f: - json.dump(badge, f, ensure_ascii=False, indent=2) diff --git a/tools/update_latest_report.py b/tools/update_latest_report.py new file mode 100644 index 000000000..d19d51525 --- /dev/null +++ b/tools/update_latest_report.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 + +############################################################################# +## +## This file is part of GAP, a system for computational discrete algebra. +## +## Copyright of GAP belongs to its developers, whose names are too numerous +## to list here. Please refer to the COPYRIGHT file for details. +## +## SPDX-License-Identifier: GPL-2.0-or-later +## + +# Run this script on main branch with data and gh-pages worktree + +""" +This script updates the latest symlink for the report, +and generates a html-redirect along with a badge. +""" + +from utils import error, symlink + +import sys +import os +import json + +################################################################################ +# Arguments and Paths +num_args = len(sys.argv) + +if num_args <= 1 or num_args > 3: + error('Unknown number of arguments') + +# relative paths to report directories from root +root = 'data/reports' +os.makedirs(root, exist_ok = True) +dir_last_report_rel = 'latest' + +if num_args > 1: dir_report_rel = sys.argv[1] +if num_args > 2: dir_last_report_rel = sys.argv[2] + +dir_report = os.path.realpath(os.path.join(root, dir_report_rel)) +dir_last_report_symbolic = os.path.join(root, dir_last_report_rel) + +report_path = os.path.join(dir_report, 'test-status.json') + +dir_badge = os.path.join('data/badges', dir_last_report_rel) +os.makedirs(dir_badge, exist_ok = True) + +dir_redirect = os.path.join('gh-pages', dir_last_report_rel) +os.makedirs(dir_redirect, exist_ok = True) + +################################################################################ +# Read current test-status +with open(report_path, 'r') as f: + report = json.load(f) + +repo = report['repo'] + +################################################################################ +# Update symlink +symlink(dir_report, dir_last_report_symbolic, overwrite=True) + +############################################################################ +# Generate html redirect +with open(os.path.join(dir_redirect, 'redirect.html'), 'w') as f: + f.write(''' + + + Redirecting to latest report + + + ''' % (repo+'/blob/'+dir_report+'/report.md', repo+'/'+dir_report+'/report.md')) + +############################################################################ +# Generate badge +relativeFailures = 1 - report['success'] / report['total'] +if relativeFailures > 0.05: + color = 'critical' +elif relativeFailures > 0: + color = 'important' +else: + color = 'success' + +badge = { + 'schemaVersion' : 1, + 'label': 'Tests', + 'message': '%d/%d passing' % (report['success'], report['total']), + 'color': color, + 'namedLogo': "github" +} + +with open(os.path.join(dir_badge, 'badge.json'), 'w') as f: + json.dump(badge, f, ensure_ascii=False, indent=2) From 0eb757cfcc39798f58ac42b664b5446462f125c7 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 24 Mar 2022 12:18:20 +0100 Subject: [PATCH 047/105] WIP: Upload report as artifact and call report.yml --- .github/workflows/call-report.yml | 73 +++++++++++++++++++++++++++++++ .github/workflows/report.yml | 42 +++++++++--------- 2 files changed, 95 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/call-report.yml diff --git a/.github/workflows/call-report.yml b/.github/workflows/call-report.yml new file mode 100644 index 000000000..bf9a9d149 --- /dev/null +++ b/.github/workflows/call-report.yml @@ -0,0 +1,73 @@ +name: "Test calling report.yml" + +on: + workflow_dispatch: + inputs: + which-gap: + description: 'Which Gap version' + default: 'master' + required: false + type: string + +jobs: + call-report: + name: "Call report.yml" + uses: ./.github/workflows/report.yml + with: + which-gap: ${{ github.event.inputs.which-gap }} + + update-latest: + name: "Upload report" + runs-on: ubuntu-latest + needs: call-report + steps: + - uses: actions/checkout@v2 + + # warning/error in utils.py throw a syntax error with default version of python + - name: "Set up Python 3.7" + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: "Install package distribution tools" + run: | + python -m pip install -r tools/requirements.txt + + - name: "Download report" + uses: actions/download-artifact@v3 + with: + name: report-${{ github.event.inputs.which-gap }} + path: _report + + - name: "Create data and gh-pages worktree" + run: | + git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} + git fetch + git branch --track data origin/data + git worktree add data data + git branch --track gh-pages origin/gh-pages + git worktree add gh-pages gh-pages + + - name: "Update latest report" + run: | + ROOT="data/reports" + DIR_REL=$(jq -r '.id' < '_report/test-status.json') + DIR="${ROOT}/${DIR_REL}" + mkdir -p ${DIR} + mv _report/* ${DIR} + echo $DIR_REL + python tools/update_latest_report.py ${DIR_REL} latest-${{ github.event.inputs.which-gap }} + + - name: "Push report" + id: push-report + run: | + git config --global user.name 'github-actions' + git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + cd data + git add -A + git commit -m "Automated report" + git push + cd ../gh-pages + git add -A + git commit -m "Automated redirect" + git push diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index ed07b9e99..1a5e344bc 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -1,8 +1,21 @@ name: "Test generation of comparison reports" on: + workflow_call: + inputs: + which-gap: + description: 'Which Gap version' + default: 'master' + required: false + type: string + workflow_dispatch: - push: + inputs: + which-gap: + description: 'Which Gap version' + default: 'master' + required: false + type: string jobs: report: @@ -47,26 +60,15 @@ jobs: DIR="${ROOT}/${DIR_REL}" JSON=$(echo ${JSON} | jq --arg id $DIR_REL '.id |= $id + .') # Write test-status + echo "::set-output name=dir::${DIR}" mkdir -p ${DIR} jq <<< ${JSON} > "${DIR}/test-status.json" # Generate report - python tools/generate_report.py ${DIR_REL} latest - - # - name: "Update latest report" - # run: | - # python tools/update_latest_report.py ${DIR_REL} latest + python tools/generate_report.py ${DIR_REL} latest-${{ github.event.inputs.which-gap }} - - name: "Push report" - id: push-report - run: | - git config --global user.name 'github-actions' - git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' - cd data - git add -A - git commit -m "Automated report" - git push - # # CAUTION: Use this only if generate report overwrites latest! - # cd ../gh-pages - # git add -A - # git commit -m "Automated redirect" - # git push + - name: "Upload report as artifact" + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: "report-${{ github.event.inputs.which-gap }}" + path: "${{ steps.report.outputs.dir }}" From 74f9a42b9bcef30e13f6be5a6598b3648c7b1ba5 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Thu, 24 Mar 2022 15:29:24 +0100 Subject: [PATCH 048/105] WIP: Download only latest report --- .github/workflows/report.yml | 18 +++++++++--------- tools/utils.py | 8 -------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 1a5e344bc..75ef26b89 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -38,14 +38,15 @@ jobs: id: test-status run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") - - name: "Create data and gh-pages worktree" + - name: "Download latest report" run: | - git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} - git fetch - git branch --track data origin/data - git worktree add data data - git branch --track gh-pages origin/gh-pages - git worktree add gh-pages gh-pages + ROOT="data/reports" + DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} + DIR_SYM="${ROOT}/${DIR_SYM_REL}" + wget -O _symlink "https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" + DIR=$(cat _symlink) + DIR=${DIR#/home/runner/work/PackageDistro/PackageDistro/} + wget -r -np -P ${DIR} "https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" - name: "Generate report" id: report @@ -56,7 +57,7 @@ jobs: HASH=$(jq -r '.hash_short' <<< ${JSON}) DATE=$(jq -r '.date' <<< ${JSON}) DATE=$(echo $DATE | sed 's/ /-/g' | cut -d '.' -f1) - DIR_REL="manual/${DATE}-${HASH}" + DIR_REL="${{ github.event.inputs.which-gap }}/${DATE}-${HASH}" DIR="${ROOT}/${DIR_REL}" JSON=$(echo ${JSON} | jq --arg id $DIR_REL '.id |= $id + .') # Write test-status @@ -67,7 +68,6 @@ jobs: python tools/generate_report.py ${DIR_REL} latest-${{ github.event.inputs.which-gap }} - name: "Upload report as artifact" - if: ${{ always() }} uses: actions/upload-artifact@v2 with: name: "report-${{ github.event.inputs.which-gap }}" diff --git a/tools/utils.py b/tools/utils.py index cac2e38d6..27aadf25a 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -128,11 +128,3 @@ def symlink(target, link_name, overwrite=False): if os.path.islink(temp_link_name): os.remove(temp_link_name) raise - -def string_to_bool(string): - if string.lower().strip() in ['1', 'true']: - return True - elif string.lower().strip() in ['0', 'false']: - return False - else: - error("Unknown string representation of bool") From 6cf87cdf52cf27dc2ee0ca59cc5e09e812888057 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 12:21:42 +0200 Subject: [PATCH 049/105] Adjust logic slightly. - Filter packages at start (and not during writing process) - Add a warning message if new packages are failing - Make default last dir to `latest-master` --- tools/generate_report.py | 57 +++++++++++++++++++++-------------- tools/update_latest_report.py | 2 +- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index 095d65be5..ecb07e8bb 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -15,6 +15,7 @@ """ This script compares the current test-status.json with a previous version, and generates a main report.md along with a test-status-diff.json. +We assume that the test-status.json contains an id (relative path to root). """ from utils import error @@ -33,7 +34,7 @@ # relative paths to report directories from root root = 'data/reports' os.makedirs(root, exist_ok = True) -dir_last_report_rel = 'latest' +dir_last_report_rel = 'latest-master' if num_args > 1: dir_report_rel = sys.argv[1] if num_args > 2: dir_last_report_rel = sys.argv[2] @@ -68,7 +69,30 @@ report_diff['success'] = report['success'] report_diff['skipped'] = report['skipped'] +################################################################################ +# Package Dictionaries +pkgs = report['pkgs'] +last_pkgs = last_report['pkgs'] +pkgs_new = pkgs.keys() - last_pkgs.keys() +pkgs_removed = last_pkgs.keys() - pkgs.keys() +status_list = ['failure', 'success', 'skipped'] + +pkgs_changed = {} +for status in status_list: + pkgs_changed[status] = [pkg for pkg in pkgs.keys() if + pkg in last_pkgs.keys() and + pkgs[pkg]['status'] != last_pkgs[pkg]['status'] and + pkgs[pkg]['status'] == status] + +pkgs_same = {} +for status in status_list: + pkgs_same[status] = [pkg for pkg in pkgs.keys() if + pkg in last_pkgs.keys() and + pkgs[pkg]['status'] == last_pkgs[pkg]['status'] and + pkgs[pkg]['status'] == status] + with open(dir_report+'/report.md', 'w') as f: + ############################################################################ # Header f.write('# Package Evaluation Report\n\n') f.write('## Job Properties\n\n') @@ -80,14 +104,11 @@ )) f.write('*Generated by Workflow:* %s\n\n' % report['workflow']) f.write('In total, %d packages were tested, out of which %d succeeded, %d failed and %d were skipped.\n\n' % (report['total'], report['success'], report['failure'], report['skipped'])) - - pkgs = report['pkgs'] - last_pkgs = last_report['pkgs'] + if len(pkgs_changed['failure']) > 0: + f.write(':bangbang: %d packages are failing only on current version. :bangbang:' % len(pkgs_changed['failure'])) ############################################################################ # New Packages - pkgs_new = pkgs.keys() - last_pkgs.keys() - report_diff['new'] = len(pkgs_new) if len(pkgs_new) > 0: f.write('## New Packages\n\n') @@ -97,8 +118,6 @@ ############################################################################ # Removed Packages - pkgs_removed = last_pkgs.keys() - pkgs.keys() - report_diff['removed'] = len(pkgs_removed) if len(pkgs_removed) > 0: f.write('## Removed Packages\n\n') @@ -109,14 +128,11 @@ ############################################################################ # Changed Status Packages for status, status_msg, status_header in [ - ('failure', 'failed', ':exclamation: Packages now failing'), - ('success', 'succeeded', ':heavy_check_mark: Packages now succeeding'), - ('skipped', 'skipped', ':heavy_multiplication_x: Packages that now skipped')]: - pkgs_filtered = [pkg for pkg in pkgs.keys() if - pkg in last_pkgs.keys() and - pkgs[pkg]['status'] != last_pkgs[pkg]['status'] and - pkgs[pkg]['status'] == status] + ('failure', 'failed', ':exclamation: Packages now failing'), + ('success', 'succeeded', ':heavy_check_mark: Packages now succeeding'), + ('skipped', 'skipped', ':heavy_multiplication_x: Packages that now skipped')]: + pkgs_filtered = pkgs_changed[status] report_diff[status+'_changed'] = len(pkgs_filtered) if len(pkgs_filtered) > 0: f.write('## %s\n\n' % status_header) @@ -132,14 +148,11 @@ ############################################################################ # Same Status Packages for status, status_msg, status_header in [ - ('failure', 'failed', ':exclamation: Packages still failing'), - ('success', 'succeeded', ':heavy_check_mark: Packages still succeeding'), - ('skipped', 'skipped', ':heavy_minus_sign: Packages that still skipped')]: - pkgs_filtered = [pkg for pkg in pkgs.keys() if - pkg in last_pkgs.keys() and - pkgs[pkg]['status'] == last_pkgs[pkg]['status'] and - pkgs[pkg]['status'] == status] + ('failure', 'failed', ':exclamation: Packages still failing'), + ('success', 'succeeded', ':heavy_check_mark: Packages still succeeding'), + ('skipped', 'skipped', ':heavy_minus_sign: Packages that still skipped')]: + pkgs_filtered = pkgs_same[status] report_diff[status+'_same'] = len(pkgs_filtered) if len(pkgs_filtered) > 0: f.write('## %s\n\n' % status_header) diff --git a/tools/update_latest_report.py b/tools/update_latest_report.py index d19d51525..73d9fd245 100644 --- a/tools/update_latest_report.py +++ b/tools/update_latest_report.py @@ -33,7 +33,7 @@ # relative paths to report directories from root root = 'data/reports' os.makedirs(root, exist_ok = True) -dir_last_report_rel = 'latest' +dir_last_report_rel = 'latest-master' if num_args > 1: dir_report_rel = sys.argv[1] if num_args > 2: dir_last_report_rel = sys.argv[2] From 88d8dcb94918c84d12908e6b43c6781381fbe791 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 12:35:14 +0200 Subject: [PATCH 050/105] FIX: download of old report --- .github/workflows/report.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 75ef26b89..9f9451d5d 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -41,12 +41,16 @@ jobs: - name: "Download latest report" run: | ROOT="data/reports" + mkdir -p ${ROOT} DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} DIR_SYM="${ROOT}/${DIR_SYM_REL}" - wget -O _symlink "https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" - DIR=$(cat _symlink) + # wget downloads the symbolic link as file! + wget -O ${DIR_SYM} "https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" + DIR=$(cat ${DIR_SYM}) + rm ${DIR_SYM} + ln -s ${DIR} ${DIR_SYM} DIR=${DIR#/home/runner/work/PackageDistro/PackageDistro/} - wget -r -np -P ${DIR} "https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" + wget -P ${DIR} "https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" - name: "Generate report" id: report From 9e3cb804adb7d09baced05fd43d3d7dac3a749be Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 13:06:29 +0200 Subject: [PATCH 051/105] Add version to new and removed packages --- tools/generate_report.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index ecb07e8bb..1ff093a96 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -113,8 +113,9 @@ if len(pkgs_new) > 0: f.write('## New Packages\n\n') for pkg in pkgs_new: + version = pkgs[pkg]['version'] status = pkgs[pkg]['status'] - f.write('- %s : %s
\n' % (pkg, status)) + f.write('- %s %s : %s
\n' % (pkg, version, status)) ############################################################################ # Removed Packages @@ -122,8 +123,9 @@ if len(pkgs_removed) > 0: f.write('## Removed Packages\n\n') for pkg in pkgs_removed: + version = last_pkgs[pkg]['version'] status = last_pkgs[pkg]['status'] - f.write('- %s : %s
\n' % (pkg, status)) + f.write('- %s %s : %s
\n' % (pkg, version, status)) ############################################################################ # Changed Status Packages From 63acd9f0bd850d9bf870dc6a9a8e120c2cf659f3 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 13:19:41 +0200 Subject: [PATCH 052/105] Write id and test-status directly to correct path --- .github/workflows/report.yml | 16 +--------------- tools/generate_test_status.py | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 9f9451d5d..69021c7d9 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -36,7 +36,7 @@ jobs: - name: "Generate test-status.json" id: test-status - run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") + run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") ${{github.event.inputs.which-gap}} - name: "Download latest report" run: | @@ -55,20 +55,6 @@ jobs: - name: "Generate report" id: report run: | - # Generate id for test-status - ROOT="data/reports" - JSON=$(cat test-status.json) - HASH=$(jq -r '.hash_short' <<< ${JSON}) - DATE=$(jq -r '.date' <<< ${JSON}) - DATE=$(echo $DATE | sed 's/ /-/g' | cut -d '.' -f1) - DIR_REL="${{ github.event.inputs.which-gap }}/${DATE}-${HASH}" - DIR="${ROOT}/${DIR_REL}" - JSON=$(echo ${JSON} | jq --arg id $DIR_REL '.id |= $id + .') - # Write test-status - echo "::set-output name=dir::${DIR}" - mkdir -p ${DIR} - jq <<< ${JSON} > "${DIR}/test-status.json" - # Generate report python tools/generate_report.py ${DIR_REL} latest-${{ github.event.inputs.which-gap }} - name: "Upload report as artifact" diff --git a/tools/generate_test_status.py b/tools/generate_test_status.py index eace3e76a..13bbaed85 100644 --- a/tools/generate_test_status.py +++ b/tools/generate_test_status.py @@ -12,7 +12,8 @@ """ This script collects the job-status of each package from _reports/ -and generates a main test-status.json +and generates a main test-status.json. +The file is written into data/reports/{{which_gap}}/{{date}}-{{hash_short}}. """ from utils import error, warning @@ -27,15 +28,16 @@ # Arguments num_args = len(sys.argv) -if num_args > 5: +if num_args > 6: error('Too many arguments') -repo = runID = hash = hash_short ='Unknown' +repo = runID = hash = hash_short = which_gap = 'Unknown' if num_args > 1: repo = 'https://github.com/'+sys.argv[1] if num_args > 2: runID = sys.argv[2] if num_args > 3: hash = sys.argv[3] if num_args > 4: hash_short = sys.argv[4] +if num_args > 5: which_gap = sys.argv[5] ################################################################################ # Collect the job-status of each package from _reports/ @@ -53,7 +55,6 @@ pkgs[os.path.splitext(os.path.basename(file))[0]] = data - ################################################################################ # Generate main test-status.json @@ -63,12 +64,20 @@ report['workflow'] = repo+'/actions/runs/'+runID report['hash'] = hash report['hash_short'] = hash_short -report['date'] = str(datetime.now()) +date = str(datetime.now()).split('.')[0] +report['date'] = date +report['id'] = os.path.join(which_gap, "%s-%s", (date.replace(' ','-'), hash_short)) + +# Path +root = 'data/reports' +dir_test_status = os.path.join(root, report['id']) +os.makedirs(dir_test_status, exist_ok = True) # Package Information for pkg, data in pkgs.items(): with open(os.path.join('packages', pkg, 'meta.json'), 'r') as f: meta = json.load(f) + data['version'] = meta['Version'] data['archive_url'] = meta['ArchiveURL'] data['archive_sha256'] = meta['ArchiveSHA256'] @@ -106,5 +115,5 @@ else: warning('Unknown job status detected for pkg \"'+pkg+'\"') -with open('test-status.json', 'w') as f: +with open(os.path.join(dir_test_status, 'test-status.json'), 'w') as f: json.dump(report, f, ensure_ascii=False, indent=2) From b6abe57ae2a6fe9a0f1bcac8571ce7d90ce1aa51 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 13:30:21 +0200 Subject: [PATCH 053/105] Rename `reports-` artifacts to `test-status-` --- .github/workflows/test-all.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 49ecedeb9..9b86bfaf0 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -315,7 +315,7 @@ jobs: if: ${{ always() }} uses: actions/upload-artifact@v2 with: - name: "reports-${{ matrix.package }}" + name: "test-status-${{ matrix.package }}" path: "${{ matrix.package }}.json" report: @@ -335,7 +335,7 @@ jobs: - name: "Download every job status" uses: elonh/download-artifact-regexp@master # FIXME/TODO: Switch to actions/download-artifact once they officially support wildcards, see https://github.com/actions/download-artifact/issues/6 with: - pattern: reports-* + pattern: test-status-* path: _reports # warning/error in utils.py throw a syntax error with default version of python From bf2169f50f02c99bb09d0f6e1db508286d908427 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 13:31:17 +0200 Subject: [PATCH 054/105] Remove echo --- .github/workflows/call-report.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/call-report.yml b/.github/workflows/call-report.yml index bf9a9d149..cc630c40c 100644 --- a/.github/workflows/call-report.yml +++ b/.github/workflows/call-report.yml @@ -55,7 +55,6 @@ jobs: DIR="${ROOT}/${DIR_REL}" mkdir -p ${DIR} mv _report/* ${DIR} - echo $DIR_REL python tools/update_latest_report.py ${DIR_REL} latest-${{ github.event.inputs.which-gap }} - name: "Push report" From b2c6059ee4977cf0fcd51b0bd20aced86524b02c Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 13:34:57 +0200 Subject: [PATCH 055/105] Adjust details message --- tools/generate_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index 1ff093a96..71932b535 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -139,7 +139,7 @@ if len(pkgs_filtered) > 0: f.write('## %s\n\n' % status_header) f.write('%d package(s) %s tests only on the current version.' % (len(pkgs_filtered), status_msg)) - f.write('
Click to expand!\n\n') + f.write('
Click to show package(s)!\n\n') for pkg in pkgs_filtered: version = pkgs[pkg]['version'] last_status = last_pkgs[pkg]['status'] @@ -159,7 +159,7 @@ if len(pkgs_filtered) > 0: f.write('## %s\n\n' % status_header) f.write('%d package(s) %s tests also on the previous version.' % (len(pkgs_filtered), status_msg)) - f.write('
Click to expand!\n\n') + f.write('
Click to show package(s)!\n\n') for pkg in pkgs_filtered: version = pkgs[pkg]['version'] f.write('- %s %s
\n' % (pkg, version)) From b3516effe85d172595fa643e677ac45f7aa5a729 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 13:35:34 +0200 Subject: [PATCH 056/105] FIX: syntax error in generate_test_status.json --- tools/generate_test_status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate_test_status.py b/tools/generate_test_status.py index 13bbaed85..1be5934ef 100644 --- a/tools/generate_test_status.py +++ b/tools/generate_test_status.py @@ -66,7 +66,7 @@ report['hash_short'] = hash_short date = str(datetime.now()).split('.')[0] report['date'] = date -report['id'] = os.path.join(which_gap, "%s-%s", (date.replace(' ','-'), hash_short)) +report['id'] = os.path.join(which_gap, "%s-%s" % (date.replace(' ','-'), hash_short)) # Path root = 'data/reports' From f4dde222820b68f21a19997eb2cff4a5716e4bb8 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 13:38:21 +0200 Subject: [PATCH 057/105] FIX: set directory path as output of step --- .github/workflows/report.yml | 11 ++++++++--- tools/generate_test_status.py | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 69021c7d9..eed6c49b4 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -36,7 +36,12 @@ jobs: - name: "Generate test-status.json" id: test-status - run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") ${{github.event.inputs.which-gap}} + run: | + ROOT='data/reports' + DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") ${{github.event.inputs.which-gap}}) + DIR="${ROOT}/${DIR_REL}" + echo "::set-output name=dir::${DIR}" + echo "::set-output name=dir-rel::${DIR_REL}" - name: "Download latest report" run: | @@ -55,10 +60,10 @@ jobs: - name: "Generate report" id: report run: | - python tools/generate_report.py ${DIR_REL} latest-${{ github.event.inputs.which-gap }} + python tools/generate_report.py ${{ steps.test-status.outputs.dir-rel }} latest-${{ github.event.inputs.which-gap }} - name: "Upload report as artifact" uses: actions/upload-artifact@v2 with: name: "report-${{ github.event.inputs.which-gap }}" - path: "${{ steps.report.outputs.dir }}" + path: "${{ steps.test-status.outputs.dir }}" diff --git a/tools/generate_test_status.py b/tools/generate_test_status.py index 1be5934ef..f8b42e496 100644 --- a/tools/generate_test_status.py +++ b/tools/generate_test_status.py @@ -117,3 +117,5 @@ with open(os.path.join(dir_test_status, 'test-status.json'), 'w') as f: json.dump(report, f, ensure_ascii=False, indent=2) + +print(report['id']) \ No newline at end of file From 98c841bd60d9e42a747cbb5a3bd5003ffa090d90 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 14:03:06 +0200 Subject: [PATCH 058/105] Remove short hash. --- .github/workflows/report.yml | 10 +--------- tools/generate_report.py | 1 - tools/generate_test_status.py | 10 ++++------ 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index eed6c49b4..a3ef758a0 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -9,14 +9,6 @@ on: required: false type: string - workflow_dispatch: - inputs: - which-gap: - description: 'Which Gap version' - default: 'master' - required: false - type: string - jobs: report: name: "Report" @@ -38,7 +30,7 @@ jobs: id: test-status run: | ROOT='data/reports' - DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") ${{github.event.inputs.which-gap}}) + DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{github.event.inputs.which-gap}}) DIR="${ROOT}/${DIR_REL}" echo "::set-output name=dir::${DIR}" echo "::set-output name=dir-rel::${DIR_REL}" diff --git a/tools/generate_report.py b/tools/generate_report.py index 71932b535..85f7b71eb 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -15,7 +15,6 @@ """ This script compares the current test-status.json with a previous version, and generates a main report.md along with a test-status-diff.json. -We assume that the test-status.json contains an id (relative path to root). """ from utils import error diff --git a/tools/generate_test_status.py b/tools/generate_test_status.py index f8b42e496..4ce86275d 100644 --- a/tools/generate_test_status.py +++ b/tools/generate_test_status.py @@ -28,16 +28,15 @@ # Arguments num_args = len(sys.argv) -if num_args > 6: +if num_args > 5: error('Too many arguments') -repo = runID = hash = hash_short = which_gap = 'Unknown' +repo = runID = hash = which_gap = 'Unknown' if num_args > 1: repo = 'https://github.com/'+sys.argv[1] if num_args > 2: runID = sys.argv[2] if num_args > 3: hash = sys.argv[3] -if num_args > 4: hash_short = sys.argv[4] -if num_args > 5: which_gap = sys.argv[5] +if num_args > 4: which_gap = sys.argv[4] ################################################################################ # Collect the job-status of each package from _reports/ @@ -63,10 +62,9 @@ report['repo'] = repo report['workflow'] = repo+'/actions/runs/'+runID report['hash'] = hash -report['hash_short'] = hash_short date = str(datetime.now()).split('.')[0] report['date'] = date -report['id'] = os.path.join(which_gap, "%s-%s" % (date.replace(' ','-'), hash_short)) +report['id'] = os.path.join(which_gap, "%s-%s" % (date.replace(' ','-'), hash[:8])) # Path root = 'data/reports' From a5954fe1ef87989258c601b980479e1a0881231f Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 14:09:56 +0200 Subject: [PATCH 059/105] Final adjustments --- .github/workflows/report.yml | 1 - tools/generate_test_status.py | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index a3ef758a0..66499e302 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -38,7 +38,6 @@ jobs: - name: "Download latest report" run: | ROOT="data/reports" - mkdir -p ${ROOT} DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} DIR_SYM="${ROOT}/${DIR_SYM_REL}" # wget downloads the symbolic link as file! diff --git a/tools/generate_test_status.py b/tools/generate_test_status.py index 4ce86275d..f36da9de1 100644 --- a/tools/generate_test_status.py +++ b/tools/generate_test_status.py @@ -13,7 +13,11 @@ """ This script collects the job-status of each package from _reports/ and generates a main test-status.json. -The file is written into data/reports/{{which_gap}}/{{date}}-{{hash_short}}. + +The file is written into data/reports/{{id}} where +id={{which_gap}}/{{date}}-{{hash_short}}. + +Prints {{id}} to terminal. """ from utils import error, warning @@ -116,4 +120,4 @@ with open(os.path.join(dir_test_status, 'test-status.json'), 'w') as f: json.dump(report, f, ensure_ascii=False, indent=2) -print(report['id']) \ No newline at end of file +print(report['id']) From efae3389d84ede487e6a309fc0b22c7549d4c9e8 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 14:10:55 +0200 Subject: [PATCH 060/105] Update _reports --- _reports/reports-aclib/aclib.json | 2 +- _reports/reports-agt/agt.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_reports/reports-aclib/aclib.json b/_reports/reports-aclib/aclib.json index 3b6681361..b71c4df75 100644 --- a/_reports/reports-aclib/aclib.json +++ b/_reports/reports-aclib/aclib.json @@ -1,4 +1,4 @@ { "status_default": "success", - "status_only_needed": "failure" + "status_only_needed": "success" } diff --git a/_reports/reports-agt/agt.json b/_reports/reports-agt/agt.json index b71c4df75..3b6681361 100644 --- a/_reports/reports-agt/agt.json +++ b/_reports/reports-agt/agt.json @@ -1,4 +1,4 @@ { "status_default": "success", - "status_only_needed": "success" + "status_only_needed": "failure" } From 0108e25dcab0d89b2888be65c723f3ffe3d47ad4 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 14:24:11 +0200 Subject: [PATCH 061/105] Reword some messages --- tools/generate_report.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/generate_report.py b/tools/generate_report.py index 85f7b71eb..bb275304a 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -104,7 +104,7 @@ f.write('*Generated by Workflow:* %s\n\n' % report['workflow']) f.write('In total, %d packages were tested, out of which %d succeeded, %d failed and %d were skipped.\n\n' % (report['total'], report['success'], report['failure'], report['skipped'])) if len(pkgs_changed['failure']) > 0: - f.write(':bangbang: %d packages are failing only on current version. :bangbang:' % len(pkgs_changed['failure'])) + f.write(':bangbang: **Detected package(s) failing only on current version.** :bangbang:\n\n') ############################################################################ # New Packages @@ -129,9 +129,9 @@ ############################################################################ # Changed Status Packages for status, status_msg, status_header in [ - ('failure', 'failed', ':exclamation: Packages now failing'), - ('success', 'succeeded', ':heavy_check_mark: Packages now succeeding'), - ('skipped', 'skipped', ':heavy_multiplication_x: Packages that now skipped')]: + ('failure', 'failed', ':exclamation: :exclamation: Packages now failing'), + ('success', 'succeeded', ':heavy_check_mark: :heavy_check_mark: Packages now succeeding'), + ('skipped', 'skipped', ':heavy_multiplication_x: :heavy_multiplication_x: Packages that now skipped')]: pkgs_filtered = pkgs_changed[status] report_diff[status+'_changed'] = len(pkgs_filtered) From 6460eae0279192eb3506dc4a67cdbe062ad1a8f3 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 18:24:26 +0200 Subject: [PATCH 062/105] Try to detect skips for packages without a testfile. --- .github/workflows/test-all.yml | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 9b86bfaf0..67061401a 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -196,18 +196,9 @@ jobs: for PKG in packages/${{ github.event.inputs.pkg-test-glob || inputs.pkg-test-glob }}/meta.json; do PKG=${PKG%"/meta.json"} PKG=${PKG#"packages/"} - if [[ ${PKG} == anupq ]]; then - break # FIXME: HACK for faster testing, remove before merge - fi - # skip packages without a TestFile - if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then - echo "Skipping ${PKG}" - continue - fi - if [[ ${PKG} == xgap ]]; then - # skip xgap: no X11 headers, and no means to test it - continue - fi + # if [[ ${PKG} == anupq ]]; then + # break # FIXME: HACK for faster testing, remove before merge + # fi MATRIX="${MATRIX}\"${PKG}\"," done MATRIX="${MATRIX}]}" @@ -256,8 +247,23 @@ jobs: echo "No required binary depedencies to be installed" fi + - name: "Check for a TestFile" + id: run-tests + run: | + PKG=${{ matrix.package }} + if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then + # Skip packages without a TestFile + echo "::set-output name=run-tests::false" + elif [[ ${PKG} == xgap ]]; then + # skip xgap: no X11 headers, and no means to test it + echo "::set-output name=run-tests::false" + else + echo "::set-output name=run-tests::true" + fi + - name: "Run tests" timeout-minutes: 10 + if: ${{ steps.run-tests.outputs.run-tests }} == 'true' id: tests-default run: | PKG=${{ matrix.package }} @@ -272,8 +278,8 @@ jobs: - name: "Run tests with OnlyNeeded" timeout-minutes: 10 + if: ${{ steps.run-tests.outputs.run-tests }} == 'true' id: tests-only-needed - if: ${{ always() }} run: | PKG=${{ matrix.package }} gap -A --quitonbreak -r -c " From 6c17178cf3eeb88a33c9457798f699c13dd2fed1 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 13:11:35 +0200 Subject: [PATCH 063/105] Transfer workflow from report.yml into test-all.yml --- .github/workflows/test-all.yml | 77 ++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 67061401a..bce4c1436 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -196,9 +196,9 @@ jobs: for PKG in packages/${{ github.event.inputs.pkg-test-glob || inputs.pkg-test-glob }}/meta.json; do PKG=${PKG%"/meta.json"} PKG=${PKG#"packages/"} - # if [[ ${PKG} == anupq ]]; then - # break # FIXME: HACK for faster testing, remove before merge - # fi + if [[ ${PKG} == autodoc ]]; then + break # FIXME: HACK for faster testing, remove before merge + fi MATRIX="${MATRIX}\"${PKG}\"," done MATRIX="${MATRIX}]}" @@ -218,12 +218,6 @@ jobs: - name: "Install package distribution tools" run: | python -m pip install -r tools/requirements.txt - if [[ ${{ matrix.package }} == polycyclic ]]; then - # HACK FIXME TODO: skip polycyclic for now - echo "SKIPPING polycycylic tests for now, as they run in an infinite (?) loop" - echo "Re-enable them once there is a new polycyclic release" - exit 1 - fi - name: "Download GAP from previous job" uses: actions/download-artifact@v2 @@ -247,23 +241,28 @@ jobs: echo "No required binary depedencies to be installed" fi - - name: "Check for a TestFile" - id: run-tests + - name: "Check if tests should be skipped" + id: checks run: | PKG=${{ matrix.package }} if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then - # Skip packages without a TestFile - echo "::set-output name=run-tests::false" + echo "Skip package without a TestFile" + echo "::set-output name=should-run-tests::false" elif [[ ${PKG} == xgap ]]; then - # skip xgap: no X11 headers, and no means to test it - echo "::set-output name=run-tests::false" + echo "Skip xgap: no X11 headers, and no means to test it" + echo "::set-output name=should-run-tests::false" + elif [[ ${PKG} == polycyclic ]]; then + # HACK FIXME TODO: skip polycyclic for now + echo "Skip polycycylic tests for now, as they run in an infinite (?) loop" + echo "Re-enable them once there is a new polycyclic release" + echo "::set-output name=should-run-tests::false" else - echo "::set-output name=run-tests::true" + echo "::set-output name=should-run-tests::true" fi - name: "Run tests" timeout-minutes: 10 - if: ${{ steps.run-tests.outputs.run-tests }} == 'true' + if: steps.checks.outputs.should-run-tests == 'true' id: tests-default run: | PKG=${{ matrix.package }} @@ -278,7 +277,7 @@ jobs: - name: "Run tests with OnlyNeeded" timeout-minutes: 10 - if: ${{ steps.run-tests.outputs.run-tests }} == 'true' + if: steps.checks.outputs.should-run-tests == 'true' id: tests-only-needed run: | PKG=${{ matrix.package }} @@ -309,7 +308,7 @@ jobs: # https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context # steps..outcome possible values are success, failure, cancelled, or skipped. - name: "Create job status json-file" - if: ${{ always() }} + if: always() run: | PKG="${{ matrix.package }}" STATUS_DEFAULT="${{ steps.tests-default.outcome }}" @@ -318,7 +317,7 @@ jobs: cat ${PKG}.json - name: "Upload job status as artifact" - if: ${{ always() }} + if: always() uses: actions/upload-artifact@v2 with: name: "test-status-${{ matrix.package }}" @@ -327,7 +326,7 @@ jobs: report: name: "Report" needs: test-package - if: ${{ always() }} + if: always() runs-on: ubuntu-latest outputs: test-status: ${{ steps.test-status.outputs.test-status }} @@ -356,4 +355,38 @@ jobs: - name: "Generate test-status.json" id: test-status - run: python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" $(git rev-parse --short "$GITHUB_SHA") + run: | + ROOT='data/reports' + DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{github.event.inputs.which-gap}}) + DIR="${ROOT}/${DIR_REL}" + echo "::set-output name=dir::${DIR}" + echo "::set-output name=dir-rel::${DIR_REL}" + + - name: "Download latest report" + id: download-latest-report + run: | + ROOT="data/reports" + DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} + DIR_SYM="${ROOT}/${DIR_SYM_REL}" + URL_SYM="https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" + if curl --head --fail --silent "${URL_SYM}" 2>/dev/null; then + # wget downloads the symbolic link as file! + wget -O ${DIR_SYM} ${URL_SYM} + DIR=$(cat ${DIR_SYM}) + rm ${DIR_SYM} + ln -s ${DIR} ${DIR_SYM} + DIR=${DIR#/home/runner/work/PackageDistro/PackageDistro/} + URL="https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" + wget -P ${DIR} ${URL} + fi + + - name: "Generate report" + id: report + run: | + python tools/generate_report.py ${{ steps.test-status.outputs.dir-rel }} latest-${{ github.event.inputs.which-gap }} + + - name: "Upload report as artifact" + uses: actions/upload-artifact@v2 + with: + name: "report-${{ github.event.inputs.which-gap }}" + path: "${{ steps.test-status.outputs.dir }}" From 3188f8a32c6c9d18eb49bee887e55091c0b247a3 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 20:00:38 +0200 Subject: [PATCH 064/105] Update `report.yml`. Transfer changes introduced into `test-all.yml`. --- .github/workflows/report.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 66499e302..a8edb7cb1 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -36,17 +36,22 @@ jobs: echo "::set-output name=dir-rel::${DIR_REL}" - name: "Download latest report" + id: download-latest-report run: | ROOT="data/reports" DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} DIR_SYM="${ROOT}/${DIR_SYM_REL}" - # wget downloads the symbolic link as file! - wget -O ${DIR_SYM} "https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" - DIR=$(cat ${DIR_SYM}) - rm ${DIR_SYM} - ln -s ${DIR} ${DIR_SYM} - DIR=${DIR#/home/runner/work/PackageDistro/PackageDistro/} - wget -P ${DIR} "https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" + URL_SYM="https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" + if curl --head --fail --silent "${URL_SYM}" 2>/dev/null; then + # wget downloads the symbolic link as file! + wget -O ${DIR_SYM} ${URL_SYM} + DIR=$(cat ${DIR_SYM}) + rm ${DIR_SYM} + ln -s ${DIR} ${DIR_SYM} + DIR=${DIR#/home/runner/work/PackageDistro/PackageDistro/} + URL="https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" + wget -P ${DIR} ${URL} + fi - name: "Generate report" id: report From e9a86e5e3dd9b38768e8e5dedc8b8a4551c2dd83 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 20:13:39 +0200 Subject: [PATCH 065/105] Add newline if packages are added or removed --- tools/generate_report.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/generate_report.py b/tools/generate_report.py index bb275304a..32cfd4a94 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -116,6 +116,8 @@ status = pkgs[pkg]['status'] f.write('- %s %s : %s
\n' % (pkg, version, status)) + f.write('\n') + ############################################################################ # Removed Packages report_diff['removed'] = len(pkgs_removed) @@ -126,6 +128,8 @@ status = last_pkgs[pkg]['status'] f.write('- %s %s : %s
\n' % (pkg, version, status)) + f.write('\n') + ############################################################################ # Changed Status Packages for status, status_msg, status_header in [ From 1f2dcdbb59d194a21b232f9d20134d29a5eba310 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Mon, 28 Mar 2022 20:16:20 +0200 Subject: [PATCH 066/105] Use more consistent pattern for naming test-status. --- .github/workflows/test-all.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index bce4c1436..1c9e307fc 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -320,7 +320,7 @@ jobs: if: always() uses: actions/upload-artifact@v2 with: - name: "test-status-${{ matrix.package }}" + name: "test-status-${{ github.event.inputs.which-gap }}-${{ matrix.package }}" path: "${{ matrix.package }}.json" report: @@ -340,7 +340,7 @@ jobs: - name: "Download every job status" uses: elonh/download-artifact-regexp@master # FIXME/TODO: Switch to actions/download-artifact once they officially support wildcards, see https://github.com/actions/download-artifact/issues/6 with: - pattern: test-status-* + pattern: test-status-${{ github.event.inputs.which-gap }}-* path: _reports # warning/error in utils.py throw a syntax error with default version of python @@ -357,7 +357,7 @@ jobs: id: test-status run: | ROOT='data/reports' - DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{github.event.inputs.which-gap}}) + DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{ github.event.inputs.which-gap }}) DIR="${ROOT}/${DIR_REL}" echo "::set-output name=dir::${DIR}" echo "::set-output name=dir-rel::${DIR_REL}" From 70cb8e4024d1c75084c5016032d2b944c7a7149e Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 11:39:33 +0200 Subject: [PATCH 067/105] Skip tests before job matrix. --- .github/workflows/test-all.yml | 48 ++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 1c9e307fc..eaf8a8501 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -199,10 +199,34 @@ jobs: if [[ ${PKG} == autodoc ]]; then break # FIXME: HACK for faster testing, remove before merge fi - MATRIX="${MATRIX}\"${PKG}\"," + if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then + echo "Skip package without a TestFile" + SKIPPED="${SKIPPED}\"${PKG}\"," + elif [[ ${PKG} == xgap ]]; then + echo "Skip xgap: no X11 headers, and no means to test it" + SKIPPED="${SKIPPED}\"${PKG}\"," + elif [[ ${PKG} == polycyclic ]]; then + # HACK FIXME TODO: skip polycyclic for now + echo "Skip polycycylic tests for now, as they run in an infinite (?) loop" + echo "Re-enable them once there is a new polycyclic release" + SKIPPED="${SKIPPED}\"${PKG}\"," + else + MATRIX="${MATRIX}\"${PKG}\"," + fi done MATRIX="${MATRIX}]}" echo "::set-output name=matrix::$MATRIX" + mkdir -p test-status-skipped + for PKG in ${SKIPPED}; do + echo "{\"status_skipped\": \"skipped\"}" > test-status-skipped/${PKG}.json + done + + - name: "Upload skipped job status as artifact" + if: always() + uses: actions/upload-artifact@v2 + with: + name: "test-status-${{ github.event.inputs.which-gap }}-skipped" + path: "test-status-skipped/*.json" test-package: name: "${{ matrix.package }}" @@ -241,28 +265,8 @@ jobs: echo "No required binary depedencies to be installed" fi - - name: "Check if tests should be skipped" - id: checks - run: | - PKG=${{ matrix.package }} - if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then - echo "Skip package without a TestFile" - echo "::set-output name=should-run-tests::false" - elif [[ ${PKG} == xgap ]]; then - echo "Skip xgap: no X11 headers, and no means to test it" - echo "::set-output name=should-run-tests::false" - elif [[ ${PKG} == polycyclic ]]; then - # HACK FIXME TODO: skip polycyclic for now - echo "Skip polycycylic tests for now, as they run in an infinite (?) loop" - echo "Re-enable them once there is a new polycyclic release" - echo "::set-output name=should-run-tests::false" - else - echo "::set-output name=should-run-tests::true" - fi - - name: "Run tests" timeout-minutes: 10 - if: steps.checks.outputs.should-run-tests == 'true' id: tests-default run: | PKG=${{ matrix.package }} @@ -277,7 +281,7 @@ jobs: - name: "Run tests with OnlyNeeded" timeout-minutes: 10 - if: steps.checks.outputs.should-run-tests == 'true' + if: always() id: tests-only-needed run: | PKG=${{ matrix.package }} From f21e0bf87d737d31e30ae1f9d63ee37141a38c72 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 12:00:28 +0200 Subject: [PATCH 068/105] Use only `wget` for downloading latest report. Add comments explaining what is happening. --- .github/workflows/test-all.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index eaf8a8501..883f6a692 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -373,8 +373,10 @@ jobs: DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} DIR_SYM="${ROOT}/${DIR_SYM_REL}" URL_SYM="https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" - if curl --head --fail --silent "${URL_SYM}" 2>/dev/null; then - # wget downloads the symbolic link as file! + # Check if file at url exists with curl + if wget -q --method=HEAD "${URL_SYM}"; then + # wget downloads the symbolic link as a plain file, + # so we need to convert this into a real symbolic link. wget -O ${DIR_SYM} ${URL_SYM} DIR=$(cat ${DIR_SYM}) rm ${DIR_SYM} From 88eb636d99e857fe98efec52ac38314c1792c238 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 13:12:45 +0200 Subject: [PATCH 069/105] FIX: skipped packages --- .github/workflows/test-all.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 883f6a692..6d7267e22 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -193,23 +193,24 @@ jobs: id: get-names run: | MATRIX="{\"package\":[" + SKIPPED="" for PKG in packages/${{ github.event.inputs.pkg-test-glob || inputs.pkg-test-glob }}/meta.json; do PKG=${PKG%"/meta.json"} PKG=${PKG#"packages/"} - if [[ ${PKG} == autodoc ]]; then - break # FIXME: HACK for faster testing, remove before merge - fi + # if [[ ${PKG} == autodoc ]]; then + # break # FIXME: HACK for faster testing, remove before merge + # fi if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then echo "Skip package without a TestFile" - SKIPPED="${SKIPPED}\"${PKG}\"," + SKIPPED="${SKIPPED}\"${PKG}\" " elif [[ ${PKG} == xgap ]]; then echo "Skip xgap: no X11 headers, and no means to test it" - SKIPPED="${SKIPPED}\"${PKG}\"," + SKIPPED="${SKIPPED}\"${PKG}\" " elif [[ ${PKG} == polycyclic ]]; then # HACK FIXME TODO: skip polycyclic for now echo "Skip polycycylic tests for now, as they run in an infinite (?) loop" echo "Re-enable them once there is a new polycyclic release" - SKIPPED="${SKIPPED}\"${PKG}\"," + SKIPPED="${SKIPPED}\"${PKG}\" " else MATRIX="${MATRIX}\"${PKG}\"," fi @@ -354,8 +355,7 @@ jobs: python-version: 3.7 - name: "Install package distribution tools" - run: | - python -m pip install -r tools/requirements.txt + run: python -m pip install -r tools/requirements.txt - name: "Generate test-status.json" id: test-status @@ -388,8 +388,7 @@ jobs: - name: "Generate report" id: report - run: | - python tools/generate_report.py ${{ steps.test-status.outputs.dir-rel }} latest-${{ github.event.inputs.which-gap }} + run: python tools/generate_report.py ${{ steps.test-status.outputs.dir-rel }} latest-${{ github.event.inputs.which-gap }} - name: "Upload report as artifact" uses: actions/upload-artifact@v2 From 474b6d5b49329f2aa184762047b0dd993f552d17 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 12:07:36 +0200 Subject: [PATCH 070/105] Refactor code for One-liner runs --- .github/workflows/call-report.yml | 3 +-- .github/workflows/report.yml | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/call-report.yml b/.github/workflows/call-report.yml index cc630c40c..c8bc597b6 100644 --- a/.github/workflows/call-report.yml +++ b/.github/workflows/call-report.yml @@ -30,8 +30,7 @@ jobs: python-version: 3.7 - name: "Install package distribution tools" - run: | - python -m pip install -r tools/requirements.txt + run: python -m pip install -r tools/requirements.txt - name: "Download report" uses: actions/download-artifact@v3 diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index a8edb7cb1..45f479d47 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -23,8 +23,7 @@ jobs: python-version: 3.7 - name: "Install package distribution tools" - run: | - python -m pip install -r tools/requirements.txt + run: python -m pip install -r tools/requirements.txt - name: "Generate test-status.json" id: test-status @@ -55,8 +54,7 @@ jobs: - name: "Generate report" id: report - run: | - python tools/generate_report.py ${{ steps.test-status.outputs.dir-rel }} latest-${{ github.event.inputs.which-gap }} + run: python tools/generate_report.py ${{ steps.test-status.outputs.dir-rel }} latest-${{ github.event.inputs.which-gap }} - name: "Upload report as artifact" uses: actions/upload-artifact@v2 From 38607639e06bf26bd20ad5eccd73c852a58f98e8 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 12:15:15 +0200 Subject: [PATCH 071/105] Try to fix double quotes for skipped packages again --- .github/workflows/test-all.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 6d7267e22..44e11be11 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -202,15 +202,15 @@ jobs: # fi if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then echo "Skip package without a TestFile" - SKIPPED="${SKIPPED}\"${PKG}\" " + SKIPPED="${SKIPPED}${PKG} " elif [[ ${PKG} == xgap ]]; then echo "Skip xgap: no X11 headers, and no means to test it" - SKIPPED="${SKIPPED}\"${PKG}\" " + SKIPPED="${SKIPPED}${PKG} " elif [[ ${PKG} == polycyclic ]]; then # HACK FIXME TODO: skip polycyclic for now echo "Skip polycycylic tests for now, as they run in an infinite (?) loop" echo "Re-enable them once there is a new polycyclic release" - SKIPPED="${SKIPPED}\"${PKG}\" " + SKIPPED="${SKIPPED}${PKG} " else MATRIX="${MATRIX}\"${PKG}\"," fi From 5bfd0dabd0747c05133f9e18d4b00f74d032ede3 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 12:22:35 +0200 Subject: [PATCH 072/105] Adjust comments for download of latest report --- .github/workflows/test-all.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 44e11be11..ae1f23527 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -373,9 +373,12 @@ jobs: DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} DIR_SYM="${ROOT}/${DIR_SYM_REL}" URL_SYM="https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" - # Check if file at url exists with curl + # Check if file at url exists, + # so we do not run into errors for the first run of the script + # (when the first report is created and thus no latest report is available) if wget -q --method=HEAD "${URL_SYM}"; then - # wget downloads the symbolic link as a plain file, + # wget downloads the "symbolic link" as a plain file + # containing as content the path that the symlink points to, # so we need to convert this into a real symbolic link. wget -O ${DIR_SYM} ${URL_SYM} DIR=$(cat ${DIR_SYM}) From 2d9ff4eb5d3571890e5c24adbf37c3eedf7d8a31 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 13:13:21 +0200 Subject: [PATCH 073/105] GAP instead of gap --- .github/workflows/call-report.yml | 2 +- .github/workflows/report.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/call-report.yml b/.github/workflows/call-report.yml index c8bc597b6..5340e53c8 100644 --- a/.github/workflows/call-report.yml +++ b/.github/workflows/call-report.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: which-gap: - description: 'Which Gap version' + description: 'Which GAP version' default: 'master' required: false type: string diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 45f479d47..f6757565f 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: which-gap: - description: 'Which Gap version' + description: 'Which GAP version' default: 'master' required: false type: string From 83e6019cf188f6d7289baa791a858af1b917d154 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 12:26:25 +0200 Subject: [PATCH 074/105] Add comment for DIR_REL --- .github/workflows/test-all.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index ae1f23527..2aec0d82b 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -361,6 +361,7 @@ jobs: id: test-status run: | ROOT='data/reports' + # relative path (with respect to ROOT) to generated test-status.json, i.e. the "id" entry of the json-file. DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{ github.event.inputs.which-gap }}) DIR="${ROOT}/${DIR_REL}" echo "::set-output name=dir::${DIR}" From 19eb54e9f43ea1d77df48ebf0c8466c4205a3272 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 12:35:33 +0200 Subject: [PATCH 075/105] Replace wget header option with --spider --- .github/workflows/test-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 2aec0d82b..043ff970b 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -377,7 +377,7 @@ jobs: # Check if file at url exists, # so we do not run into errors for the first run of the script # (when the first report is created and thus no latest report is available) - if wget -q --method=HEAD "${URL_SYM}"; then + if wget --spider "${URL_SYM}"; then # wget downloads the "symbolic link" as a plain file # containing as content the path that the symlink points to, # so we need to convert this into a real symbolic link. From c3df936f383278ca60a606a510be6d7aed6b90c1 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 12:41:00 +0200 Subject: [PATCH 076/105] Simplify wget command for symlink --- .github/workflows/test-all.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 043ff970b..23cfa3be5 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -381,9 +381,7 @@ jobs: # wget downloads the "symbolic link" as a plain file # containing as content the path that the symlink points to, # so we need to convert this into a real symbolic link. - wget -O ${DIR_SYM} ${URL_SYM} - DIR=$(cat ${DIR_SYM}) - rm ${DIR_SYM} + DIR=$(wget -O - ${URL_SYM}) ln -s ${DIR} ${DIR_SYM} DIR=${DIR#/home/runner/work/PackageDistro/PackageDistro/} URL="https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" From 48ff1809fe8a4505b6de6c96a7da7c05b3b7dd7e Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 12:41:20 +0200 Subject: [PATCH 077/105] Try to remove specified python version --- .github/workflows/test-all.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 23cfa3be5..304b4de6b 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -348,12 +348,6 @@ jobs: pattern: test-status-${{ github.event.inputs.which-gap }}-* path: _reports - # warning/error in utils.py throw a syntax error with default version of python - - name: "Set up Python 3.7" - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - name: "Install package distribution tools" run: python -m pip install -r tools/requirements.txt From f7344c9e12d2c983ecfdd6aaaab895adb684fdd2 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 13:00:58 +0200 Subject: [PATCH 078/105] Update debugging-workflows --- .github/workflows/call-report.yml | 6 ------ .github/workflows/report.yml | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/call-report.yml b/.github/workflows/call-report.yml index 5340e53c8..e8124482d 100644 --- a/.github/workflows/call-report.yml +++ b/.github/workflows/call-report.yml @@ -23,12 +23,6 @@ jobs: steps: - uses: actions/checkout@v2 - # warning/error in utils.py throw a syntax error with default version of python - - name: "Set up Python 3.7" - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - name: "Install package distribution tools" run: python -m pip install -r tools/requirements.txt diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index f6757565f..1665a687b 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -17,11 +17,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: "Set up Python 3.7" - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - name: "Install package distribution tools" run: python -m pip install -r tools/requirements.txt @@ -29,7 +24,8 @@ jobs: id: test-status run: | ROOT='data/reports' - DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{github.event.inputs.which-gap}}) + # relative path (with respect to ROOT) to generated test-status.json, i.e. the "id" entry of the json-file. + DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{ github.event.inputs.which-gap }}) DIR="${ROOT}/${DIR_REL}" echo "::set-output name=dir::${DIR}" echo "::set-output name=dir-rel::${DIR_REL}" @@ -41,11 +37,14 @@ jobs: DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} DIR_SYM="${ROOT}/${DIR_SYM_REL}" URL_SYM="https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" - if curl --head --fail --silent "${URL_SYM}" 2>/dev/null; then - # wget downloads the symbolic link as file! - wget -O ${DIR_SYM} ${URL_SYM} - DIR=$(cat ${DIR_SYM}) - rm ${DIR_SYM} + # Check if file at url exists, + # so we do not run into errors for the first run of the script + # (when the first report is created and thus no latest report is available) + if wget --spider "${URL_SYM}"; then + # wget downloads the "symbolic link" as a plain file + # containing as content the path that the symlink points to, + # so we need to convert this into a real symbolic link. + DIR=$(wget -O - ${URL_SYM}) ln -s ${DIR} ${DIR_SYM} DIR=${DIR#/home/runner/work/PackageDistro/PackageDistro/} URL="https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" From f2e9cff1ad6de3d41791a85aa46af887d71ff8a7 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 13:15:06 +0200 Subject: [PATCH 079/105] Adjust comment --- .github/workflows/test-all.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 304b4de6b..99e44d722 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -197,9 +197,9 @@ jobs: for PKG in packages/${{ github.event.inputs.pkg-test-glob || inputs.pkg-test-glob }}/meta.json; do PKG=${PKG%"/meta.json"} PKG=${PKG#"packages/"} - # if [[ ${PKG} == autodoc ]]; then - # break # FIXME: HACK for faster testing, remove before merge - # fi + if [[ ${PKG} == autodoc ]]; then + break # HACK FIXME TODO: faster tests, remove before merge + fi if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then echo "Skip package without a TestFile" SKIPPED="${SKIPPED}${PKG} " From 0089e144c4bc973c117e5d4852a633750a8f2102 Mon Sep 17 00:00:00 2001 From: Friedrich Rober <37139927+FriedrichRober@users.noreply.github.com> Date: Wed, 30 Mar 2022 13:35:11 +0200 Subject: [PATCH 080/105] Add example badge for test suite to README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index e6c577cf2..fc52cbe7d 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,11 @@ contains the metadata of all the GAP packages in the distribution. We also upload snapshots the package distribution tarballs to appropriate release tags on this repository. +## High-level status dashboard + +| Test | GAP master | +|:---------------:|:----------:| +| Released packages | [![Tests](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/FriedrichRober/PackageDistro/data/badges/latest-master/badge.json)](https://FriedrichRober.github.io/PackageDistro/latest-master/redirect.html) | ## Metadata From c19577018f5de7d72b08e0c68a9d1fb3614ad36f Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 13:37:31 +0200 Subject: [PATCH 081/105] Try to write relative path into symlink instead of absolute --- .github/workflows/report.yml | 1 - .github/workflows/test-all.yml | 1 - tools/generate_report.py | 2 +- tools/update_latest_report.py | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 1665a687b..639fef303 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -46,7 +46,6 @@ jobs: # so we need to convert this into a real symbolic link. DIR=$(wget -O - ${URL_SYM}) ln -s ${DIR} ${DIR_SYM} - DIR=${DIR#/home/runner/work/PackageDistro/PackageDistro/} URL="https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" wget -P ${DIR} ${URL} fi diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 99e44d722..d0f721d63 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -377,7 +377,6 @@ jobs: # so we need to convert this into a real symbolic link. DIR=$(wget -O - ${URL_SYM}) ln -s ${DIR} ${DIR_SYM} - DIR=${DIR#/home/runner/work/PackageDistro/PackageDistro/} URL="https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" wget -P ${DIR} ${URL} fi diff --git a/tools/generate_report.py b/tools/generate_report.py index 32cfd4a94..63327ab56 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -38,7 +38,7 @@ if num_args > 1: dir_report_rel = sys.argv[1] if num_args > 2: dir_last_report_rel = sys.argv[2] -dir_report = os.path.realpath(os.path.join(root, dir_report_rel)) +dir_report = os.path.join(root, dir_report_rel) dir_last_report_symbolic = os.path.join(root, dir_last_report_rel) dir_last_report = os.path.realpath(dir_last_report_symbolic) diff --git a/tools/update_latest_report.py b/tools/update_latest_report.py index 73d9fd245..df6c9a56a 100644 --- a/tools/update_latest_report.py +++ b/tools/update_latest_report.py @@ -38,7 +38,7 @@ if num_args > 1: dir_report_rel = sys.argv[1] if num_args > 2: dir_last_report_rel = sys.argv[2] -dir_report = os.path.realpath(os.path.join(root, dir_report_rel)) +dir_report = os.path.join(root, dir_report_rel) dir_last_report_symbolic = os.path.join(root, dir_last_report_rel) report_path = os.path.join(dir_report, 'test-status.json') From 3c5f5fda7edbd7477cd0c2671db8c37d603fdc83 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 14:02:26 +0200 Subject: [PATCH 082/105] Fix wrong relative path for symbolic link --- tools/update_latest_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/update_latest_report.py b/tools/update_latest_report.py index df6c9a56a..af4c376b3 100644 --- a/tools/update_latest_report.py +++ b/tools/update_latest_report.py @@ -58,7 +58,7 @@ ################################################################################ # Update symlink -symlink(dir_report, dir_last_report_symbolic, overwrite=True) +symlink(dir_report_rel, dir_last_report_symbolic, overwrite=True) ############################################################################ # Generate html redirect From 58979296f75792c1b19e8f9ee60839a29623fa0b Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 14:05:20 +0200 Subject: [PATCH 083/105] Add empty line at end of json file --- tools/generate_report.py | 1 + tools/generate_test_status.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/generate_report.py b/tools/generate_report.py index 63327ab56..f759adddd 100644 --- a/tools/generate_report.py +++ b/tools/generate_report.py @@ -171,3 +171,4 @@ # Write test-status-diff.json with open(dir_report+'/test-status-diff.json', 'w') as f: json.dump(report_diff, f, ensure_ascii=False, indent=2) + f.write("\n") diff --git a/tools/generate_test_status.py b/tools/generate_test_status.py index f36da9de1..11fb9fd08 100644 --- a/tools/generate_test_status.py +++ b/tools/generate_test_status.py @@ -119,5 +119,6 @@ with open(os.path.join(dir_test_status, 'test-status.json'), 'w') as f: json.dump(report, f, ensure_ascii=False, indent=2) + f.write("\n") print(report['id']) From 74c71cfccf99b5d4472ad07cf3eecf9a74f4b8c9 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 14:07:44 +0200 Subject: [PATCH 084/105] Fix wrong download with relative/absolute path confusion --- .github/workflows/report.yml | 5 +++-- .github/workflows/test-all.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 639fef303..62438d436 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -44,8 +44,9 @@ jobs: # wget downloads the "symbolic link" as a plain file # containing as content the path that the symlink points to, # so we need to convert this into a real symbolic link. - DIR=$(wget -O - ${URL_SYM}) - ln -s ${DIR} ${DIR_SYM} + DIR_REL=$(wget -O - ${URL_SYM}) + DIR="${ROOT}/${DIR_REL}" + ln -s ${DIR_REL} ${DIR_SYM} URL="https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" wget -P ${DIR} ${URL} fi diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index d0f721d63..65e96fbcb 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -375,8 +375,9 @@ jobs: # wget downloads the "symbolic link" as a plain file # containing as content the path that the symlink points to, # so we need to convert this into a real symbolic link. - DIR=$(wget -O - ${URL_SYM}) - ln -s ${DIR} ${DIR_SYM} + DIR_REL=$(wget -O - ${URL_SYM}) + DIR="${ROOT}/${DIR_REL}" + ln -s ${DIR_REL} ${DIR_SYM} URL="https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" wget -P ${DIR} ${URL} fi From 0df3c88d69ced13486cc0557e050195bd9ddc6e6 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 14:44:50 +0200 Subject: [PATCH 085/105] Add link to shield.io --- tools/update_latest_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/update_latest_report.py b/tools/update_latest_report.py index af4c376b3..8db303e28 100644 --- a/tools/update_latest_report.py +++ b/tools/update_latest_report.py @@ -72,7 +72,7 @@ ''' % (repo+'/blob/'+dir_report+'/report.md', repo+'/'+dir_report+'/report.md')) ############################################################################ -# Generate badge +# Generate badge, see https://shields.io/endpoint relativeFailures = 1 - report['success'] / report['total'] if relativeFailures > 0.05: color = 'critical' From a74087cda5d0621730bff4c48f712f98b07f76f6 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 14:55:47 +0200 Subject: [PATCH 086/105] Adjust which-gap --- .github/workflows/call-report.yml | 6 +++--- .github/workflows/test-all.yml | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/call-report.yml b/.github/workflows/call-report.yml index e8124482d..4e721f8e9 100644 --- a/.github/workflows/call-report.yml +++ b/.github/workflows/call-report.yml @@ -14,7 +14,7 @@ jobs: name: "Call report.yml" uses: ./.github/workflows/report.yml with: - which-gap: ${{ github.event.inputs.which-gap }} + which-gap: ${{ github.event.inputs.which-gap || inputs.which-gap }} update-latest: name: "Upload report" @@ -29,7 +29,7 @@ jobs: - name: "Download report" uses: actions/download-artifact@v3 with: - name: report-${{ github.event.inputs.which-gap }} + name: report-${{ github.event.inputs.which-gap || inputs.which-gap }} path: _report - name: "Create data and gh-pages worktree" @@ -48,7 +48,7 @@ jobs: DIR="${ROOT}/${DIR_REL}" mkdir -p ${DIR} mv _report/* ${DIR} - python tools/update_latest_report.py ${DIR_REL} latest-${{ github.event.inputs.which-gap }} + python tools/update_latest_report.py ${DIR_REL} latest-${{ github.event.inputs.which-gap || inputs.which-gap }} - name: "Push report" id: push-report diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 65e96fbcb..6de7a8849 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -226,7 +226,7 @@ jobs: if: always() uses: actions/upload-artifact@v2 with: - name: "test-status-${{ github.event.inputs.which-gap }}-skipped" + name: "test-status-${{ github.event.inputs.which-gap || inputs.which-gap }}-skipped" path: "test-status-skipped/*.json" test-package: @@ -325,7 +325,7 @@ jobs: if: always() uses: actions/upload-artifact@v2 with: - name: "test-status-${{ github.event.inputs.which-gap }}-${{ matrix.package }}" + name: "test-status-${{ github.event.inputs.which-gap || inputs.which-gap }}-${{ matrix.package }}" path: "${{ matrix.package }}.json" report: @@ -345,7 +345,7 @@ jobs: - name: "Download every job status" uses: elonh/download-artifact-regexp@master # FIXME/TODO: Switch to actions/download-artifact once they officially support wildcards, see https://github.com/actions/download-artifact/issues/6 with: - pattern: test-status-${{ github.event.inputs.which-gap }}-* + pattern: test-status-${{ github.event.inputs.which-gap || inputs.which-gap }}-* path: _reports - name: "Install package distribution tools" @@ -356,7 +356,7 @@ jobs: run: | ROOT='data/reports' # relative path (with respect to ROOT) to generated test-status.json, i.e. the "id" entry of the json-file. - DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{ github.event.inputs.which-gap }}) + DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{ github.event.inputs.which-gap || inputs.which-gap }}) DIR="${ROOT}/${DIR_REL}" echo "::set-output name=dir::${DIR}" echo "::set-output name=dir-rel::${DIR_REL}" @@ -365,7 +365,7 @@ jobs: id: download-latest-report run: | ROOT="data/reports" - DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} + DIR_SYM_REL=latest-${{ github.event.inputs.which-gap || inputs.which-gap }} DIR_SYM="${ROOT}/${DIR_SYM_REL}" URL_SYM="https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" # Check if file at url exists, @@ -384,10 +384,10 @@ jobs: - name: "Generate report" id: report - run: python tools/generate_report.py ${{ steps.test-status.outputs.dir-rel }} latest-${{ github.event.inputs.which-gap }} + run: python tools/generate_report.py ${{ steps.test-status.outputs.dir-rel }} latest-${{ github.event.inputs.which-gap || inputs.which-gap }} - name: "Upload report as artifact" uses: actions/upload-artifact@v2 with: - name: "report-${{ github.event.inputs.which-gap }}" + name: "report-${{ github.event.inputs.which-gap || inputs.which-gap }}" path: "${{ steps.test-status.outputs.dir }}" From a1745773dc6e24f79ccc40c7f175ac7050f7d376 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 15:03:58 +0200 Subject: [PATCH 087/105] Add more inputs to report-caller.yml --- .github/workflows/call-report.yml | 33 +++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/call-report.yml b/.github/workflows/call-report.yml index 4e721f8e9..d99a6d898 100644 --- a/.github/workflows/call-report.yml +++ b/.github/workflows/call-report.yml @@ -4,10 +4,37 @@ on: workflow_dispatch: inputs: which-gap: - description: 'Which GAP version' - default: 'master' + description: 'Either a GAP branch name or a GAP version' + required: true + type: string + default: master # or 4.11.1 or ... + pkg-build-glob: + description: 'Only build packages matching the given glob' + required: false + type: string + default: "*" + pkg-test-glob: + description: 'Only test packages matching the given glob' + required: false + type: string + default: "*" + workflow_call: + inputs: + which-gap: + description: 'Either a GAP branch name or a GAP version' + required: true + type: string + default: master # or 4.11.1 or ... + pkg-build-glob: + description: 'Only build packages matching the given glob' + required: false + type: string + default: "*" + pkg-test-glob: + description: 'Only test packages matching the given glob' required: false type: string + default: "*" jobs: call-report: @@ -15,6 +42,8 @@ jobs: uses: ./.github/workflows/report.yml with: which-gap: ${{ github.event.inputs.which-gap || inputs.which-gap }} + pkg-build-glob: ${{github.event.inputs.pkg-build-glob || inputs.pkg-build-glob}} + pkg-test-glob: ${{github.event.inputs.pkg-test-glob || inputs.pkg-test-glob}} update-latest: name: "Upload report" From e4f13758e0d0ab0d6a4b6963e54f84c255273047 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 15:04:38 +0200 Subject: [PATCH 088/105] Add more inputs to report.yml --- .github/workflows/report.yml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index 62438d436..11744705e 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -1,13 +1,40 @@ name: "Test generation of comparison reports" on: + workflow_dispatch: + inputs: + which-gap: + description: 'Either a GAP branch name or a GAP version' + required: true + type: string + default: master # or 4.11.1 or ... + pkg-build-glob: + description: 'Only build packages matching the given glob' + required: false + type: string + default: "*" + pkg-test-glob: + description: 'Only test packages matching the given glob' + required: false + type: string + default: "*" workflow_call: inputs: which-gap: - description: 'Which GAP version' - default: 'master' + description: 'Either a GAP branch name or a GAP version' + required: true + type: string + default: master # or 4.11.1 or ... + pkg-build-glob: + description: 'Only build packages matching the given glob' + required: false + type: string + default: "*" + pkg-test-glob: + description: 'Only test packages matching the given glob' required: false type: string + default: "*" jobs: report: From 5cb1e8b1640cc70b6b9a93b771dd4bd6559fd0a4 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 15:12:48 +0200 Subject: [PATCH 089/105] Try to fix startup failure --- .github/workflows/call-report.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/call-report.yml b/.github/workflows/call-report.yml index d99a6d898..d13ad0728 100644 --- a/.github/workflows/call-report.yml +++ b/.github/workflows/call-report.yml @@ -42,8 +42,8 @@ jobs: uses: ./.github/workflows/report.yml with: which-gap: ${{ github.event.inputs.which-gap || inputs.which-gap }} - pkg-build-glob: ${{github.event.inputs.pkg-build-glob || inputs.pkg-build-glob}} - pkg-test-glob: ${{github.event.inputs.pkg-test-glob || inputs.pkg-test-glob}} + pkg-build-glob: ${{ github.event.inputs.pkg-build-glob || inputs.pkg-build-glob }} + pkg-test-glob: ${{ github.event.inputs.pkg-test-glob || inputs.pkg-test-glob }} update-latest: name: "Upload report" From 9e72ccee96f41c169d1145c03f0be01bb561cb52 Mon Sep 17 00:00:00 2001 From: Friedrich Rober <37139927+FriedrichRober@users.noreply.github.com> Date: Wed, 30 Mar 2022 15:43:28 +0200 Subject: [PATCH 090/105] Apply suggestions from code review Co-authored-by: Max Horn --- .github/workflows/test-all.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 6de7a8849..a784533e6 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -201,14 +201,14 @@ jobs: break # HACK FIXME TODO: faster tests, remove before merge fi if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then - echo "Skip package without a TestFile" + echo "Skip ${PKG}: no TestFile" SKIPPED="${SKIPPED}${PKG} " elif [[ ${PKG} == xgap ]]; then echo "Skip xgap: no X11 headers, and no means to test it" SKIPPED="${SKIPPED}${PKG} " elif [[ ${PKG} == polycyclic ]]; then # HACK FIXME TODO: skip polycyclic for now - echo "Skip polycycylic tests for now, as they run in an infinite (?) loop" + echo "Skip polycyclic tests for now, as they run in an infinite (?) loop" echo "Re-enable them once there is a new polycyclic release" SKIPPED="${SKIPPED}${PKG} " else From d263b33e0de6554899cc8d88bdb7d11dd428197a Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 15:45:39 +0200 Subject: [PATCH 091/105] Clean up. - Add GAP Package Distribution Bot as commiter - Remove `report.yml` - Remove _reports/ - Rename call-report -> update-latest-report --- .github/workflows/report.yml | 89 ------------------- .github/workflows/test-all.yml | 2 +- ...ll-report.yml => update-latest-report.yml} | 36 ++------ _reports/reports-ace/ace.json | 4 - _reports/reports-aclib/aclib.json | 4 - _reports/reports-agt/agt.json | 4 - 6 files changed, 8 insertions(+), 131 deletions(-) delete mode 100644 .github/workflows/report.yml rename .github/workflows/{call-report.yml => update-latest-report.yml} (64%) delete mode 100644 _reports/reports-ace/ace.json delete mode 100644 _reports/reports-aclib/aclib.json delete mode 100644 _reports/reports-agt/agt.json diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml deleted file mode 100644 index 11744705e..000000000 --- a/.github/workflows/report.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: "Test generation of comparison reports" - -on: - workflow_dispatch: - inputs: - which-gap: - description: 'Either a GAP branch name or a GAP version' - required: true - type: string - default: master # or 4.11.1 or ... - pkg-build-glob: - description: 'Only build packages matching the given glob' - required: false - type: string - default: "*" - pkg-test-glob: - description: 'Only test packages matching the given glob' - required: false - type: string - default: "*" - workflow_call: - inputs: - which-gap: - description: 'Either a GAP branch name or a GAP version' - required: true - type: string - default: master # or 4.11.1 or ... - pkg-build-glob: - description: 'Only build packages matching the given glob' - required: false - type: string - default: "*" - pkg-test-glob: - description: 'Only test packages matching the given glob' - required: false - type: string - default: "*" - -jobs: - report: - name: "Report" - runs-on: ubuntu-latest - if: ${{ always() }} - steps: - - uses: actions/checkout@v2 - - - name: "Install package distribution tools" - run: python -m pip install -r tools/requirements.txt - - - name: "Generate test-status.json" - id: test-status - run: | - ROOT='data/reports' - # relative path (with respect to ROOT) to generated test-status.json, i.e. the "id" entry of the json-file. - DIR_REL=$(python tools/generate_test_status.py ${{ github.repository }} "$GITHUB_RUN_ID" "$GITHUB_SHA" ${{ github.event.inputs.which-gap }}) - DIR="${ROOT}/${DIR_REL}" - echo "::set-output name=dir::${DIR}" - echo "::set-output name=dir-rel::${DIR_REL}" - - - name: "Download latest report" - id: download-latest-report - run: | - ROOT="data/reports" - DIR_SYM_REL=latest-${{ github.event.inputs.which-gap }} - DIR_SYM="${ROOT}/${DIR_SYM_REL}" - URL_SYM="https://raw.githubusercontent.com/${{ github.repository }}/${DIR_SYM}" - # Check if file at url exists, - # so we do not run into errors for the first run of the script - # (when the first report is created and thus no latest report is available) - if wget --spider "${URL_SYM}"; then - # wget downloads the "symbolic link" as a plain file - # containing as content the path that the symlink points to, - # so we need to convert this into a real symbolic link. - DIR_REL=$(wget -O - ${URL_SYM}) - DIR="${ROOT}/${DIR_REL}" - ln -s ${DIR_REL} ${DIR_SYM} - URL="https://raw.githubusercontent.com/${{ github.repository }}/${DIR}/test-status.json" - wget -P ${DIR} ${URL} - fi - - - name: "Generate report" - id: report - run: python tools/generate_report.py ${{ steps.test-status.outputs.dir-rel }} latest-${{ github.event.inputs.which-gap }} - - - name: "Upload report as artifact" - uses: actions/upload-artifact@v2 - with: - name: "report-${{ github.event.inputs.which-gap }}" - path: "${{ steps.test-status.outputs.dir }}" diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index a784533e6..37b859930 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -8,7 +8,7 @@ # test results are aggregated into a JSON file which other workflows can # process. # -name: "Test packages" +name: "Test packages and generate report" on: workflow_dispatch: diff --git a/.github/workflows/call-report.yml b/.github/workflows/update-latest-report.yml similarity index 64% rename from .github/workflows/call-report.yml rename to .github/workflows/update-latest-report.yml index d13ad0728..34c9c66cc 100644 --- a/.github/workflows/call-report.yml +++ b/.github/workflows/update-latest-report.yml @@ -1,4 +1,4 @@ -name: "Test calling report.yml" +name: "Update Latest Report" on: workflow_dispatch: @@ -8,16 +8,6 @@ on: required: true type: string default: master # or 4.11.1 or ... - pkg-build-glob: - description: 'Only build packages matching the given glob' - required: false - type: string - default: "*" - pkg-test-glob: - description: 'Only test packages matching the given glob' - required: false - type: string - default: "*" workflow_call: inputs: which-gap: @@ -25,30 +15,18 @@ on: required: true type: string default: master # or 4.11.1 or ... - pkg-build-glob: - description: 'Only build packages matching the given glob' - required: false - type: string - default: "*" - pkg-test-glob: - description: 'Only test packages matching the given glob' - required: false - type: string - default: "*" jobs: - call-report: - name: "Call report.yml" - uses: ./.github/workflows/report.yml + test-all: + name: "Test packages and generate report" + uses: ./.github/workflows/test-all.yml with: which-gap: ${{ github.event.inputs.which-gap || inputs.which-gap }} - pkg-build-glob: ${{ github.event.inputs.pkg-build-glob || inputs.pkg-build-glob }} - pkg-test-glob: ${{ github.event.inputs.pkg-test-glob || inputs.pkg-test-glob }} update-latest: name: "Upload report" runs-on: ubuntu-latest - needs: call-report + needs: test-all steps: - uses: actions/checkout@v2 @@ -82,8 +60,8 @@ jobs: - name: "Push report" id: push-report run: | - git config --global user.name 'github-actions' - git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + git config --global user.name 'GAP Package Distribution Bot' + git config --global user.email 'support@gap-system.org' cd data git add -A git commit -m "Automated report" diff --git a/_reports/reports-ace/ace.json b/_reports/reports-ace/ace.json deleted file mode 100644 index d1e342b7e..000000000 --- a/_reports/reports-ace/ace.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status_default": "failure", - "status_only_needed": "success" -} diff --git a/_reports/reports-aclib/aclib.json b/_reports/reports-aclib/aclib.json deleted file mode 100644 index b71c4df75..000000000 --- a/_reports/reports-aclib/aclib.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status_default": "success", - "status_only_needed": "success" -} diff --git a/_reports/reports-agt/agt.json b/_reports/reports-agt/agt.json deleted file mode 100644 index 3b6681361..000000000 --- a/_reports/reports-agt/agt.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status_default": "success", - "status_only_needed": "failure" -} From 9a37de22e245b99f3a67b49a5cc69a006047c8a5 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 16:15:34 +0200 Subject: [PATCH 092/105] Update descriptions for workflows --- .github/workflows/test-all.yml | 9 ++++++--- .github/workflows/update-latest-report.yml | 13 +++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 37b859930..59b3723ad 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -4,9 +4,12 @@ # # It builds a version of GAP (which one depends on its inputs), then builds # all packages (resp. all matching some glob), then runs the tests of all -# packages (resp. all matching some glob) with a testfile. Finally the various -# test results are aggregated into a JSON file which other workflows can -# process. +# packages (resp. all matching some glob) with a testfile. The various +# test results are aggregated into a test-status JSON file and is uploaded +# as an artifact. Finally, the test results are compared against the latest +# "official" test run. A human-readable comparison report is generated as a +# MARKDOWN file and a summary of the changes as a test-status-diff JSON file +# which other workflows can process. Both files are uploaded as artifacts. # name: "Test packages and generate report" diff --git a/.github/workflows/update-latest-report.yml b/.github/workflows/update-latest-report.yml index 34c9c66cc..49dc8b869 100644 --- a/.github/workflows/update-latest-report.yml +++ b/.github/workflows/update-latest-report.yml @@ -1,3 +1,16 @@ +# +# This workflow is run either by a manual workflow dispatch, or +# as part of a daily build. +# +# It runs the test suite for all packages and generates a package +# evaluation report by calling the test-all YML file. +# The report is uploaded to the data branch on the repository +# and the symlink pointing to the latest report is updated there. +# In addition, the badge for the latest workflow is generated and +# is uploaded to the data branch as well. Finally, the html +# redirect pointing to the latest report is updated and uploaded +# to the gh-pages branch on the repository. +# name: "Update Latest Report" on: From a2cb6a7859f004ffdfd10af51616ee9db6b9db2b Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 16:20:54 +0200 Subject: [PATCH 093/105] New name for update-latest-report.yml --- .github/workflows/update-latest-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-latest-report.yml b/.github/workflows/update-latest-report.yml index 49dc8b869..dea0c144f 100644 --- a/.github/workflows/update-latest-report.yml +++ b/.github/workflows/update-latest-report.yml @@ -11,7 +11,7 @@ # redirect pointing to the latest report is updated and uploaded # to the gh-pages branch on the repository. # -name: "Update Latest Report" +name: "Update latest package evaluation report" on: workflow_dispatch: From d348402121d5efeee43e6ee328e7af11a4878a7f Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 17:16:16 +0200 Subject: [PATCH 094/105] Adjust workflow caller logic --- .../test-all-and-update-latest-report.yml | 24 +++++++++++++++++++ .github/workflows/update-latest-report.yml | 18 ++------------ 2 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/test-all-and-update-latest-report.yml diff --git a/.github/workflows/test-all-and-update-latest-report.yml b/.github/workflows/test-all-and-update-latest-report.yml new file mode 100644 index 000000000..9a591c006 --- /dev/null +++ b/.github/workflows/test-all-and-update-latest-report.yml @@ -0,0 +1,24 @@ +name: "Test packages and update latest report" + +on: + workflow_dispatch: + inputs: + which-gap: + description: 'Either a GAP branch name or a GAP version' + required: true + type: string + default: master # or 4.11.1 or ... + +jobs: + test-all: + name: "Test packages and generate report" + uses: ./.github/workflows/test-all.yml + with: + which-gap: ${{ github.event.inputs.which-gap }} + + update-latest: + name: "Upload report" + needs: test-all + uses: ./.github/workflows/update-latest-report.yml + with: + which-gap: ${{ github.event.inputs.which-gap }} diff --git a/.github/workflows/update-latest-report.yml b/.github/workflows/update-latest-report.yml index dea0c144f..ad5991cc5 100644 --- a/.github/workflows/update-latest-report.yml +++ b/.github/workflows/update-latest-report.yml @@ -2,8 +2,8 @@ # This workflow is run either by a manual workflow dispatch, or # as part of a daily build. # -# It runs the test suite for all packages and generates a package -# evaluation report by calling the test-all YML file. +# We assume that we have run the test suite for all packages and +# generated a report by calling the test-all YML file beforehand. # The report is uploaded to the data branch on the repository # and the symlink pointing to the latest report is updated there. # In addition, the badge for the latest workflow is generated and @@ -14,13 +14,6 @@ name: "Update latest package evaluation report" on: - workflow_dispatch: - inputs: - which-gap: - description: 'Either a GAP branch name or a GAP version' - required: true - type: string - default: master # or 4.11.1 or ... workflow_call: inputs: which-gap: @@ -30,16 +23,9 @@ on: default: master # or 4.11.1 or ... jobs: - test-all: - name: "Test packages and generate report" - uses: ./.github/workflows/test-all.yml - with: - which-gap: ${{ github.event.inputs.which-gap || inputs.which-gap }} - update-latest: name: "Upload report" runs-on: ubuntu-latest - needs: test-all steps: - uses: actions/checkout@v2 From 954223788084943742a3361b604f30f0fc2b25a3 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 17:38:13 +0200 Subject: [PATCH 095/105] Faster tests --- .github/workflows/test-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 59b3723ad..650148b2b 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -200,7 +200,7 @@ jobs: for PKG in packages/${{ github.event.inputs.pkg-test-glob || inputs.pkg-test-glob }}/meta.json; do PKG=${PKG%"/meta.json"} PKG=${PKG#"packages/"} - if [[ ${PKG} == autodoc ]]; then + if [[ ${PKG} == alnuth ]]; then break # HACK FIXME TODO: faster tests, remove before merge fi if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then From 7f5d7704774b2cf6c252b10d846b9175bfd5b512 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 17:55:23 +0200 Subject: [PATCH 096/105] FIX: Gap Package Distribution Bot --- .github/workflows/scan-for-updates.yml | 3 ++- .github/workflows/update-latest-report.yml | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scan-for-updates.yml b/.github/workflows/scan-for-updates.yml index 337e6b250..5a5c5458c 100644 --- a/.github/workflows/scan-for-updates.yml +++ b/.github/workflows/scan-for-updates.yml @@ -117,7 +117,8 @@ jobs: - uses: peter-evans/create-pull-request@v3 with: token: ${{ steps.generate-token.outputs.token }} - author: "GAP Package Distribution Bot " + # https://api.github.com/users/gap-package-distribution-bot%5Bbot%5D + author: "gap-package-distribution-bot <100730870+gap-package-distribution-bot[bot]@users.noreply.github.com>" add-paths: packages/${{ matrix.package }} commit-message: "[${{ matrix.package }}] Update to ${{ env.PKG_VERSION }}" body: "" diff --git a/.github/workflows/update-latest-report.yml b/.github/workflows/update-latest-report.yml index ad5991cc5..d634dd900 100644 --- a/.github/workflows/update-latest-report.yml +++ b/.github/workflows/update-latest-report.yml @@ -59,8 +59,9 @@ jobs: - name: "Push report" id: push-report run: | - git config --global user.name 'GAP Package Distribution Bot' - git config --global user.email 'support@gap-system.org' + git config --global user.name 'gap-package-distribution-bot' + # https://api.github.com/users/gap-package-distribution-bot%5Bbot%5D + git config --global user.email '100730870+gap-package-distribution-bot[bot]@users.noreply.github.com' cd data git add -A git commit -m "Automated report" From 329d331908cda3849098ec737381be950ce42a65 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 19:06:45 +0200 Subject: [PATCH 097/105] Remove hack for faster tests --- .github/workflows/test-all.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 650148b2b..8b18b4b82 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -200,9 +200,6 @@ jobs: for PKG in packages/${{ github.event.inputs.pkg-test-glob || inputs.pkg-test-glob }}/meta.json; do PKG=${PKG%"/meta.json"} PKG=${PKG#"packages/"} - if [[ ${PKG} == alnuth ]]; then - break # HACK FIXME TODO: faster tests, remove before merge - fi if ! jq -e -r '.TestFile' < packages/${PKG}/meta.json > /dev/null ; then echo "Skip ${PKG}: no TestFile" SKIPPED="${SKIPPED}${PKG} " From c501f5eec4f65e0086cc3541bb25caf0dc792614 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 19:14:18 +0200 Subject: [PATCH 098/105] More stable push --- .github/workflows/update-latest-report.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-latest-report.yml b/.github/workflows/update-latest-report.yml index d634dd900..55afc3e03 100644 --- a/.github/workflows/update-latest-report.yml +++ b/.github/workflows/update-latest-report.yml @@ -65,8 +65,8 @@ jobs: cd data git add -A git commit -m "Automated report" - git push + git pull --rebase && git push cd ../gh-pages git add -A git commit -m "Automated redirect" - git push + git pull --rebase && git push From 3ff817cf6af0d0b08be5bf6adc9f9f81d4227fc4 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 19:42:12 +0200 Subject: [PATCH 099/105] FIX: report is not uploaded when tests fail --- .github/workflows/test-all-and-update-latest-report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-all-and-update-latest-report.yml b/.github/workflows/test-all-and-update-latest-report.yml index 9a591c006..f6a6c2956 100644 --- a/.github/workflows/test-all-and-update-latest-report.yml +++ b/.github/workflows/test-all-and-update-latest-report.yml @@ -19,6 +19,7 @@ jobs: update-latest: name: "Upload report" needs: test-all + if: always() uses: ./.github/workflows/update-latest-report.yml with: which-gap: ${{ github.event.inputs.which-gap }} From 671fb9031ec0bb1be50c38a090d36654b0337c75 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 20:05:22 +0200 Subject: [PATCH 100/105] Create final version of daily tests --- .../test-all-and-update-latest-report.yml | 25 ----------- .github/workflows/test-all.yml | 2 +- .github/workflows/test-release.yml | 43 +++++++++++++++++++ 3 files changed, 44 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/test-all-and-update-latest-report.yml create mode 100644 .github/workflows/test-release.yml diff --git a/.github/workflows/test-all-and-update-latest-report.yml b/.github/workflows/test-all-and-update-latest-report.yml deleted file mode 100644 index f6a6c2956..000000000 --- a/.github/workflows/test-all-and-update-latest-report.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: "Test packages and update latest report" - -on: - workflow_dispatch: - inputs: - which-gap: - description: 'Either a GAP branch name or a GAP version' - required: true - type: string - default: master # or 4.11.1 or ... - -jobs: - test-all: - name: "Test packages and generate report" - uses: ./.github/workflows/test-all.yml - with: - which-gap: ${{ github.event.inputs.which-gap }} - - update-latest: - name: "Upload report" - needs: test-all - if: always() - uses: ./.github/workflows/update-latest-report.yml - with: - which-gap: ${{ github.event.inputs.which-gap }} diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 8b18b4b82..a9e936423 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -11,7 +11,7 @@ # MARKDOWN file and a summary of the changes as a test-status-diff JSON file # which other workflows can process. Both files are uploaded as artifacts. # -name: "Test packages and generate report" +name: "Test packages" on: workflow_dispatch: diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-release.yml new file mode 100644 index 000000000..c9eba11d0 --- /dev/null +++ b/.github/workflows/test-release.yml @@ -0,0 +1,43 @@ +# +# This workflow is run either by a manual workflow dispatch, or +# as part of a pull request check. +# +# It tests the official package distribution by calling +# the test-all and update-latest-report YML files. +# +name: "Test release" + +on: + schedule: + - cron: '00 2 * * *' + workflow_dispatch: + + +jobs: + test-all-master: + name: "Test packages" + uses: ./.github/workflows/test-all.yml + with: + which-gap: master + + update-latest-master: + name: "Upload report" + needs: test-all-master + if: always() + uses: ./.github/workflows/update-latest-report.yml + with: + which-gap: master + + test-all-4-11-1: + name: "Test packages" + uses: ./.github/workflows/test-all.yml + with: + which-gap: 4.11.1 + + update-latest-4-11: + name: "Upload report" + needs: test-all-4-11-1 + if: always() + uses: ./.github/workflows/update-latest-report.yml + with: + which-gap: 4.11.1 From 2d9dda3becaf999aa9dd8d9683ea36a4f38b461f Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 20:12:37 +0200 Subject: [PATCH 101/105] Update README.md --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index fc52cbe7d..e6c577cf2 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,6 @@ contains the metadata of all the GAP packages in the distribution. We also upload snapshots the package distribution tarballs to appropriate release tags on this repository. -## High-level status dashboard - -| Test | GAP master | -|:---------------:|:----------:| -| Released packages | [![Tests](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/FriedrichRober/PackageDistro/data/badges/latest-master/badge.json)](https://FriedrichRober.github.io/PackageDistro/latest-master/redirect.html) | ## Metadata From 09aa737d2c8ad049987bff8d2b2b322e9c80bf95 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 20:19:09 +0200 Subject: [PATCH 102/105] Add final version for daily tests. --- .../workflows/{test-release.yml => test-daily.yml} | 13 ++++++------- .github/workflows/update-latest-report.yml | 3 +++ 2 files changed, 9 insertions(+), 7 deletions(-) rename .github/workflows/{test-release.yml => test-daily.yml} (72%) diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-daily.yml similarity index 72% rename from .github/workflows/test-release.yml rename to .github/workflows/test-daily.yml index c9eba11d0..9f60bde94 100644 --- a/.github/workflows/test-release.yml +++ b/.github/workflows/test-daily.yml @@ -1,19 +1,17 @@ # -# This workflow is run either by a manual workflow dispatch, or -# as part of a pull request check. +# This workflow is run regularly and tests the official package distribution +# by calling the test-all and update-latest-report YML workflows. # -# It tests the official package distribution by calling -# the test-all and update-latest-report YML files. -# -name: "Test release" +name: "Daily tests" on: + workflow_dispatch: # for debugging schedule: - cron: '00 2 * * *' - workflow_dispatch: jobs: + # master test-all-master: name: "Test packages" uses: ./.github/workflows/test-all.yml @@ -28,6 +26,7 @@ jobs: with: which-gap: master + # 4.11.1 test-all-4-11-1: name: "Test packages" uses: ./.github/workflows/test-all.yml diff --git a/.github/workflows/update-latest-report.yml b/.github/workflows/update-latest-report.yml index 55afc3e03..58d4c5e61 100644 --- a/.github/workflows/update-latest-report.yml +++ b/.github/workflows/update-latest-report.yml @@ -11,6 +11,9 @@ # redirect pointing to the latest report is updated and uploaded # to the gh-pages branch on the repository. # +# TODO: Create a Slack notification if a package is failing only +# on the current run. +# name: "Update latest package evaluation report" on: From 84bdcfd8fc35f1427ea9f33807134d5f3092be63 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 20:27:25 +0200 Subject: [PATCH 103/105] Shorter name for update script --- .github/workflows/update-latest-report.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-latest-report.yml b/.github/workflows/update-latest-report.yml index 58d4c5e61..72f510065 100644 --- a/.github/workflows/update-latest-report.yml +++ b/.github/workflows/update-latest-report.yml @@ -3,7 +3,7 @@ # as part of a daily build. # # We assume that we have run the test suite for all packages and -# generated a report by calling the test-all YML file beforehand. +# generated a report by calling the test-all YML workflow beforehand. # The report is uploaded to the data branch on the repository # and the symlink pointing to the latest report is updated there. # In addition, the badge for the latest workflow is generated and @@ -14,7 +14,7 @@ # TODO: Create a Slack notification if a package is failing only # on the current run. # -name: "Update latest package evaluation report" +name: "Update latest report" on: workflow_call: From 47756f045fbf221bcd8d5a5d3b838407eb6ea760 Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 20:30:52 +0200 Subject: [PATCH 104/105] Rename report step --- .github/workflows/test-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index a9e936423..baa44fdb1 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -329,7 +329,7 @@ jobs: path: "${{ matrix.package }}.json" report: - name: "Report" + name: "Generate report" needs: test-package if: always() runs-on: ubuntu-latest From fac7a22b839ff7b9cd2de9e886230b482e3d3aba Mon Sep 17 00:00:00 2001 From: Friedrich Rober Date: Wed, 30 Mar 2022 20:51:09 +0200 Subject: [PATCH 105/105] Add empty line to end of badge.json --- tools/update_latest_report.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/update_latest_report.py b/tools/update_latest_report.py index 8db303e28..678acd288 100644 --- a/tools/update_latest_report.py +++ b/tools/update_latest_report.py @@ -91,3 +91,4 @@ with open(os.path.join(dir_badge, 'badge.json'), 'w') as f: json.dump(badge, f, ensure_ascii=False, indent=2) + f.write("\n")