Skip to content

Commit 9a4c69a

Browse files
bors[bot]Bromeon
andauthored
Merge #865
865: Publishing CI + v0.10.0-rc.0 preparation r=Bromeon a=Bromeon Further automates publishing to crates.io and adds extra validation steps. Adds a local script to replace `Cargo.toml` versions. Prepares for `0.10.0-rc.0` release. bors r+ Co-authored-by: Jan Haller <[email protected]>
2 parents 5f38883 + a7e5b06 commit 9a4c69a

File tree

11 files changed

+193
-58
lines changed

11 files changed

+193
-58
lines changed

.github/workflows/release-version.yml

Lines changed: 106 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,133 @@
1-
name: Publish to crates.io
1+
name: "Publish to crates.io"
22

33
on:
44
push:
55
branches:
66
- '!**'
77
tags:
8-
- '0.9.[0-9]+'
9-
- '0.10.[0-9]+'
8+
- '0.10.[0-9]+-?*'
109

1110
env:
1211
GDRUST_FEATURES: "gdnative/async,gdnative/serde"
1312

13+
# Crates to publish -- important, this doesn't work when there are spaces in any of the paths!
14+
GDRUST_CRATES: >
15+
impl/proc-macros
16+
gdnative-sys
17+
gdnative-derive
18+
gdnative-core
19+
bindings-generator
20+
gdnative-bindings
21+
gdnative-async
22+
gdnative
23+
1424
defaults:
1525
run:
1626
shell: bash
1727

1828
jobs:
19-
publish:
29+
validation:
2030
runs-on: ubuntu-latest
21-
environment: Deploy
2231
steps:
2332
- uses: actions/checkout@v2
2433

25-
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f
34+
# sed: https://unix.stackexchange.com/a/589584
35+
- name: "Interpret tag version"
36+
run: |
37+
version=$(echo "$GITHUB_REF" | sed -n "s#refs/tags/\(.*\)#\1#p")
38+
[ -z "$version" ] && {
39+
printf "\nError: Failed to parse '$GITHUB_REF'.\n"
40+
exit 2
41+
}
42+
43+
echo "Published version: $version"
44+
echo "GDRUST_PUBLISHED_VERSION=$version" >> $GITHUB_ENV
45+
46+
- name: "Verify that Cargo.toml versions match ${{ env.GDRUST_PUBLISHED_VERSION }}"
47+
run: |
48+
echo "Checking crate versions..."
49+
50+
# Check if each Cargo.toml has that version
51+
IFS=' ' read -r -a publishedCrates <<< "$GDRUST_CRATES"
52+
for crate in "${publishedCrates[@]}"; do
53+
readVersion=$(grep -Po '^version = "\K[^"]*' "$crate/Cargo.toml")
54+
printf "* $crate -> $readVersion"
55+
56+
if [[ "$readVersion" != "$GDRUST_PUBLISHED_VERSION" ]]; then
57+
printf " ERROR\n"
58+
versionMismatch="1"
59+
else
60+
printf "\n"
61+
fi
62+
done
63+
64+
if [[ -n "$versionMismatch" ]]; then
65+
printf "\nError: At least one crate has a version mismatching the git tag.\n"
66+
exit 2
67+
else
68+
printf "\nAll versions OK.\n"
69+
fi
70+
71+
test:
72+
runs-on: ubuntu-latest
73+
needs: validation
74+
steps:
75+
- uses: actions/checkout@v2
76+
- uses: actions-rs/toolchain@v1
2677
with:
2778
profile: minimal
2879
toolchain: stable
29-
components: rustfmt, clippy
80+
override: true
81+
- name: "Compile tests"
82+
run: cargo test --workspace --features ${GDRUST_FEATURES} --no-run
83+
- name: "Test"
84+
run: cargo test --workspace --features ${GDRUST_FEATURES}
3085

