Skip to content

Commit 83bcc6d

Browse files
committed
Release CI: change task order + release/doc tag names
Previously, a "docs-v0.1.2" tag was created after post-processing, but accidentally *not* used for release. But we likely don't even need two separate tags. Now, following things change: - Add godot-itest step. - Unit-test and itest run _after_ the doc post-processing, ensuring integrity of published crate. - The tag triggering the workflow is no longer "v0.1.2", but "trigger-v0.1.2". - The release tag (with post-processed docs) is now "v0.1.2", which is still published to crates.io.
1 parent f67a1ae commit 83bcc6d

File tree

1 file changed

+99
-65
lines changed

1 file changed

+99
-65
lines changed

.github/workflows/release-version.yml

Lines changed: 99 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ on:
1111
- '!**'
1212
tags:
1313
# To include pre-releases: 'v0.1.[0-9]+-?*'
14-
- 'v0.[0-9]+.[0-9]+'
14+
- 'trigger-v0.[0-9]+.[0-9]+'
1515

1616
env:
17-
# Note: used for test and clippy, not for publish. Test features are different from other CIs.
18-
CLIPPY_TEST_FEATURES: "--features godot/experimental-godot-api,godot/codegen-rustfmt,godot/serde"
19-
2017
# Crates to publish -- important, this doesn't work when there are spaces in any of the paths!
2118
# Keep in sync with update-version.sh
2219
GDEXT_CRATES: >
@@ -28,6 +25,22 @@ env:
2825
godot-core
2926
godot
3027
28+
# Used for integration test artifact, must be without patch version.
29+
GODOT_ARTIFACT_VERSION: "4.4"
30+
31+
# Note: used for test and clippy, not for publish. Test features are different from other CIs.
32+
CLIPPY_TEST_FEATURES: "--features godot/experimental-godot-api,godot/codegen-rustfmt,godot/serde"
33+
34+
CLIPPY_ARGS: >-
35+
-D clippy::suspicious
36+
-D clippy::style
37+
-D clippy::complexity
38+
-D clippy::perf
39+
-D clippy::dbg_macro
40+
-D clippy::todo
41+
-D clippy::unimplemented
42+
-D warnings
43+
3144
defaults:
3245
run:
3346
shell: bash
@@ -36,7 +49,7 @@ jobs:
3649
validation:
3750
runs-on: ubuntu-latest
3851
outputs:
39-
GDEXT_PUBLISHED_VERSION: ${{ steps.parse-crate-version.outputs.GDEXT_PUBLISHED_VERSION }}
52+
PUBLISHED_CRATE_VERSION: ${{ steps.parse-crate-version.outputs.PUBLISHED_CRATE_VERSION }}
4053
steps:
4154
- uses: actions/checkout@v4
4255

@@ -56,92 +69,55 @@ jobs:
5669
# exit 2
5770
# fi
5871
#
59-
# echo "GDEXT_PUBLISHED_VERSION=$crateVer" >> $GITHUB_OUTPUT
72+
# echo "PUBLISHED_CRATE_VERSION=$crateVer" >> $GITHUB_OUTPUT
6073
# echo "Validated version: $crateVer"
6174

