Update unittests #85
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Unit Tests | |
on: | |
push: | |
branches: [ "dev" ] | |
pull_request: | |
branches: [ "dev" ] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
LINUX_64_TARGET: x86_64-unknown-linux-gnu | |
jobs: | |
unittests_linux_x86_64: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: π Initialize submodules | |
run: git submodule update --init --recursive | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "./addons/glecs/rust/glecs" | |
cache-on-failure: true | |
- name: π¦ Update Rust | |
run: | | |
rustup update | |
rustup target add ${{ env.LINUX_64_TARGET }} | |
- name: π¦ Build Rust code | |
run: | | |
cargo build \ | |
--release \ | |
--manifest-path ./addons/glecs/rust/glecs/Cargo.toml \ | |
--features compile_bindings \ | |
--target-dir ./addons/glecs/bin \ | |
--target ${{ env.LINUX_64_TARGET }} | |
# Copy library for use in test suite | |
cp ./addons/glecs/bin/${TARGET}/release ./addons/glecs/bin/debug -r | |
- name: π€ Setup Godot | |
uses: chickensoft-games/setup-godot@v1 | |
with: | |
# Version must include major, minor, and patch, and be >= 4.0.0 | |
version: 4.2.1 | |
mono: false | |
# This shouldn't be needed because the important files from .godot are | |
# included, but we run the import process just in case. | |
- name: π§ Run Godot import | |
run: | | |
godot --headless --editor --quit-after 100 | |
- name: βοΈ Run unittests | |
run: | | |
godot -s res://addons/gut/gut_cmdln.gd --headless -gdir="res://unittests" -gexit | |
- name: Cache compiled library | |
uses: actions/cache/[email protected] | |
with: | |
# A list of files, directories, and wildcard patterns to cache and restore | |
path: ./addons/glecs/bin/${{ env.LINUX_64_TARGET }}/release | |
# An explicit key for restoring and saving the cache | |
key: glecslib.${{ env.LINUX_64_TARGET }} | |
update_nightly: | |
needs: unittests_linux_x86_64 | |
runs-on: windows-latest | |
steps: | |
- name: π Run only if new commits were pushed | |
if: ${{ github.action }} != "push" | |
run: | | |
exit 0 | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
persist-credentials: false | |
- name: π§ Load compiled library, Linux x86_64 | |
uses: actions/cache/[email protected] | |
with: | |
# A list of files, directories, and wildcard patterns to cache and restore | |
path: ./addons/glecs/bin/${{ env.LINUX_64_TARGET }}/release | |
# An explicit key for restoring and saving the cache | |
key: glecslib.${{ env.LINUX_64_TARGET }} | |
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms | |
enableCrossOsArchive: true | |
- name: π€ Setup Godot | |
uses: chickensoft-games/setup-godot@v1 | |
with: | |
# Version must include major, minor, and patch, and be >= 4.0.0 | |
version: 4.2.1 | |
mono: false | |
- name: π£ββοΈ Convert dev plugin to nightly format | |
run: | | |
godot -s ./addons/glecs/_build_for_nightly.gd | |
- name: π Clone nightly branch | |
run: | | |
git clone https://github.com/${{ github.repository }} ../nightly -b nightly | |
- name: π¨οΈ Copy dev branch plugin to nightly | |
run: | | |
cp ./addons/glecs/ ../nightly -r | |
- name: Git add | |
run: | | |
cd ../nightly | |
git config --global user.name github-actions[bot] | |
git config --global user.email [email protected] | |
git add . | |
- name: Commit | |
run: | | |
cd ../nightly | |
git commit --all -m "(AUTO) ${{ github.event.head_commit.message }}" | |
- name: Push | |
run: | | |
cd ../nightly | |
git remote set-url origin https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git push | |