Skip to content

Commit

Permalink
Merge pull request #48 from godot-rust/qol/ci-and-codegen
Browse files Browse the repository at this point in the history
CI + codegen improvements; header update
  • Loading branch information
Bromeon authored Dec 12, 2022
2 parents 862bc55 + 7488b2e commit 5513c00
Show file tree
Hide file tree
Showing 46 changed files with 1,194 additions and 1,050 deletions.
1 change: 1 addition & 0 deletions .github/composite/godot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ runs:

- name: "Install LLVM"
uses: ./.github/composite/llvm
# TODO only run it on systems needed

- name: "Build godot-rust"
run: |
Expand Down
106 changes: 71 additions & 35 deletions .github/workflows/minimal-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ on:

env:
GDEXT_FEATURES: 'godot-core/convenience'
GDEXT_CRATE_ARGS: '-p godot-codegen -p godot-ffi -p godot-core -p godot-macros -p godot'

defaults:
run:
Expand All @@ -37,51 +38,86 @@ defaults:
# cancel-in-progress: true

jobs:
# rustfmt:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: "Install Rust"
# uses: ./.github/composite/rust
# with:
# rust: stable
# components: rustfmt
# - name: "Check rustfmt"
# run: cargo fmt --all -- --check

# unit-test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: "Install Rust"
# uses: ./.github/composite/rust
#
# # TODO seems unneeded in GDNative...?
# - name: "Install LLVM"
# uses: ./.github/composite/llvm
#
# - name: "Compile tests"
# run: cargo test --workspace --features ${GDEXT_FEATURES} --no-run
#
# - name: "Test"
# run: cargo test --workspace --features ${GDEXT_FEATURES}
rustfmt:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: "Install Rust"
uses: ./.github/composite/rust
with:
rust: stable
components: rustfmt
- name: "Check rustfmt"
run: cargo fmt --all -- --check

unit-test:
name: test (${{ matrix.name }})
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
fail-fast: false # cancel all jobs as soon as one fails?
matrix:
# Order this way because macOS typically has the longest duration, followed by Windows, so it benefits total workflow execution time.
# Additionally, the 'linux (msrv *)' special case will then be listed next to the other 'linux' jobs.
# Note: Windows uses '--target x86_64-pc-windows-msvc' by default as Cargo argument.
include:
- name: macos
os: macos-11
rust-toolchain: stable

- name: windows
os: windows-latest
rust-toolchain: stable-x86_64-pc-windows-msvc

# Don't use latest Ubuntu (22.04) as it breaks lots of ecosystem compatibility.
# If ever moving to ubuntu-latest, need to manually install libtinfo5 for LLVM.
- name: linux
os: ubuntu-20.04
rust-toolchain: stable

steps:
- uses: actions/checkout@v3

- name: "Install Rust"
uses: ./.github/composite/rust

- name: "Install minimal dependency versions from Cargo"
run: cargo +nightly update -Z minimal-versions
if: ${{ matrix.rust.special == 'minimal-deps' }}

- name: "Install Rust"
uses: ./.github/composite/rust
with:
rust: stable
cache-key: ${{ matrix.rust.special }} # 'minimal-deps' or empty/not defined

- name: "Install LLVM"
uses: ./.github/composite/llvm
if: matrix.name == 'macos'

- name: "Compile tests"
run: cargo test $GDEXT_CRATE_ARGS --features unit-test,$GDEXT_FEATURES --no-run

- name: "Test"
run: cargo test $GDEXT_CRATE_ARGS --features unit-test,$GDEXT_FEATURES ${{ matrix.testflags }}


integration-test-godot:
name: itest-godot-${{ matrix.name }}
timeout-minutes: 15
name: itest-godot (${{ matrix.name }})
runs-on: ${{ matrix.os }}
continue-on-error: false
timeout-minutes: 24
strategy:
fail-fast: false # cancel all jobs as soon as one fails?
matrix:
# Order this way because macOS typically has the longest duration, followed by Windows, so it benefits total workflow execution time.
# Additionally, the 'linux (msrv *)' special case will then be listed next to the other 'linux' jobs.
# Note: Windows uses '--target x86_64-pc-windows-msvc' by default as Cargo argument.
include:
# - name: macos
# os: macos-12
# rust-toolchain: stable
# godot-binary: godot.macos.editor.dev.x86_64
- name: macos
os: macos-12
rust-toolchain: stable
godot-binary: godot.macos.editor.dev.x86_64

- name: windows
os: windows-latest
Expand All @@ -106,7 +142,7 @@ jobs:
#godot_ver: ${{ matrix.godot }}