6275
- name: "Parse crate version from tag"
6376
id: parse-crate-version
6477
run: |
65-
crateVer=$(echo "$GITHUB_REF" | sed -n "s#refs/tags/v\(.*\)#\1#p")
78+
crateVer=$(echo "$GITHUB_REF" | sed -n "s#refs/tags/trigger-v\(.*\)#\1#p")
6679
if [[ -z "$crateVer" ]]; then
6780
printf "\n::error::Failed to parse GitHub ref '$GITHUB_REF'.\n"
6881
exit 2
6982
fi
70-
71-
echo "GDEXT_PUBLISHED_VERSION=$crateVer" >> $GITHUB_OUTPUT
83+
84+
echo "PUBLISHED_CRATE_VERSION=$crateVer" >> $GITHUB_OUTPUT
7285
echo "Validated version: $crateVer"
7386
74-
- name: "Verify that Cargo.toml versions match ${{ steps.parse-crate-version.outputs.GDEXT_PUBLISHED_VERSION }}"
87+
- name: "Verify that Cargo.toml versions match ${{ steps.parse-crate-version.outputs.PUBLISHED_CRATE_VERSION }}"
7588
run: |
7689
echo "Checking crate versions..."
77-
publishedVersion="${{ steps.parse-crate-version.outputs.GDEXT_PUBLISHED_VERSION }}"
78-
90+
publishedVersion="${{ steps.parse-crate-version.outputs.PUBLISHED_CRATE_VERSION }}"
91+
7992
# Check if each Cargo.toml has that version
8093
IFS=' ' read -r -a publishedCrates <<< "$GDEXT_CRATES"
8194
for crate in "${publishedCrates[@]}"; do
8295
readVersion=$(grep -Po '^version = "\K[^"]*' "$crate/Cargo.toml")
8396
printf "* $crate -> $readVersion"
84-
97+
8598
if [[ "$readVersion" != "$publishedVersion" ]]; then
8699
printf " ERROR\n"
87100
versionMismatch="1"
88101
else
89102
printf "\n"
90103
fi
91104
done
92-
105+
93106
if [[ -n "$versionMismatch" ]]; then
94107
printf "\n::error::At least one crate has a version mismatching the git tag.\n"
95108
exit 2
96109
else
97110
printf "\nAll versions OK.\n"
98111
fi
99112
100-
# Keep all in sync with minimal-ci and full-ci.
101-
unit-test:
102-
runs-on: ubuntu-latest
103-
needs: validation
104-
steps:
105-
- uses: actions/checkout@v4
106-
with:
107-
ref: 'v${{ needs.validation.outputs.GDEXT_PUBLISHED_VERSION }}'
108-
109-
- name: "Install Rust (uncached)"
110-
run: rustup update stable
111-
112-
- name: "Compile and run test"
113-
run: cargo test $CLIPPY_TEST_FEATURES
114-
115-
clippy:
116-
runs-on: ubuntu-latest
117-
needs: validation
118-
steps:
119-
- uses: actions/checkout@v4
120-
with:
121-
ref: 'v${{ needs.validation.outputs.GDEXT_PUBLISHED_VERSION }}'
122-
123-
- name: "Install Rust (uncached)"
124-
run: rustup update stable
125-
126-
- name: "Check clippy"
127-
run: |
128-
cargo clippy --all-targets $CLIPPY_TEST_FEATURES -- \
129-
-D clippy::suspicious \
130-
-D clippy::style \
131-
-D clippy::complexity \
132-
-D clippy::perf \
133-
-D clippy::dbg_macro \
134-
-D clippy::todo \
135-
-D clippy::unimplemented \
136-
-D warnings
137113
138114
rustfmt:
139115
runs-on: ubuntu-latest
140116
needs: validation
141117
steps:
142118
- uses: actions/checkout@v4
143119
with:
144-
ref: 'v${{ needs.validation.outputs.GDEXT_PUBLISHED_VERSION }}'
120+
ref: ${{ github.ref }}
145121

146122
- name: "Install Rust (uncached)"
147123
run: rustup update stable
@@ -161,25 +137,41 @@ jobs:
161137
exit 1
162138
}
163139
140+
141+
clippy:
142+
runs-on: ubuntu-latest
143+
needs: validation
144+
steps:
145+
- uses: actions/checkout@v4
146+
with:
147+
ref: ${{ github.ref }}
148+
149+
- name: "Install Rust (uncached)"
150+
run: rustup update stable
151+
152+
- name: "Check clippy"
153+
run: |
154+
cargo clippy --all-targets $CLIPPY_TEST_FEATURES -- $CLIPPY_ARGS
155+
156+
164157
docs-and-commit:
165158
runs-on: ubuntu-latest
166159
needs:
167160
- validation
168-
- unit-test
169-
- clippy
170161
- rustfmt
162+
- clippy
171163
env:
172-
GDEXT_PUBLISHED_VERSION: ${{ needs.validation.outputs.GDEXT_PUBLISHED_VERSION }}
164+
PUBLISHED_CRATE_VERSION: ${{ needs.validation.outputs.PUBLISHED_CRATE_VERSION }}
173165
steps:
174166
- uses: actions/checkout@v4
175167
with:
176-
ref: 'v${{ needs.validation.outputs.GDEXT_PUBLISHED_VERSION }}'
168+
ref: 'trigger-v${{ needs.validation.outputs.PUBLISHED_CRATE_VERSION }}'
177169

178170
- name: "Install Rust (uncached)"
179171
run: rustup update stable
180172

