Skip to content

Commit 1f513a8

Browse files
adjust CI workflows (#58)
1 parent 6500e94 commit 1f513a8

File tree

3 files changed

+43
-12
lines changed

3 files changed

+43
-12
lines changed

.github/workflows/_build.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,28 @@ jobs:
3535
python -m pip install --upgrade pip
3636
python -m pip install build
3737
38+
- name: Check git status (not Windows)
39+
if: runner.os != 'Windows'
40+
run: |
41+
if [[ -z "$(git status --porcelain)" ]]; then
42+
echo "No changes found."
43+
else
44+
echo "Changes detected. Please commit or discard changes before publishing."
45+
git status --porcelain
46+
exit 1
47+
fi
48+
49+
- name: Check git status (Windows)
50+
if: runner.os == 'Windows'
51+
run: |
52+
if (-not (git status --porcelain)) {
53+
Write-Output "No changes found."
54+
} else {
55+
Write-Output "Changes detected. Please commit or discard changes before publishing."
56+
git status --porcelain
57+
exit 1
58+
}
59+
3860
- name: Build the package
3961
run: python -m build --outdir .
4062

.github/workflows/_pypi_publish.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
with:
3333
fetch-depth: 0 # IMPORTANT: otherwise the current tag does not get fetched and the build version gets worse
3434

35-
- name: Check Git status
35+
- name: Check git status
3636
run: |
3737
if [[ -z "$(git status --porcelain)" ]]; then
3838
echo "No changes found."

.github/workflows/cicd.yaml

+20-11
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
## Run the unit tests for Python 3.8 until 3.11
5959
##
6060
Test:
61-
needs: [Build]
61+
needs: [Pre-Commit]
6262
uses: ./.github/workflows/_test.yaml
6363
strategy:
6464
matrix:
@@ -72,10 +72,9 @@ jobs:
7272
##
7373
CodeCov:
7474
if: |
75-
success() &&
76-
github.actor == 'btschwertfeger' &&
77-
github.event_name == 'push'
78-
needs: [Test]
75+
(success() && github.actor == 'btschwertfeger')
76+
&& (github.event_name == 'push' || github.event_name == 'release')
77+
needs: [Pre-Commit]
7978
uses: ./.github/workflows/_codecov.yaml
8079
with:
8180
os: ubuntu-latest
@@ -87,11 +86,17 @@ jobs:
8786
##
8887
UploadTestPyPI:
8988
if: |
90-
success() &&
91-
github.actor == 'btschwertfeger' &&
92-
github.ref == 'refs/heads/master' &&
93-
github.event_name == 'push'
94-
needs: [Test]
89+
(
90+
success()
91+
&& github.actor == 'btschwertfeger'
92+
&& github.ref == 'refs/heads/master'
93+
)
94+
&& (github.event_name == 'push' || github.event_name == 'release')
95+
needs:
96+
- Build
97+
- Build-Doc
98+
- Test
99+
- CodeQL
95100
name: Upload current version to Test PyPI
96101
uses: ./.github/workflows/_pypi_publish.yaml
97102
with:
@@ -106,7 +111,11 @@ jobs:
106111
success() &&
107112
github.actor == 'btschwertfeger' &&
108113
github.event_name == 'release'
109-
needs: [Test]
114+
needs:
115+
- Build
116+
- Build-Doc
117+
- Test
118+
- CodeQL
110119
name: Upload the current release to PyPI
111120
uses: ./.github/workflows/_pypi_publish.yaml
112121
with:

0 commit comments

Comments
 (0)