Skip to content

Commit 1e4ab8b

Browse files
bors[bot]Bromeon
andauthored
Merge #856
856: Minimal dependency versions + local check script + more r=Bromeon a=Bromeon ### Local `check.sh` script Remove the outdated pre-commit hook, replaced with bash script to run checks locally. You can execute this script to run tests, formatting, clippy etc. All with the right settings as expected by our CI. ### Dependency policy Dependencies in all `Cargo.toml` files have been downgraded to their minimum compatible version of the current major/minor branch (e.g. `2.1.3` -> `2`, `0.6.5` -> `0.6`). This increases compatibility with user dependencies, while still serving the latest versions (with bugfixes/improvements) to users by default. Further: * Add CI job to verify minimal dependency versions. * Remove explicit versions for intra-dependencies (i.e. `0.9.3` when referring to another `gdnative` crate). * Update parking_lot (0.11 -> 0.12) and glam (0.19 -> 0.20). ### Chores * Fix nightly clippy yet another time * Add `im` and `im-rc` to cargo-deny * Minor changelog update * Formatting in CI (semicolons) * .gitignore update Co-authored-by: Jan Haller <[email protected]>
2 parents 376ef8c + 6c05d02 commit 1e4ab8b

File tree

133 files changed

+414
-384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+414
-384
lines changed

.github/composite/rust/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
required: false
1212
description: "Components array"
1313
default: ''
14+
cache-key:
15+
required: false
16+
description: "Extra key to resolve cache"
17+
default: ''
1418

1519
runs:
1620
using: "composite"
@@ -24,3 +28,5 @@ runs:
2428

2529
# For notes about the cache, see 'Full CI' workflow
2630
- uses: Swatinem/rust-cache@v1
31+
with:
32+
sharedKey: ${{ inputs.cache-key }}

.github/workflows/full-ci.yml

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
with:
5656
components: rustfmt
5757
- name: "Check rustfmt"
58-
run: cargo fmt --all -- --check;
58+
run: cargo fmt --all -- --check
5959

6060
clippy:
6161
name: clippy${{ matrix.rust.postfix }}
@@ -77,7 +77,7 @@ jobs:
7777
rust: ${{ matrix.rust.toolchain }}
7878
components: clippy
7979
- name: "Check clippy"
80-
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;
80+
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
8181

8282
cargo-deny:
8383
runs-on: ubuntu-latest
@@ -123,20 +123,34 @@ jobs:
123123
- os: { id: ubuntu-latest, name: linux }
124124
rust: { toolchain: '1.51', postfix: ' (msrv 1.51)' }
125125
testflags: '-- --skip ui_tests'
126+
- os: { id: ubuntu-latest, name: linux }
127+
rust: { toolchain: 'stable', postfix: ' (minimal-deps)', special: 'minimal-deps' }
126128
runs-on: ${{ matrix.os.id }}
127129
steps:
128130
- uses: actions/checkout@v2
131+
- name: "Install nightly Rust (minimal-deps only)"
132+
uses: actions-rs/toolchain@v1
133+
with:
134+
profile: minimal
135+
toolchain: nightly
136+
override: false # use selected toolchain for remainder of this step
137+
components: cargo
138+
if: ${{ matrix.rust.special == 'minimal-deps' }}
139+
- name: "Install minimal dependency versions from Cargo"
140+
run: cargo +nightly update -Z minimal-versions
141+
if: ${{ matrix.rust.special == 'minimal-deps' }}
129142
- name: "Install Rust"
130143
uses: ./.github/composite/rust
131144
with:
132145
rust: ${{ matrix.rust.toolchain }}
146+
cache-key: ${{ matrix.rust.special }} # 'minimal-deps' or empty/not defined
133147
- name: "Install LLVM"
134148
uses: ./.github/composite/llvm
135149
if: ${{ matrix.os.id == 'windows-latest' }}
136150
- name: "Compile tests"
137-
run: cargo test --workspace --features ${GDRUST_FEATURES} --no-run;
151+
run: cargo test --workspace --features ${GDRUST_FEATURES} --no-run
138152
- name: "Test"
139-
run: cargo test --workspace --features ${GDRUST_FEATURES} ${{ matrix.testflags }};
153+
run: cargo test --workspace --features ${GDRUST_FEATURES} ${{ matrix.testflags }}
140154

141155
build-release:
142156
name: build-release-${{ matrix.os.name }}
@@ -162,7 +176,7 @@ jobs:
162176
uses: ./.github/composite/llvm
163177
if: ${{ matrix.os.id == 'windows-latest' }}
164178
- name: "Release build (check only)"
165-
run: cargo check --release;
179+
run: cargo check --release
166180