31-
- name: "Sanity tests"
32-
run: |
33-
cargo fmt --all -- --check;
34-
cargo clippy --workspace --features ${GDRUST_FEATURES} -- -D clippy::style -D clippy::complexity -D clippy::perf -D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented;
35-
cargo test --workspace --features ${GDRUST_FEATURES};
86+
clippy:
87+
runs-on: ubuntu-latest
88+
needs: validation
89+
steps:
90+
- uses: actions/checkout@v2
91+
- uses: actions-rs/toolchain@v1
92+
with:
93+
profile: minimal
94+
toolchain: stable
95+
override: true
96+
components: clippy
97+
- name: "Check clippy"
98+
run: cargo clippy --workspace --features ${GDRUST_FEATURES} -- -D clippy::style -D clippy::complexity -D clippy::perf -D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented
99+
100+
rustfmt:
101+
runs-on: ubuntu-latest
102+
needs: validation
103+
steps:
104+
- uses: actions/checkout@v2
105+
- uses: actions-rs/toolchain@v1
106+
with:
107+
profile: minimal
108+
toolchain: stable
109+
override: true
110+
components: rustfmt
111+
- name: "Check rustfmt"
112+
run: cargo fmt --all -- --check
36113

37-
- name: "Publish to crates.io"
114+
publish:
115+
runs-on: ubuntu-latest
116+
environment: Deploy
117+
needs: [test, clippy, rustfmt]
118+
steps:
119+
# 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.
120+
# Sleep to leave crates.io and docs.rs some time to index the dependencies, before releasing dependents.
121+
- uses: actions/checkout@v2
122+
- name: "Execute crates.io publishing"
38123
env:
39124
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
40125
run: |
41-
(cd impl/proc-macros && cargo publish);
42-
sleep 1m;
43-
(cd gdnative-sys && cargo publish);
44-
sleep 1m;
45-
(cd gdnative-derive && cargo publish);
46-
sleep 1m;
47-
(cd gdnative-core && cargo publish);
48-
sleep 1m;
49-
(cd bindings-generator && cargo publish);
50-
sleep 1m;
51-
(cd gdnative-bindings && cargo publish);
52-
sleep 1m;
53-
(cd gdnative-async && cargo publish);
54-
sleep 1m;
55-
(cd gdnative && cargo publish);
126+
IFS=' ' read -r -a publishedCrates <<< "$GDRUST_CRATES"
127+
for crate in "${publishedCrates[@]}"; do
128+
(cd "$crate" && cargo publish) || {
129+
printf "\nError: Failed to publish $crate\n"
130+
exit 2
131+
}
132+
sleep 40s
133+
done

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,38 +30,38 @@ The bindings do _**not**_ support in-development Godot 4 versions at the moment.
3030

