File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 88
88
89
89
steps :
90
90
- uses : actions/checkout@v4
91
+ with :
92
+ fetch-depth : 2
91
93
92
94
- name : Set up Python ${{ matrix.python-version }}
93
95
uses : actions/setup-python@v5
@@ -98,7 +100,17 @@ jobs:
98
100
run : |
99
101
echo "OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml" >> $GITHUB_ENV
100
102
echo "OPENMC_ENDF_DATA=$HOME/endf-b-vii.1" >> $GITHUB_ENV
101
-
103
+ # get the sha of the last branch commit
104
+ # for push and workflow_dispatch events, use the current reference head
105
+ BRANCH_SHA=HEAD
106
+ # for a pull_request event, use the last reference of the parents of the merge commit
107
+ if [ "${{ github.event_name }}" == "pull_request" ]; then
108
+ BRANCH_SHA=$(git rev-list --parents -n 1 HEAD | rev | cut -d" " -f 1 | rev)
109
+ fi
110
+ COMMIT_MESSAGE=$(git log $BRANCH_SHA -1 --pretty=%B)
111
+ echo ${COMMIT_MESSAGE}
112
+ echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV
113
+
102
114
- name : Apt dependencies
103
115
shell : bash
104
116
run : |
@@ -153,6 +165,12 @@ jobs:
153
165
CTEST_OUTPUT_ON_FAILURE=1 make test -C $GITHUB_WORKSPACE/build/
154
166
$GITHUB_WORKSPACE/tools/ci/gha-script.sh
155
167
168
+ - name : Setup tmate debug session
169
+ continue-on-error : true
170
+ if : ${{ contains(env.COMMIT_MESSAGE, '[gha-debug]') }}
171
+ uses : mxschmitt/action-tmate@v3
172
+ timeout-minutes : 10
173
+
156
174
- name : after_success
157
175
shell : bash
158
176
run : |
Original file line number Diff line number Diff line change @@ -84,6 +84,30 @@ that, consider the following:
84
84
limit the number of threads that OpenBLAS uses internally; this can be done by
85
85
setting the :envvar: `OPENBLAS_NUM_THREADS ` environment variable to 1.
86
86
87
+ Debugging Tests in CI
88
+ ---------------------
89
+
90
+ .. _tmate : <https://github.com/mxschmitt/action-tmate?tab=readme-ov-file#debug-your-github-actions-by-using-tmate>`_
91
+
92
+ Tests can be debugged in CI using a feature called `tmate `_. CI debugging can be
93
+ enabled by including "[gha-debug]" in the commit message. When the test fails, a
94
+ link similar to the one shown below will be provided in the GitHub Actions
95
+ output after failure occurs. Logging into the provided link will allow you to
96
+ debug the test in the CI environment. The following is an example of the output
97
+ shown in the CI log that provides the link to the tmate session:
98
+
99
+ .. code-block :: text
100
+ :linenos:
101
+
102
+ Created new session successfully
103
+
104
+ https://tmate.io/t/2VcykjU7vNdvAzEjQcc839GM2
105
+ Entering main loop
106
+ Web shell: https://tmate.io/t/2VcykjU7vNdvAzEjQcc839GM2
107
+
108
+ ...
109
+
110
+
87
111
Generating XML Inputs
88
112
---------------------
89
113
You can’t perform that action at this time.
0 commit comments