181173
# - name: "Tag base commit"
182-
# run: git tag "v$GDEXT_PUBLISHED_VERSION"
174+
# run: git tag "v$PUBLISHED_CRATE_VERSION"
183175

184176
# - name: "Commit raw changes"
185177
# # Note: first block was for an alternative approach, where a separate `releases` branch tracks deployments.
@@ -194,7 +186,7 @@ jobs:
194186
# rsync -av --ignore-existing /tmp/repo/ .
195187
#
196188
# git add .
197-
# git commit -m "Repo state for v${{ env.GDEXT_PUBLISHED_VERSION }}"
189+
# git commit -m "Repo state for v${{ env.PUBLISHED_CRATE_VERSION }}"
198190

199191
- name: "Apply #[doc(cfg(...))]"
200192
# Skip --rustfmt, as it causes weird reformatting of quote! {} statements.
@@ -206,27 +198,69 @@ jobs:
206198
git config user.name "Godot-Rust Automation"
207199
git config user.email "GodotRust@users.noreply.github.com"
208200
git switch -c tmp
209-
git commit -am "v${{ env.GDEXT_PUBLISHED_VERSION }} (with doc attributes)"
201+
git commit -am "v${{ env.PUBLISHED_CRATE_VERSION }} (with doc attributes)"
210202
211-
- name: "Tag processed commit + push"
203+
- name: "Tag post-processed library, commit + push, remove trigger tag"
212204
run: |
213-
docTag="docs-v$GDEXT_PUBLISHED_VERSION"
205+
docTag="v$PUBLISHED_CRATE_VERSION"
214206
git tag "$docTag"
215207
git push origin "$docTag"
208+
git push origin --delete "trigger-v$PUBLISHED_CRATE_VERSION"
209+
210+
211+
# Keep all in sync with minimal-ci and full-ci.
212+
unit-test:
213+
runs-on: ubuntu-latest
214+
needs:
215+
- validation # for outputs
216+
- docs-and-commit
217+
steps:
218+
- uses: actions/checkout@v4
219+
with:
220+
ref: 'v${{ needs.validation.outputs.PUBLISHED_CRATE_VERSION }}'
221+
222+
- name: "Install Rust (uncached)"
223+
run: rustup update stable
224+
225+
- name: "Compile and run test"
226+
run: cargo test $CLIPPY_TEST_FEATURES
227+
228+
229+
godot-itest:
230+
name: godot-itest
231+
runs-on: ubuntu-latest
232+
needs:
233+
- validation # for outputs
234+
- docs-and-commit
235+
timeout-minutes: 15
236+
steps:
237+
- uses: actions/checkout@v4
238+
with:
239+
ref: 'v${{ needs.validation.outputs.PUBLISHED_CRATE_VERSION }}'
240+
241+
- name: "Run Godot integration test"
242+
uses: ./.github/composite/godot-itest
243+
with:
244+
artifact-name: godot-linux-${{ env.GODOT_ARTIFACT_VERSION }}
245+
godot-binary: godot.linuxbsd.editor.dev.x86_64
246+
rust-extra-args: --features itest/codegen-full
247+
rust-toolchain: stable
248+
216249

217250
publish:
218251
runs-on: ubuntu-latest
219252
if: ${{ github.event.inputs.skip-release != 'y' }}
220253
environment: 'Crates.io'
221254
needs:
222-
- validation
223-
- docs-and-commit
255+
- validation # for outputs
256+
- unit-test
257+
- godot-itest
224258
steps:
225259
# Note: we cannot dry-run the publishing, since crates depend on each other, and dry-run will fail if they aren't yet on crates.io.
226260
# Sleep to leave crates.io and docs.rs some time to index the dependencies, before releasing dependents.
227261
- uses: actions/checkout@v4
228262
with:
229-
ref: 'v${{ needs.validation.outputs.GDEXT_PUBLISHED_VERSION }}'
263+
ref: 'v${{ needs.validation.outputs.PUBLISHED_CRATE_VERSION }}'
230264

231265
- name: "Install Rust (uncached)"
232266
run: rustup update stable
@@ -243,5 +277,5 @@ jobs:
243277
exit 2
244278
}
245279
echo "Wait..."
246-
sleep 10s
280+
sleep 5s
247281
done

0 commit comments

Comments
 (0)