Skip to content

Commit

Permalink
Merge #96
Browse files Browse the repository at this point in the history
96: No more unit-test special treatment, full clippy/test coverage, `check.sh` script, animation update r=Bromeon a=Bromeon

See commit messages for details.

Co-authored-by: Jan Haller <bromeon@gmail.com>
  • Loading branch information
bors[bot] and Bromeon authored Jan 28, 2023
2 parents 154b87f + 290afe3 commit 4ebdc5e
Show file tree
Hide file tree
Showing 32 changed files with 407 additions and 848 deletions.
51 changes: 51 additions & 0 deletions .github/composite/godot-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

name: godot
description: "Run Godot integration tests"

inputs:
artifact-name:
required: true
description: "Name of the compiled Godot artifact to download"

binary-filename:
required: true
description: "Filename of the Godot executable"


runs:
using: "composite"
steps:
- uses: actions/checkout@v3

# Replaces also backspaces on Windows, since they cause problems in Bash
- name: "Store variable to Godot binary"
run: |
runnerDir=$(echo "${{ runner.temp }}" | sed "s!\\\\!/!")
echo "RUNNER_DIR=$runnerDir" >> $GITHUB_ENV
echo "GODOT4_BIN=$runnerDir/godot_bin/${{ inputs.binary-filename }}" >> $GITHUB_ENV
shell: bash

# - name: "Check cache for installed Godot version"
# id: "cache-godot"
# uses: actions/cache@v3
# with:
# path: ${{ runner.temp }}/godot_bin
# key: ${{ inputs.artifact-name }}-v${{ inputs.godot-ver }}
# shell: bash

- name: "Download Godot artifact"
# if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
curl https://nightly.link/Bromeon/godot4-nightly/workflows/compile-godot/master/${{ inputs.artifact-name }}.zip \
-Lo artifact.zip \
--retry 3
unzip artifact.zip -d $RUNNER_DIR/godot_bin
shell: bash

- name: "Prepare Godot executable"
run: |
chmod +x $GODOT4_BIN
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,27 @@ inputs:
default: ''
description: "Extra command line arguments for 'cargo build', e.g. features"

with-llvm:
required: false
description: "Set to 'true' if LLVM should be installed"
default: ''


runs:
using: "composite"
steps:
- uses: actions/checkout@v3

# Replaces also backspaces on Windows, since they cause problems in Bash
- name: "Store variable to Godot binary"
run: |
runnerDir=$(echo "${{ runner.temp }}" | sed "s!\\\\!/!")
echo "RUNNER_DIR=$runnerDir" >> $GITHUB_ENV
echo "GODOT4_BIN=$runnerDir/godot_bin/${{ inputs.binary-filename }}" >> $GITHUB_ENV
shell: bash

# - name: "Check cache for installed Godot version"
# id: "cache-godot"
# uses: actions/cache@v3
# with:
# path: ${{ runner.temp }}/godot_bin
# key: ${{ inputs.artifact-name }}-v${{ inputs.godot-ver }}

- name: "Download Godot artifact"
# if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
curl https://nightly.link/Bromeon/godot4-nightly/workflows/compile-godot/master/${{ inputs.artifact-name }}.zip -Lo artifact.zip
unzip artifact.zip -d $RUNNER_DIR/godot_bin
shell: bash
- name: "Install Godot"
uses: ./.github/composite/godot-install
with:
artifact-name: ${{ inputs.artifact-name }}
binary-filename: ${{ inputs.binary-filename }}

# The chmod seems still necessary, although applied before uploading artifact. Possibly modes are not preserved.
# The `| xargs` pattern trims the output, since printed version may contain extra newline, which causes problems in env vars.
- name: "Inspect Godot version"
run: |
chmod +x $GODOT4_BIN
godotVer=$($GODOT4_BIN --version | xargs || true)
gitSha=$(echo $godotVer | sed -E "s/.+custom_build\.//")
echo "GODOT_BUILT_FROM=_Built from [\`$godotVer\`](https://github.com/godotengine/godot/commit/$gitSha)._" >> $GITHUB_ENV
Expand Down Expand Up @@ -89,10 +77,7 @@ runs:
uses: ./.github/composite/rust
with:
rust: ${{ inputs.rust-toolchain }}

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

- name: "Build godot-rust"
run: |
Expand Down
11 changes: 11 additions & 0 deletions .github/composite/rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,22 @@ inputs:
required: false
description: "Rust toolchain, e.g. 'stable' or 'nightly'"
default: stable

components:
required: false
description: "Components array"
default: ''

cache-key:
required: false
description: "Extra key to resolve cache"
default: ''

with-llvm:
required: false
description: "Set to 'true' if LLVM should be installed"
default: ''

runs:
using: "composite"
steps:
Expand All @@ -41,6 +48,10 @@ runs:
with:
shared-key: ${{ inputs.cache-key }}

- name: "Install LLVM"
uses: ./.github/composite/llvm
if: ${{ inputs.with-llvm == 'true' }}

- name: "Set environment variables used by toolchain"
run: |
echo CARGO_TERM_COLOR=always >> $GITHUB_ENV
Expand Down
3 changes: 2 additions & 1 deletion .github/external-config/licenserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ header:
paths:
- '**/*.rs'
- '**/*.gd'
- '**/*.sh'
- '.github/**/*.yml'

paths-ignore:
Expand All @@ -20,7 +21,7 @@ header:

language:
GDScript:
extensions: ['.gd']
extensions: ['.gd', '.sh']
comment_style_id: 'Hashtag'
Rust:
extensions: ['.rs']
Expand Down
74 changes: 31 additions & 43 deletions .github/workflows/full-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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'
# GDEXT_CRATE_ARGS: '-p godot-codegen -p godot-ffi -p godot-core -p godot-macros -p godot'

defaults:
run:
Expand Down Expand Up @@ -52,35 +52,18 @@ jobs:

# TODO get rid of Godot binary, once the JSON is either versioned or fetched from somewhere
# Replaces also backspaces on Windows, since they cause problems in Bash
- name: "Store variable to Godot binary"
run: |
runnerDir=$(echo "${{ runner.temp }}" | sed "s!\\\\!/!")
echo "RUNNER_DIR=$runnerDir" >> $GITHUB_ENV
echo "GODOT4_BIN=$runnerDir/godot_bin/godot.linuxbsd.editor.dev.x86_64" >> $GITHUB_ENV
# - name: "Check cache for installed Godot version"
# id: "cache-godot"
# uses: actions/cache@v3
# with:
# path: ${{ runner.temp }}/godot_bin
# key: ${{ inputs.artifact-name }}-v${{ inputs.godot-ver }}

- name: "Download Godot artifact"
# if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
curl https://nightly.link/Bromeon/godot4-nightly/workflows/compile-godot/master/godot-linux.zip -Lo artifact.zip
unzip artifact.zip -d $RUNNER_DIR/godot_bin
- name: "Prepare Godot executable"
run: |
chmod +x $GODOT4_BIN
- name: "Install Godot"
uses: ./.github/composite/godot-install
with:
artifact-name: godot-linux
binary-filename: godot.linuxbsd.editor.dev.x86_64

- name: "Check clippy"
run: cargo clippy --features $GDEXT_FEATURES $GDEXT_CRATE_ARGS -- --cfg gdext_clippy -D clippy::style -D clippy::complexity -D clippy::perf -D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented
run: cargo clippy -- -D clippy::style -D clippy::complexity -D clippy::perf -D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented


unit-test:
name: unit-test (${{ matrix.name }})
name: unit-test (${{ matrix.name }}${{ matrix.rust-special }})
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
Expand All @@ -93,21 +76,25 @@ jobs:
- name: macos
os: macos-11
rust-toolchain: stable
godot-binary: godot.macos.editor.dev.x86_64

- name: windows
os: windows-latest
rust-toolchain: stable-x86_64-pc-windows-msvc
godot-binary: godot.windows.editor.dev.x86_64.exe

# 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
godot-binary: godot.linuxbsd.editor.dev.x86_64

- name: linux-minimal-deps
- name: linux
os: ubuntu-20.04
rust-toolchain: stable
rust-special: minimal-deps
rust-special: -minimal-deps
godot-binary: godot.linuxbsd.editor.dev.x86_64

steps:
- uses: actions/checkout@v3
Expand All @@ -117,35 +104,36 @@ jobs:
with:
rust: stable
cache-key: ${{ matrix.rust-special }} # 'minimal-deps' or empty/not defined
with-llvm: ${{ matrix.name == 'macos' }}

- name: "Install Rust nightly (minimal deps)"
uses: ./.github/composite/rust
with:
rust: nightly
cache-key: minimal-deps-nightly
if: ${{ matrix.rust-special == 'minimal-deps' }}
if: ${{ matrix.rust-special == '-minimal-deps' }}

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

- name: "Install LLVM"
uses: ./.github/composite/llvm
if: matrix.name == 'macos'
# TODO get rid of Godot binary, once the JSON is either versioned or fetched from somewhere
# Replaces also backspaces on Windows, since they cause problems in Bash
- name: "Install Godot"
uses: ./.github/composite/godot-install
with:
artifact-name: godot-${{ matrix.name }}
binary-filename: ${{ matrix.godot-binary }}

- name: "Compile tests"
run: cargo test $GDEXT_CRATE_ARGS --features $GDEXT_FEATURES --no-run
env:
RUSTFLAGS: --cfg=gdext_test
run: cargo test --no-run

- name: "Test"
run: cargo test $GDEXT_CRATE_ARGS --features $GDEXT_FEATURES
env:
RUSTFLAGS: --cfg=gdext_test
run: cargo test $GDEXT_FEATURES


itest-godot:
name: itest-godot (${{ matrix.name }})
godot-itest:
name: godot-itest (${{ matrix.name }})
runs-on: ${{ matrix.os }}
continue-on-error: false
timeout-minutes: 24
Expand Down Expand Up @@ -177,11 +165,11 @@ jobs:
- uses: actions/checkout@v3

- name: "Run Godot integration test"
uses: ./.github/composite/godot
uses: ./.github/composite/godot-itest
with:
artifact-name: godot-${{ matrix.name }}
binary-filename: ${{ matrix.godot-binary }}
#godot_ver: ${{ matrix.godot }}
with-llvm: ${{ matrix.name == 'macos' }}


license-guard:
Expand All @@ -206,7 +194,7 @@ jobs:
- rustfmt
- clippy
- unit-test
- itest-godot
- godot-itest
- license-guard
runs-on: ubuntu-20.04
steps:
Expand Down
Loading

0 comments on commit 4ebdc5e

Please sign in to comment.