From 48c6a3d6678fc54a9320347abcade1ba8b7a9c04 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Sun, 28 Jul 2024 17:23:56 +0200 Subject: [PATCH] [INFRA] Rework API stability cron --- .../ISSUE_TEMPLATE/cron_comment_template.md | 2 +- .github/workflows/cron_api.yml | 92 +++++++++---------- .../scripts/process_compiler_error_log.py | 4 +- 3 files changed, 45 insertions(+), 53 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/cron_comment_template.md b/.github/ISSUE_TEMPLATE/cron_comment_template.md index c57d3be8c5..3b77fd92f7 100644 --- a/.github/ISSUE_TEMPLATE/cron_comment_template.md +++ b/.github/ISSUE_TEMPLATE/cron_comment_template.md @@ -1,4 +1,4 @@ -Failure {{ build }} on gcc{{ compiler }} +Failure {{ build }} on {{ compiler }} --- See {{ url }} for more information. diff --git a/.github/workflows/cron_api.yml b/.github/workflows/cron_api.yml index 6c84a55bdb..56b5530bf7 100644 --- a/.github/workflows/cron_api.yml +++ b/.github/workflows/cron_api.yml @@ -18,76 +18,58 @@ concurrency: env: SEQAN3_NO_VERSION_CHECK: 1 TZ: Europe/Berlin - ISSUE: 2746 # Issue number to use for reporting failures + ISSUE: 3280 # Issue number to use for reporting failures defaults: run: - shell: bash -Eexuo pipefail {0} + shell: bash -Eeuxo pipefail {0} jobs: build: - name: API-Stability gcc${{ matrix.compiler }} - runs-on: ubuntu-22.04 - timeout-minutes: 300 + name: API-Stability ${{ matrix.compiler }} + runs-on: ubuntu-latest if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' strategy: fail-fast: false matrix: - compiler: [11, 12, 13] - + compiler: ["gcc-14", "gcc-13", "gcc-12", "gcc-11"] + container: + image: ghcr.io/seqan/${{ matrix.compiler }} + volumes: + - /home/runner:/home/runner steps: - - name: Checkout SeqAn3 + - name: Checkout uses: actions/checkout@v4 with: - path: seqan3 - fetch-depth: 1 submodules: true - name: Checkout SeqAn2 uses: actions/checkout@v4 with: repository: seqan/seqan - path: seqan3/submodules/seqan - fetch-depth: 1 - - - name: Setup compiler - uses: seqan/actions/setup-compiler@main - with: - compiler: gcc-${{ matrix.compiler }} - - - name: Install CMake - uses: seqan/actions/setup-cmake@main - with: - cmake: 3.16.9 + path: submodules/seqan - name: Configure tests run: | - mkdir seqan3-build - cd seqan3-build - cmake ../seqan3/test/api_stability -DCMAKE_BUILD_TYPE=Release + mkdir build && cd build + cmake ../test/api_stability -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" - name: Build tests - run: | - cd seqan3-build - CMAKE_BUILD_PARALLEL_LEVEL=2 cmake --build . -- -k 2>&1 | tee build.log - - - name: Setup Python - if: ${{ failure() }} - uses: actions/setup-python@v5 - with: - python-version: '3.x' + working-directory: build + run: make -k 2>&1 | tee build.log - name: Process Log - if: ${{ failure() }} + if: failure() run: | - FILE="seqan3/.github/ISSUE_TEMPLATE/cron_comment_template.md" - python3 seqan3/.github/workflows/scripts/process_compiler_error_log.py seqan3-build/build.log >> $FILE + FILE=".github/ISSUE_TEMPLATE/cron_comment_template.md" + python3 .github/workflows/scripts/process_compiler_error_log.py build/build.log >> ${FILE} - name: Create comment body - if: ${{ failure() }} + if: failure() id: comment-body run: | - FILE="seqan3/.github/ISSUE_TEMPLATE/cron_comment_template.md" + FILE=".github/ISSUE_TEMPLATE/cron_comment_template.md" URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" sed -i "s@{{ build }}@${{ matrix.build }}@" $FILE sed -i "s@{{ compiler }}@${{ matrix.compiler }}@" $FILE @@ -96,21 +78,31 @@ jobs: cat $FILE >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + - name: Create comment body + if: success() + id: comment-body + run: echo "body=Success ${{ matrix.build }} on ${{ matrix.compiler }}" >> $GITHUB_OUTPUT + - name: Reopen issue - if: ${{ failure() }} - uses: octokit/request-action@v2.x - with: - route: PATCH /repos/{owner}/{repo}/issues/{issue_number} - owner: ${{ github.repository_owner }} - repo: seqan3 - issue_number: ${{ env.ISSUE }} - state: "open" + if: failure() + run: gh issue reopen ${{ env.ISSUE }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.SEQAN_ACTIONS_PAT }} + GH_REPO: ${{ github.repository }} - - name: Create comment - if: ${{ failure() }} + - name: Find Comment + uses: peter-evans/find-comment@v3 + id: find_comment + with: + issue-number: ${{ env.ISSUE }} + body-includes: ${{ matrix.build }} on ${{ matrix.compiler }} + + - name: Update comment uses: peter-evans/create-or-update-comment@v4 with: + comment-id: ${{ steps.find_comment.outputs.comment-id }} issue-number: ${{ env.ISSUE }} body: ${{ steps.comment-body.outputs.body }} + edit-mode: replace + token: ${{ secrets.SEQAN_ACTIONS_PAT }} + diff --git a/.github/workflows/scripts/process_compiler_error_log.py b/.github/workflows/scripts/process_compiler_error_log.py index 486881447d..d8f1f1372a 100644 --- a/.github/workflows/scripts/process_compiler_error_log.py +++ b/.github/workflows/scripts/process_compiler_error_log.py @@ -11,8 +11,8 @@ import re import sys -# https://regex101.com/r/aE0qX3/1 -tokenise_regex = re.compile(r"(\[\s*\d+%\](?:.(?!\[\s*\d+%\]))+(?:error:).*?(?=\[\s*\d+%\]|$))", re.DOTALL) +# https://regex101.com/r/aE0qX3/2 +tokenise_regex = re.compile(r"(\[\s*\d+%\](?:.(?!\[\s*\d+%\]))+(?:: error:).*?(?=\[\s*\d+%\]|$))", re.DOTALL) # Match line containg 'error:', but stop at linebreak, semicolon or parenthesis. error_regex = re.compile(r"(error:[^(;\n]*)")