3131
Detailed setup is explained in [the _Getting Started_ section of the book](https://godot-rust.github.io/book/getting-started.html). In case of problems, consider also reading the [FAQ](https://godot-rust.github.io/book/faq/configuration.html).
3232

33-
### Latest `master` version + Godot 3.4
33+
### Latest released version
3434

35-
This is the recommended way of using godot-rust, if you want to benefit from latest features.
36-
After `bindgen` dependencies are installed, add the `gdnative` crate as a dependency, and set the crate type to `cdylib`:
35+
This is the recommended way of using godot-rust. After `bindgen` dependencies and a current Godot version are installed, add the `gdnative` crate as a dependency, and set the crate type to `cdylib`:
3736

3837
```toml
3938
[dependencies]
40-
gdnative = { git = "https://github.com/godot-rust/godot-rust.git" }
39+
gdnative = "0.10.0-rc.0"
4140

4241
[lib]
4342
crate-type = ["cdylib"]
4443
```
4544

46-
### Godot 3.2.3-stable
45+
### Latest GitHub version
4746

48-
To access the last released version on crates.io, use the following. Note that there have been significant API changes since v0.9.3 -- if you are starting to use godot-rust, we recommend using the `master` version instead.
47+
If you would like to benefit from cutting-edge features and bugfixes, you can use the GitHub version. We have a relatively sophisticated CI and test suite for basic stability, but the GitHub version is typically more experimental and less battle-tested than a `crates.io` release. We also do not guarantee any SemVer compatibility here.
4948

5049
```toml
5150
[dependencies]
52-
gdnative = "0.9.3"
51+
gdnative = { git = "https://github.com/godot-rust/godot-rust.git" }
5352

5453
[lib]
5554
crate-type = ["cdylib"]
5655
```
5756

57+
5858
### Custom builds
5959

6060
To use the bindings with a different Godot version or a custom build of the engine, see [Custom Godot builds](https://godot-rust.github.io/book/advanced-guides/custom-godot.html) in the user guide.
6161

62-
### Async / `yield` support
62+
### Async/yield support
6363

64-
Async support is a work-in-progress, with a low-level API available in the `gdnative-async` crate. This crate is re-exported as `gdnative::tasks`, if the `async` feature is enabled on `gdnative`. See [this page](https://godot-rust.github.io/book/recipes/async-tokio.html) in the book for an introduction to use the async feature with Tokio.
64+
Async support is a work-in-progress, with a low-level API available in `gdnative::tasks`, if the `async` feature is enabled on `gdnative`. See [this page](https://godot-rust.github.io/book/recipes/async-tokio.html) in the book for an introduction to use the async feature with Tokio.
6565

6666
## Example
6767

bindings-generator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ documentation = "https://docs.rs/crate/gdnative_bindings_generator"
66
repository = "https://github.com/godot-rust/godot-rust"
77
homepage = "https://godot-rust.github.io/"
88
license = "MIT"
9-
version = "0.9.3"
9+
version = "0.10.0-rc.0"
1010
workspace = ".."
1111
edition = "2018"
1212

gdnative-async/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ description = "Runtime async support for godot-rust."
55
documentation = "https://docs.rs/crate/gdnative-async"
66
repository = "https://github.com/godot-rust/godot-rust"
77
homepage = "https://godot-rust.github.io/"
8-
version = "0.9.3"
8+
version = "0.10.0-rc.0"
99
license = "MIT"
1010
workspace = ".."
1111
edition = "2018"
1212

1313
[features]
1414

1515
[dependencies]
16-
gdnative-derive = { path = "../gdnative-derive" }
17-
gdnative-core = { path = "../gdnative-core" }
18-
gdnative-bindings = { path = "../gdnative-bindings" }
16+
gdnative-derive = { path = "../gdnative-derive", version = "=0.10.0-rc.0" }
17+
gdnative-core = { path = "../gdnative-core", version = "=0.10.0-rc.0" }
18+
gdnative-bindings = { path = "../gdnative-bindings", version = "=0.10.0-rc.0" }
1919
atomic-waker = "1"
2020
crossbeam-channel = "0.5"
2121
crossbeam-utils = "0.8"

gdnative-bindings/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "The Godot game engine's automatcally generated bindings to Godot
55
documentation = "https://docs.rs/crate/gdnative-bindings"
66
repository = "https://github.com/godot-rust/godot-rust"
77
homepage = "https://godot-rust.github.io/"
8-
version = "0.9.3"
8+
version = "0.10.0-rc.0"
99
license = "MIT"
1010
workspace = ".."
1111
edition = "2018"
@@ -16,10 +16,10 @@ one-class-one-file = []
1616
custom-godot = ["gdnative_bindings_generator/custom-godot"]
1717

1818
[dependencies]
19-
gdnative-sys = { path = "../gdnative-sys" }
20-
gdnative-core = { path = "../gdnative-core" }
19+
gdnative-sys = { path = "../gdnative-sys", version = "=0.10.0-rc.0" }
20+
gdnative-core = { path = "../gdnative-core", version = "=0.10.0-rc.0" }
2121
bitflags = "1"
2222
libc = "0.2"
2323

2424
[build-dependencies]
25-
gdnative_bindings_generator = { path = "../bindings-generator" }
25+
gdnative_bindings_generator = { path = "../bindings-generator", version = "=0.10.0-rc.0" }

gdnative-core/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "The Godot game engine's gdnative core bindings."
55
documentation = "https://docs.rs/crate/gdnative-core"
66
repository = "https://github.com/godot-rust/godot-rust"
77
homepage = "https://godot-rust.github.io/"
8-
version = "0.9.3"
8+
version = "0.10.0-rc.0"
99
license = "MIT"
1010
workspace = ".."
1111
edition = "2018"
@@ -16,8 +16,8 @@ gd-test = []
1616
type-tag-fallback = []
1717

1818
[dependencies]
19-
gdnative-sys = { path = "../gdnative-sys" }
20-
gdnative-impl-proc-macros = { path = "../impl/proc-macros" }
19+
gdnative-sys = { path = "../gdnative-sys", version = "=0.10.0-rc.0" }
20+
gdnative-impl-proc-macros = { path = "../impl/proc-macros", version = "=0.10.0-rc.0" }
2121
ahash = "0.7.6"
2222
approx = "0.5"
2323
atomic-take = "1"
@@ -30,4 +30,4 @@ parking_lot = "0.12"
3030
serde = { version = "1", features = ["derive"], optional = true }
3131

3232
[dev-dependencies]
33-
gdnative = { path = "../gdnative" } # for doc-tests
33+
gdnative = { path = "../gdnative", version = "=0.10.0-rc.0" } # for doc-tests

gdnative-derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "The Godot game engine's gdnative derive and procedural macros."
55
documentation = "https://docs.rs/crate/gdnative-derive"
66
repository = "https://github.com/godot-rust/godot-rust"
77
homepage = "https://godot-rust.github.io/"
8-
version = "0.9.3"
8+
version = "0.10.0-rc.0"
99
license = "MIT"
1010
workspace = ".."
1111
edition = "2018"

gdnative-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "Generated bindings to the Godot game engine's gdnative core types
55
documentation = "https://docs.rs/crate/gdnative-sys"
66
repository = "https://github.com/godot-rust/godot-rust"
77
homepage = "https://godot-rust.github.io/"
8-
version = "0.9.3"
8+
version = "0.10.0-rc.0"
99
build = "build.rs"
1010
license = "MIT"
1111
workspace = ".."

gdnative/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords = ["gamedev", "godot", "engine", "bindings"]
66
documentation = "https://docs.rs/crate/gdnative"
77
repository = "https://github.com/godot-rust/godot-rust"
88
homepage = "https://godot-rust.github.io/"
9-
version = "0.9.3"
9+
version = "0.10.0-rc.0"
1010
license = "MIT"
1111
workspace = ".."
1212
readme = "../README.md"
@@ -27,10 +27,10 @@ gd-test = ["gdnative-core/gd-test"]
2727
type-tag-fallback = ["gdnative-core/type-tag-fallback"]
2828

2929
[dependencies]
30-
gdnative-derive = { path = "../gdnative-derive" }
31-
gdnative-core = { path = "../gdnative-core" }
32-
gdnative-bindings = { path = "../gdnative-bindings" }
33-
gdnative-async = { path = "../gdnative-async", optional = true }
30+
gdnative-derive = { path = "../gdnative-derive", version = "=0.10.0-rc.0" }
31+
gdnative-core = { path = "../gdnative-core", version = "=0.10.0-rc.0" }
32+
gdnative-bindings = { path = "../gdnative-bindings", version = "=0.10.0-rc.0" }
33+
gdnative-async = { path = "../gdnative-async", version = "=0.10.0-rc.0", optional = true }
3434

3535
[dev-dependencies]
3636
trybuild = "1.0.18" # earrlier versions use broken termcolor 1.0.0

impl/proc-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors = ["The godot-rust developers"]
44
description = "Internal dependency of the gdnative bindings."
55
repository = "https://github.com/godot-rust/godot-rust"
66
homepage = "https://godot-rust.github.io/"
7-
version = "0.9.3"
7+
version = "0.10.0-rc.0"
88
license = "MIT"
99
workspace = "../.."
1010
edition = "2018"

0 commit comments

Comments
 (0)