license-guard:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.ref != 'refs/heads/master'
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions examples/dodge-the-creeps/godot/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[ext_resource type="PackedScene" uid="uid://4vwrqjegqwpj" path="res://Player.tscn" id="3"]
[ext_resource type="PackedScene" uid="uid://b6f427lco0mqk" path="res://Hud.tscn" id="4"]
[ext_resource type="AudioStream" uid="uid://q2pf4fr8d0ks" path="res://art/House In a Forest Loop.ogg" id="5"]
[ext_resource type="AudioStream" uid="uid://dw26fpygeag8o" path="res://art/gameover.wav" id="6"]
[ext_resource type="AudioStream" uid="uid://jy3fk3ujnkpl" path="res://art/House In a Forest Loop.ogg" id="5"]
[ext_resource type="AudioStream" uid="uid://cfb6f1t1p6axm" path="res://art/gameover.wav" id="6"]

[sub_resource type="Curve2D" id="1"]
_data = {
Expand Down Expand Up @@ -52,4 +52,4 @@ stream = ExtResource("6")
[connection signal="timeout" from="MobTimer" to="." method="on_mob_timer_timeout"]
[connection signal="timeout" from="ScoreTimer" to="." method="on_score_timer_timeout"]
[connection signal="timeout" from="StartTimer" to="." method="on_start_timer_timeout"]
[connection signal="start_game" from="Hud" to="." method="new_game" flags=3]
[connection signal="start_game" from="Hud" to="." method="new_game" flags=3]
13 changes: 7 additions & 6 deletions examples/dodge-the-creeps/godot/Mob.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[gd_scene load_steps=9 format=3 uid="uid://rkdnhqgf2hpj"]

[ext_resource type="Texture2D" uid="uid://yqglrrsx7j1f" path="res://art/enemyFlyingAlt_1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://bpot8awhdn6ph" path="res://art/enemyFlyingAlt_2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://bu4221t7qpa7d" path="res://art/enemyWalking_1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://booij5t7h4efb" path="res://art/enemyWalking_2.png" id="5"]
[ext_resource type="Texture2D" uid="uid://5lvm88ij4jqn" path="res://art/enemySwimming_1.png" id="6"]
[ext_resource type="Texture2D" uid="uid://bng45cvsgufqc" path="res://art/enemySwimming_2.png" id="7"]
[ext_resource type="Texture2D" uid="uid://ch2bfqohapw00" path="res://art/enemyFlyingAlt_1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://uhy7j2necuj2" path="res://art/enemyFlyingAlt_2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://dd56ab6ouwms7" path="res://art/enemyWalking_1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://dulw5juue3ivn" path="res://art/enemyWalking_2.png" id="5"]
[ext_resource type="Texture2D" uid="uid://cnwoep5enlhrj" path="res://art/enemySwimming_1.png" id="6"]
[ext_resource type="Texture2D" uid="uid://eqshh2v5g0dn" path="res://art/enemySwimming_2.png" id="7"]

[sub_resource type="SpriteFrames" id="1"]
animations = [{
Expand Down Expand Up @@ -37,6 +37,7 @@ gravity_scale = 0.0
scale = Vector2(0.75, 0.75)
frames = SubResource("1")
animation = &"walk"
playing = true

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
Expand Down
9 changes: 5 additions & 4 deletions examples/dodge-the-creeps/godot/Player.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[gd_scene load_steps=12 format=3 uid="uid://4vwrqjegqwpj"]

[ext_resource type="Texture2D" uid="uid://ftkxr8r4qghp" path="res://art/playerGrey_walk1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://couyhcegeihme" path="res://art/playerGrey_walk2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://b4yyoafu8bi0q" path="res://art/playerGrey_up1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://bko65a0nd66st" path="res://art/playerGrey_up2.png" id="5"]
[ext_resource type="Texture2D" uid="uid://bei50n77gmlml" path="res://art/playerGrey_walk1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://bdkoaa5a3c44c" path="res://art/playerGrey_walk2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://qpg7fsh1wnd6" path="res://art/playerGrey_up1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://c4vx8t665is8j" path="res://art/playerGrey_up2.png" id="5"]

[sub_resource type="SpriteFrames" id="1"]
animations = [{
Expand Down Expand Up @@ -41,6 +41,7 @@ scale_curve = SubResource("6")
color_ramp = SubResource("4")

[node name="Player" type="Player"]
visible = false
z_index = 10

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
Expand Down
Loading

0 comments on commit 5513c00

Please sign in to comment.