Skip to content

Commit b954d70

Browse files
committed
Update Actions, add crates.io publish step
1 parent bb983a2 commit b954d70

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,24 @@ on:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8+
workflow_dispatch:
9+
release:
10+
types: [ published ]
811

912
env:
1013
CARGO_TERM_COLOR: always
1114

1215
jobs:
1316
check_format:
17+
name: Run cargo fmt
1418
runs-on: ubuntu-latest
1519
steps:
1620
- uses: actions/checkout@v4
1721
- name: Check format
1822
run: cargo fmt -- --check
1923

2024
build_workspace:
25+
name: Check and build entire workspace
2126
runs-on: ubuntu-latest
2227
steps:
2328
- uses: actions/checkout@v4
@@ -30,13 +35,14 @@ jobs:
3035
- name: Check workspace (including pySplashsurf)
3136
run: cargo check --workspace --all-targets
3237
- name: Build
33-
run: cargo build
38+
run: cargo build (excluding pySplashsurf)
3439
- name: Run tests
3540
run: cargo test
3641
- name: Build (release)
3742
run: cargo build --release
3843

3944
build_lib_all_features:
45+
name: Build splashsurf_lib with all features
4046
runs-on: ubuntu-latest
4147
steps:
4248
- uses: actions/checkout@v4
@@ -53,9 +59,8 @@ jobs:
5359
cargo test --manifest-path="splashsurf_lib/Cargo.toml" --release --all-features --verbose
5460
5561
build_lib_no_default_features:
56-
62+
name: Build splashsurf_lib with no default features
5763
runs-on: ubuntu-latest
58-
5964
steps:
6065
- uses: actions/checkout@v4
6166
with:
@@ -66,3 +71,21 @@ jobs:
6671
- name: Run tests
6772
run: |
6873
cargo test --manifest-path="splashsurf_lib/Cargo.toml" --no-default-features --verbose
74+
75+
publish:
76+
name: Publish to crates.io
77+
runs-on: ubuntu-latest
78+
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' }}
79+
needs: [check_format, build_workspace, build_lib_all_features, build_lib_no_default_features]
80+
steps:
81+
- uses: actions/checkout@v4
82+
- name: Publish splashsurf_lib
83+
run: |
84+
cargo publish --package splashsurf_lib --dry-run
85+
env:
86+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
87+
- name: Publish splashsurf
88+
run: |
89+
cargo publish --package splashsurf --dry-run
90+
env:
91+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/pysplashsurf_CI.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ permissions:
1616

1717
jobs:
1818
check_format:
19+
name: Check formatting of pySplashsurf crate
1920
runs-on: ubuntu-latest
2021
steps:
2122
- uses: actions/checkout@v4
@@ -24,6 +25,7 @@ jobs:
2425
working-directory: pysplashsurf
2526

2627
generate-stub:
28+
name: Run stub generator
2729
runs-on: ubuntu-latest
2830
steps:
2931
- uses: actions/checkout@v3
@@ -38,6 +40,7 @@ jobs:
3840
path: pysplashsurf/pysplashsurf/
3941

4042
linux:
43+
name: Build wheels for Linux
4144
needs: generate-stub
4245
runs-on: ${{ matrix.platform.runner }}
4346
strategy:
@@ -75,6 +78,7 @@ jobs:
7578
path: dist
7679

7780
windows:
81+
name: Build wheels for Windows
7882
needs: generate-stub
7983
runs-on: ${{ matrix.platform.runner }}
8084
strategy:
@@ -108,6 +112,7 @@ jobs:
108112
path: dist
109113

110114
macos:
115+
name: Build wheels for macOS
111116
needs: generate-stub
112117
runs-on: ${{ matrix.platform.runner }}
113118
strategy:
@@ -140,6 +145,7 @@ jobs:
140145
path: dist
141146

142147
sdist:
148+
name: Build source distribution
143149
needs: generate-stub
144150
runs-on: ubuntu-latest
145151
steps:
@@ -160,8 +166,8 @@ jobs:
160166
name: wheels-sdist
161167
path: dist
162168

163-
release:
164-
name: Release
169+
publish:
170+
name: Publish to PyPI
165171
runs-on: ubuntu-latest
166172
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' }}
167173
needs: [linux, windows, macos, sdist, tests]
@@ -188,6 +194,7 @@ jobs:
188194
args: --non-interactive --skip-existing wheels-*/*
189195

190196
build_wheel:
197+
name: Build wheel for documentation and tests
191198
runs-on: ubuntu-latest
192199
outputs:
193200
filename: ${{ steps.get_filename.outputs.file_name }}
@@ -214,6 +221,7 @@ jobs:
214221
path: dist
215222

216223
docs:
224+
name: Build documentation
217225
needs: build_wheel
218226
runs-on: ubuntu-latest
219227
steps:
@@ -238,14 +246,16 @@ jobs:
238246
path: pysplashsurf/pysplashsurf/docs/build/html/
239247

240248
read_the_docs:
241-
needs: [docs, release]
249+
name: Read the Docs trigger
250+
needs: [docs, publish]
242251
runs-on: ubuntu-latest
243252
steps:
244253
- name: Trigger Read the Docs build
245254
run: |
246255
curl -X POST -d "branches=main" -d "token=${{ secrets.READTHEDOCS_TOKEN }}" https://app.readthedocs.org/api/v2/webhook/pysplashsurf/299116/
247256
248257
tests:
258+
name: Run pytest
249259
needs: build_wheel
250260
defaults:
251261
run:

0 commit comments

Comments
 (0)