Skip to content

Commit 1e1973b

Browse files
authored
open an issue even with a missing log file (#11436)
* bump `issue-from-pytest-log-action` * don't require a log file * don't require the failure to come from the pytest run * reorder steps * use a env variable instead of direct interpolation * step names and an explanation for permissions
1 parent 718ee3d commit 1e1973b

1 file changed

Lines changed: 22 additions & 15 deletions

File tree

‎.github/workflows/upstream-dev-ci.yaml‎

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
keyword: "[test-upstream]"
4242

4343
cache-pixi-lock:
44+
name: cache pixi.lock
4445
runs-on: ubuntu-latest
4546
needs: detect-ci-trigger
4647
if: |
@@ -86,6 +87,9 @@ jobs:
8687
matrix:
8788
pixi-env: ["test-nightly"]
8889

90+
env:
91+
ENV: ${{ matrix.pixi-env }}
92+
8993
outputs:
9094
log-file: ${{ steps.determine-log-path.outputs.log-file }}
9195

@@ -94,6 +98,11 @@ jobs:
9498
with:
9599
fetch-depth: 0 # Fetch all history for all branches and tags.
96100
persist-credentials: false
101+
- name: Determine log path
102+
id: determine-log-path
103+
run: |
104+
echo "log-file=output-${ENV}-log.jsonl" >> $GITHUB_OUTPUT;
105+
cat $GITHUB_OUTPUT
97106
- name: Restore cached pixi lockfile
98107
uses: Parcels-code/pixi-lock/restore@38495788b79a5ff26009aecc15daa9a8310b8832 # v0.1.0
99108
with:
@@ -106,31 +115,26 @@ jobs:
106115
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
107116
- name: Version info
108117
run: |
109-
pixi run -e ${{matrix.pixi-env}} -- python xarray/util/print_versions.py
118+
pixi run -e $ENV -- python xarray/util/print_versions.py
110119
- name: Import xarray
111120
run: |
112-
pixi run -e ${{matrix.pixi-env}} -- python -c 'import xarray'
113-
- name: Determine log path
114-
id: determine-log-path
115-
run: |
116-
echo "log-file=output-${{ matrix.pixi-env }}-log.jsonl" >> $GITHUB_OUTPUT;
117-
cat $GITHUB_OUTPUT
121+
pixi run -e $ENV -- python -c 'import xarray'
118122
- name: Run Tests
119123
if: success()
120124
id: status
121125
env:
122126
LOG_PATH: ${{ steps.determine-log-path.outputs.log-file }}
123127
run: |
124-
pixi run -e ${{matrix.pixi-env}} -- python -m pytest --timeout=60 -rf -nauto \
128+
pixi run -e $ENV -- python -m pytest --timeout=60 -rf -nauto \
125129
--report-log "$LOG_PATH"
126130
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
127-
if: failure() && steps.status.outcome == 'failure'
131+
if: failure()
128132
with:
129133
name: log file
130134
path: ${{ steps.determine-log-path.outputs.log-file }}
131-
if-no-files-found: error
132135

133136
create-issue:
137+
name: report failing upstream-dev runs
134138
needs: upstream-dev
135139
runs-on: ubuntu-slim
136140
if: |
@@ -140,15 +144,15 @@ jobs:
140144
&& github.repository_owner == 'pydata'
141145
142146
permissions:
143-
issues: write
147+
issues: write # open or edit an issue for failed CI runs
144148

145149
steps:
146150
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
147151
with:
148152
name: log file
149153
path: logs/
150154
- name: Generate and publish the report
151-
uses: scientific-python/issue-from-pytest-log-action@8e905db353437cda1d6a773de245343fbfc940dd # v1.5.0
155+
uses: scientific-python/issue-from-pytest-log-action@87351a8f864e969567cda22a25a2f214cbe2340f # v1.6.0
152156
with:
153157
log-path: logs/${{ needs.upstream-dev.outputs.log-file }}
154158

@@ -168,6 +172,9 @@ jobs:
168172
matrix:
169173
pixi-env: ["mypy-upstream"]
170174

175+
env:
176+
ENV: ${{ matrix.pixi-env }}
177+
171178
steps:
172179
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
173180
with:
@@ -188,13 +195,13 @@ jobs:
188195
- name: set environment variables
189196
run: |
190197
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
191-
echo "PYTHON_VERSION=$(pixi run -e ${{matrix.pixi-env}} -- python --version | cut -d' ' -f2 | cut -d. -f1,2)" >> $GITHUB_ENV
198+
echo "PYTHON_VERSION=$(pixi run -e $ENV -- python --version | cut -d' ' -f2 | cut -d. -f1,2)" >> $GITHUB_ENV
192199
- name: Version info
193200
run: |
194-
pixi run -e ${{matrix.pixi-env}} -- python xarray/util/print_versions.py
201+
pixi run -e $ENV -- python xarray/util/print_versions.py
195202
- name: Run mypy
196203
run: |
197-
pixi run -e ${{matrix.pixi-env}} -- python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
204+
pixi run -e $ENV -- python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
198205
- name: Upload mypy coverage to Codecov
199206
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
200207
with:

0 commit comments

Comments
 (0)