Skip to content

Commit 0fabdc9

Browse files
authored
fix: matrix test for no changes is running when it should not be (#115)
1 parent 342720e commit 0fabdc9

File tree

2 files changed

+36
-27
lines changed

2 files changed

+36
-27
lines changed

.github/workflows/main-no-changes.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,32 @@ name: Matrix Test
22
on:
33
push:
44
branches: [main, devel]
5-
paths:
6-
- "ultraplot/**"
75
pull_request:
86
branches: [main, devel]
9-
paths:
10-
- "ultraplot/**"
117

128
concurrency:
139
group: ${{ github.workflow }}-${{ github.ref }}
1410
cancel-in-progress: true
1511

1612
jobs:
13+
run-if-changes:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
run: ${{ steps.filter.outputs.python }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: dorny/paths-filter@v3
20+
id: filter
21+
with:
22+
filters: |
23+
python:
24+
- 'ultraplot/**'
25+
1726
get-versions:
1827
runs-on: ubuntu-latest
28+
needs:
29+
- run-if-changes
30+
if: always() && needs.run-if-changes.outputs.run == 'true'
1931
outputs:
2032
python-versions: ${{ steps.set-versions.outputs.python-versions }}
2133
matplotlib-versions: ${{ steps.set-versions.outputs.matplotlib-versions }}
@@ -110,7 +122,10 @@ jobs:
110122
echo "matplotlib-versions=$(echo $MPL_VERSIONS | jq -c)" >> $GITHUB_OUTPUT
111123
112124
build:
113-
needs: get-versions
125+
needs:
126+
- get-versions
127+
- run-if-changes
128+
if: always() && needs.run-if-changes.outputs.run == 'true' && needs.get-versions.result == 'success'
114129
strategy:
115130
matrix:
116131
python-version: ${{ fromJson(needs.get-versions.outputs.python-versions) }}
@@ -122,7 +137,21 @@ jobs:
122137
matplotlib-version: ${{ matrix.matplotlib-version }}
123138

124139
build-success:
125-
needs: build
140+
needs:
141+
- build
142+
- run-if-changes
143+
if: always()
126144
runs-on: ubuntu-latest
127145
steps:
128-
- run: echo "All tests passed successfully!"
146+
- run: |
147+
if [[ '${{ needs.run-if-changes.outputs.run }}' == 'false' ]]; then
148+
echo "No changes detected, tests skipped."
149+
else
150+
if [[ '${{ needs.build.result }}' == 'success' ]]; then
151+
echo "All tests passed successfully!"
152+
else
153+
echo "Tests failed!"
154+
exit 1
155+
fi
156+
fi
157+

0 commit comments

Comments
 (0)