From d95b1720e4f03b4c751d62337f098c2d3217f137 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 20 Sep 2024 09:39:46 -0500 Subject: [PATCH 01/10] Adding tmate to CI for debugging --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9293e319b42..543d660dac5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,6 +155,11 @@ jobs: cpp-coveralls -i src -i include -e src/external --exclude-pattern "/usr/*" --dump cpp_cov.json coveralls --merge=cpp_cov.json --service=github + - name: Setup tmate debug session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 15 + finish: needs: main runs-on: ubuntu-latest From b18f5b5175233d25884ea611d8fc0da890893beb Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 10 Oct 2024 13:41:26 -0500 Subject: [PATCH 02/10] Only enable tmate if [ci-debug] is in the commit message --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 543d660dac5..a4941e09a52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,7 +156,7 @@ jobs: coveralls --merge=cpp_cov.json --service=github - name: Setup tmate debug session - if: ${{ failure() }} + if: contains(github.event.head_commit.message, '[ci-debug]') uses: mxschmitt/action-tmate@v3 timeout-minutes: 15 From a54cd24285d603210abc07822545f873d1b598e8 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 10 Oct 2024 16:58:23 -0500 Subject: [PATCH 03/10] Making tmate commit message trigger more robust [gha-debug] --- .github/workflows/ci.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4941e09a52..4084bf0862a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,7 @@ jobs: steps: - uses: actions/checkout@v4 - + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -96,10 +96,20 @@ jobs: - name: Environment Variables run: | + COMMIT_MESSAGE=$(git log -1 --pretty=%B) + echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV echo "DAGMC_ROOT=$HOME/DAGMC" echo "OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml" >> $GITHUB_ENV echo "OPENMC_ENDF_DATA=$HOME/endf-b-vii.1" >> $GITHUB_ENV + - name: Setup tmate debug session + # only setup tmate if the following key is in the commit message + if: ${{ contains(env.COMMIT_MESSAGE_HEADER, '[gha-debug]') }} + uses: mxschmitt/action-tmate@v3 + with: + # starts a tmate session and allows workflow to continue + detached: true + - name: Apt dependencies shell: bash run: | @@ -155,11 +165,6 @@ jobs: cpp-coveralls -i src -i include -e src/external --exclude-pattern "/usr/*" --dump cpp_cov.json coveralls --merge=cpp_cov.json --service=github - - name: Setup tmate debug session - if: contains(github.event.head_commit.message, '[ci-debug]') - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 15 - finish: needs: main runs-on: ubuntu-latest From 48d2e739ef6504b71ab237a5b951bd5fb7eb7c36 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 10 Oct 2024 17:18:24 -0500 Subject: [PATCH 04/10] Activate tmate [gha-debug] From 8a62aea2186d2003160c693af382dd41b5664c52 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 10 Oct 2024 17:23:57 -0500 Subject: [PATCH 05/10] Trying activate tmate again [gha-debug] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ec56d0c83d..9fb07e433ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,7 @@ jobs: - name: Setup tmate debug session # only setup tmate if the following key is in the commit message - if: ${{ contains(env.COMMIT_MESSAGE_HEADER, '[gha-debug]') }} + if: ${{ contains(env.COMMIT_MESSAGE, '[gha-debug]') }} uses: mxschmitt/action-tmate@v3 with: # starts a tmate session and allows workflow to continue From d97c00c4cdd1e865c31249c28ddfd08240244507 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 10 Oct 2024 17:37:51 -0500 Subject: [PATCH 06/10] Update ci.yml [gha-debug] --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fb07e433ba..7649456112a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,6 +97,7 @@ jobs: - name: Environment Variables run: | COMMIT_MESSAGE=$(git log -1 --pretty=%B) + echo ${COMMIT_MESSAGE} echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV echo "OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml" >> $GITHUB_ENV echo "OPENMC_ENDF_DATA=$HOME/endf-b-vii.1" >> $GITHUB_ENV From 3e5fc2c4be4b0d3eb14075d59193c1e2ffc4e005 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 10 Oct 2024 21:55:53 -0500 Subject: [PATCH 07/10] Using merge commit parents for PRs --- .github/workflows/ci.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7649456112a..07c6e58a440 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,9 @@ jobs: steps: - uses: actions/checkout@v4 - + with: + fetch-depth: 2 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -96,12 +98,20 @@ jobs: - name: Environment Variables run: | - COMMIT_MESSAGE=$(git log -1 --pretty=%B) - echo ${COMMIT_MESSAGE} echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV echo "OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml" >> $GITHUB_ENV echo "OPENMC_ENDF_DATA=$HOME/endf-b-vii.1" >> $GITHUB_ENV - + # get the sha of the last branch commit + # for push and workflow_dispatch events, use the current reference head + BRANCH_SHA=HEAD + # for a pull_request event, use the last reference of the parents of the merge commit + if [ "${{ github.event_name }}" == "pull_request" ]; then + BRANCH_SHA=$(git rev-list --parents -n 1 HEAD | rev | cut -d" " -f 1 | rev) + fi + COMMIT_MESSAGE=$(git log $BRANCH_SHA -1 --pretty=%B) + echo ${COMMIT_MESSAGE} + echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV + - name: Setup tmate debug session # only setup tmate if the following key is in the commit message if: ${{ contains(env.COMMIT_MESSAGE, '[gha-debug]') }} From 1be6045993d7dcae876d8ca181d332a1b17a6d1c Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 10 Oct 2024 21:56:43 -0500 Subject: [PATCH 08/10] Remove old echo in env var section [gha-debug] --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07c6e58a440..3ebfa8137ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,7 +98,6 @@ jobs: - name: Environment Variables run: | - echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV echo "OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml" >> $GITHUB_ENV echo "OPENMC_ENDF_DATA=$HOME/endf-b-vii.1" >> $GITHUB_ENV # get the sha of the last branch commit From 35f8dfa19c5116032b6ae58d9dbbea6b3106d72e Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 14 Oct 2024 18:39:23 -0500 Subject: [PATCH 09/10] Fixing a snag [gha-debug] --- .github/workflows/ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ebfa8137ee..6bcdc8ed575 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,14 +111,6 @@ jobs: echo ${COMMIT_MESSAGE} echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV - - name: Setup tmate debug session - # only setup tmate if the following key is in the commit message - if: ${{ contains(env.COMMIT_MESSAGE, '[gha-debug]') }} - uses: mxschmitt/action-tmate@v3 - with: - # starts a tmate session and allows workflow to continue - detached: true - - name: Apt dependencies shell: bash run: | @@ -173,6 +165,12 @@ jobs: CTEST_OUTPUT_ON_FAILURE=1 make test -C $GITHUB_WORKSPACE/build/ $GITHUB_WORKSPACE/tools/ci/gha-script.sh + - name: Setup tmate debug session + continue-on-error: true + if: ${{ contains(env.COMMIT_MESSAGE, '[gha-debug]') }} + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + - name: after_success shell: bash run: | From 8e1f3a8d035bc34451dc86c424f3ae8655db08a4 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sun, 27 Oct 2024 21:37:59 -0500 Subject: [PATCH 10/10] [gha-debug]