167181
build-ios:
168182
needs: rustfmt
@@ -179,21 +193,21 @@ jobs:
179193
# rust: ${{ matrix.rust.toolchain }}
180194
- name: "Install cargo-dinghy"
181195
run: |
182-
rustup target add x86_64-apple-ios;
183-
curl -L https://github.com/sonos/dinghy/releases/download/0.4.62/cargo-dinghy-macos-0.4.62.tgz -o cargo-dinghy-macos.tar.gz;
184-
tar -zxvf cargo-dinghy-macos.tar.gz;
185-
mkdir -p $HOME/.cargo/bin;
186-
cp cargo-dinghy-0.4.62/cargo-dinghy $HOME/.cargo/bin;
196+
rustup target add x86_64-apple-ios
197+
curl -L https://github.com/sonos/dinghy/releases/download/0.4.62/cargo-dinghy-macos-0.4.62.tgz -o cargo-dinghy-macos.tar.gz
198+
tar -zxvf cargo-dinghy-macos.tar.gz
199+
mkdir -p $HOME/.cargo/bin
200+
cp cargo-dinghy-0.4.62/cargo-dinghy $HOME/.cargo/bin
187201
- name: "Cross-compile to iOS"
188202
run: |
189-
RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1);
190-
export SIM_ID=$(xcrun simctl create My-iphone11 com.apple.CoreSimulator.SimDeviceType.iPhone-11 $RUNTIME_ID);
191-
xcrun simctl boot $SIM_ID;
192-
cd gdnative-core;
193-
cargo dinghy --platform auto-ios-x86_64 test;
194-
cd ..;
195-
cd gdnative-sys;
196-
cargo dinghy --platform auto-ios-x86_64 test;
203+
RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1)
204+
export SIM_ID=$(xcrun simctl create My-iphone11 com.apple.CoreSimulator.SimDeviceType.iPhone-11 $RUNTIME_ID)
205+
xcrun simctl boot $SIM_ID
206+
cd gdnative-core
207+
cargo dinghy --platform auto-ios-x86_64 test
208+
cd ..
209+
cd gdnative-sys
210+
cargo dinghy --platform auto-ios-x86_64 test
197211
198212
build-android:
199213
# Note: even though Android builds for another architecture than Linux, it can reuse downloaded crates (source code, maybe 'cargo check').
@@ -211,16 +225,16 @@ jobs:
211225
# rust: ${{ matrix.rust.toolchain }}
212226
- name: "Install Java + NDK"
213227
run: |
214-
# aarch64 and armv7 cover most Android phones & tablets.;
215-
rustup target add aarch64-linux-android armv7-linux-androideabi;
216-
sudo apt-get update;
217-
sudo apt-get install llvm-dev libclang-dev clang g++-multilib gcc-multilib libc6-dev libc6-dev-arm64-cross;
228+
# aarch64 and armv7 cover most Android phones & tablets.
229+
rustup target add aarch64-linux-android armv7-linux-androideabi
230+
sudo apt-get update
231+
sudo apt-get install llvm-dev libclang-dev clang g++-multilib gcc-multilib libc6-dev libc6-dev-arm64-cross
218232
- name: "Build Rust for targets: aarch64-linux-android, armv7-linux-androideabi"
219233
run: |
220234
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang++
221235
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++
222-
cargo build --target aarch64-linux-android --release;
223-
cargo build --target armv7-linux-androideabi --release;
236+
cargo build --target aarch64-linux-android --release
237+
cargo build --target armv7-linux-androideabi --release
224238
env:
225239
ANDROID_NDK_VERSION: 21.4.7075529
226240

.github/workflows/minimal-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
rust: stable
4141
components: rustfmt
4242
- name: "Check rustfmt"
43-
run: cargo fmt --all -- --check;
43+
run: cargo fmt --all -- --check
4444

4545
clippy:
4646
runs-on: ubuntu-latest
@@ -53,7 +53,7 @@ jobs:
5353
rust: stable
5454
components: clippy
5555
- name: "Check clippy"
56-
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;
56+
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
5757

5858
unit-test:
5959
runs-on: ubuntu-latest
@@ -62,9 +62,9 @@ jobs:
6262
- name: "Install Rust"
6363
uses: ./.github/composite/rust
6464
- name: "Compile tests"
65-
run: cargo test --workspace --features ${GDRUST_FEATURES} --no-run;
65+
run: cargo test --workspace --features ${GDRUST_FEATURES} --no-run
6666
- name: "Test"
67-
run: cargo test --workspace --features ${GDRUST_FEATURES};
67+
run: cargo test --workspace --features ${GDRUST_FEATURES}
6868

6969
integration-test-godot:
7070
runs-on: ubuntu-latest

.github/workflows/release-version.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ jobs:
3838
env:
3939
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
4040
run: |
41-
(cd impl/proc_macros && cargo publish);
41+
(cd impl/proc-macros && cargo publish);
4242
sleep 1m;
4343
(cd gdnative-sys && cargo publish);
4444
sleep 1m;
4545
(cd gdnative-derive && cargo publish);
4646
sleep 1m;
4747
(cd gdnative-core && cargo publish);
4848
sleep 1m;
49-
(cd bindings_generator && cargo publish);
49+
(cd bindings-generator && cargo publish);
5050
sleep 1m;
5151
(cd gdnative-bindings && cargo publish);
5252
sleep 1m;

.gitignore

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1-
*/target
1+
# IDEs
2+
.vscode
3+
.idea
4+
5+
# Build and package artifacts
26
target
7+
*/target
38
*.rlib
49
**/Cargo.lock
5-
.vscode
6-
.idea
710

11+
# Godot
812
# ignore all files in test/project/lib/, except the .gitkeep as the directory should still be there
913
test/project/lib/*
1014
!test/project/lib/.gitkeep
11-
1215
**/.import/*
16+
/logs
1317

14-
#os specific
18+
# OS-specific
1519
.DS_Store
20+
21+
# User stuff
22+
/ignore

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8383
(Renames listed under _Changed_, safety removals under _Fixed_)
8484

8585
- Crate features
86-
- `nativescript` ([#812](https://github.com/godot-rust/godot-rust/pull/812))
86+
- `nativescript` ([#811](https://github.com/godot-rust/godot-rust/pull/811))
8787
- `bindings` ([#833](https://github.com/godot-rust/godot-rust/pull/833))
8888
- All redundant or unnecessarily nested modules (see _Changed_)
8989
- Deprecated symbols ([#828](https://github.com/godot-rust/godot-rust/pull/828))
@@ -134,6 +134,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
134134
- Automatic publishing of `master` docs ([#786](https://github.com/godot-rust/godot-rust/pull/786))
135135
- Issue templates ([#807](https://github.com/godot-rust/godot-rust/pull/807))
136136
- Add `cargo-deny` to CI ([#849](https://github.com/godot-rust/godot-rust/pull/849))
137+
- Add CI job which tests minimal dependencies ([#856](https://github.com/godot-rust/godot-rust/pull/856))
137138

138139

139140
## [0.9.3] - 2021-02-02

CONTRIBUTING.md

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,62 @@
1-
# Contributing to godot's rust bindings.
1+
# Contributing to the godot-rust library
22

33
The godot-rust bindings developers welcome contribution from everyone. Here are the guidelines if you are thinking of helping us:
44

5-
## Contributions
65

7-
Contributions should be made in the form of GitHub pull requests (PRs). Each pull request will be reviewed by a core contributor (someone with permission to land patches) and either landed in the main tree or given feedback for changes that would be required.
6+
## Submitting a PR
87

9-
When opening a PR, our continuous integration (CI) pipeline will automatically perform a few basic checks (formatting, lints, unit tests). Please make sure those checks pass, adjusting your code if necessary.
8+
Contributions should be made in the form of GitHub pull requests (PRs). Each pull request will be reviewed by the godot-rust team or other contributors.
109

11-
Should you wish to work on an issue, please claim it first by commenting on the GitHub issue that you want to work on it. This is to prevent duplicated efforts from contributors on the same issue.
1210

13-
## Getting started
11+
### Picking a task
1412

15-
Have a look at the [issues](https://github.com/godot-rust/godot-rust/issues) to find good tasks to start with.
13+
Have a look at the [issue tracker] to find good tasks to start with. Should you wish to work on an issue, please claim it first by commenting in it. This is to prevent duplicated efforts from contributors on the same issue.
1614

17-
## Pull Request Checklist
15+
We especially appreciate input on the issues labeled [`help wanted`]. The label [`good first issue`] encompasses issues which do not require a deep prior knowledge of the godot-rust intricacies and could be picked up by a newcomer.
1816

19-
- Branch from the master branch and, if needed, rebase to the current master branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes.
17+
You can also open a pull request directly without an associated issue. Note however that discussing the issue with other developers beforehand increases the chances of a PR being accepted, and may save time on both your and the reviewer's end. Such discussions can also happen in our Discord server.
2018

21-
- Use one commit per logical change. Often, PRs only consist of a single commit. If you change unrelated parts of the code, split it into separate commits.
2219

23-
- If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment.
20+
### Git workflow
2421

25-
- Whenever applicable, add tests relevant to the fixed bug or new feature.
22+
* Branch from the `master` branch and, if needed, rebase to the current `master` branch before submitting your pull request. If it doesn't merge cleanly, you may be asked to rebase your changes.
2623

27-
- Use `cargo fmt` to format your code.
24+
* Use one commit per logical change. Often, PRs only consist of a single commit. If you change unrelated parts of the code, split it into separate commits.
2825

29-
## Testing
26+
* If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment.
3027

31-
Everywhere: run `cargo test --workspace` from the root of the repository.
3228

33-
On GNU/Linux operating systems:
29+
### Writing tests
3430

35-
```
36-
cd test
37-
cargo build
38-
cp ../target/debug/libgdnative_test.so ./project/lib/
39-
godot --path ./project
40-
```
31+
Whenever applicable, add tests relevant to the fixed bug or new feature.
4132

42-
The `godot` command in the above snippet is your local installation of godot and may vary depending on how it was installed.
33+
Some types and functions can only be used if the engine is running. In order to test them, use the `godot_test!` macro, and explicitly invoke the test functions in [test/src/lib.rs](test/src/lib.rs). Don't hesitate to see how existing code does this.
4334

44-
### Automating tests
35+
36+
### Local and CI checks
4537

46-
If you are on a bash-compatible system, you can use the `pre-commit.sh` to automatically run your tests every time you try to commit code. You can install it with:
38+
The repository root contains a script `check.sh`. If you invoke it without arguments, it will run a list of basic checks locally. This tool also allows you to quickly build RustDoc documentation of changed APIs. Please run `./check.sh --help` for more information about its usage.
4739

48-
```sh
49-
$ ln -s ../../hooks/pre-commit.sh .git/hooks/pre-commit
50-
$ chmod +x .git/hooks/pre-commit
51-
```
40+
If you use Windows, you might consider using a Unix shell interpreter (e.g. one shipped with Git-for-Windows, or WSL2, or similar).
5241

53-
If you don't need to run tests on your commit, you can simply run `git commit --no-verify` to skip the pre-commit script. The pre-commit script handles a few edge cases as well, by stashing all of your changes before running tests, just in case your unstashed changes mask errors in the bare commit. This is especially useful if you've stopped working on something to make a quick patch.
42+
Additionally, when opening a PR, our continuous integration (CI) pipeline will automatically perform a few checks (formatting, lints, unit tests). Please make sure all of them pass, adjusting your code where necessary.
5443

55-
## Writing tests
56-
57-
Some types can only be used if the engine is running, in order to test them, use the `godot_test!` macro (see examples in [variant.rs](gdnative/src/variant.rs)), and explicitly invoke the test functions in [test/src/lib.rs](test/src/lib.rs).
5844

5945
## Communication
6046

61-
Primary communication between developers of the project happens on the `godot-rust` Discord server. [Invite link here](https://discord.gg/FNudpBD).
47+
Primary communication between developers of the project happens on the `godot-rust` Discord server. [Invite link here][godot-rust-discord].
6248

63-
For questions about using `godot-rust` the `#gdnative` channel on the [Godot Engine community Discord server](https://godotengine.org/community) can be used.
64-
On IRC the `#godotengine-gdnative` channel on freenode can be used for questions as well.
49+
For questions about Godot, check out the options on the [Godot community page][godot-community]. For example, their Discord server hosts a `#gdnative-dev` channel for questions regarding GDNative interface. The contributor chat is helpful in case of discussions about Godot's own design and implementation.
6550

66-
If you are only interested in occasional announcements and showcases, follow [@GodotRust on Twitter](https://twitter.com/GodotRust). For questions and design discussions, please use Discord.
51+
If you are only interested in occasional announcements and showcases, follow [@GodotRust on Twitter][godot-rust-twitter]. For questions and design discussions, please use Discord.
6752

6853
## License
6954

7055
Any contribution submitted for inclusion in the work by you shall be licensed under the [MIT license](LICENSE.md), without any additional terms or conditions.
56+
57+
[issue tracker]: https://github.com/godot-rust/godot-rust/issues
58+
[`help wanted`]: https://github.com/godot-rust/godot-rust/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22
59+
[`good first issue`]: https://github.com/godot-rust/godot-rust/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
60+
[godot-community]: https://godotengine.org/community
61+
[godot-rust-discord]: https://discord.gg/FNudpBD
62+
[godot-rust-twitter]: https://twitter.com/GodotRust

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ members = [
77
"gdnative-derive",
88
"gdnative-sys",
99
"test",
10-
"bindings_generator",
11-
"examples/hello_world",
12-
"examples/spinning_cube",
13-
"examples/scene_create",
10+
"bindings-generator",
11+
"examples/hello-world",
12+
"examples/spinning-cube",
13+
"examples/scene-create",
1414
"examples/signals",
15-
"examples/dodge_the_creeps",
15+
"examples/dodge-the-creeps",
1616
"examples/resource",
17-
"examples/native_plugin",
17+
"examples/native-plugin",
1818
"examples/rpc",
19-
"examples/array_export",
20-
"impl/proc_macros"
19+
"examples/array-export",
20+
"impl/proc-macros"
2121
]
2222

2323
[profile.dev.package.miniserde]

0 commit comments

Comments
 (0)