-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (99 loc) · 3.78 KB
/
unittests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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:
- name: 🐙 Initialize git
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
env:
TARGET: ${{ env.LINUX_64_TARGET }}
run: |
rustup update
rustup target add ${TARGET}
- name: 🦀 Build Rust code
run: |
cargo build \
--manifest-path ./addons/glecs/rust/glecs/Cargo.toml \
--features compile_bindings \
--target-dir ./addons/glecs/bin
# 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.TARGET }}/release
# An explicit key for restoring and saving the cache
key: glecslib.${{ env.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
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
- name: 🐙 Initialize git
uses: actions/checkout@v4
- 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
env:
REPO: ${{ github.repository }}
run: |
git clone ${{ github.repository }} ../nightly -b nightly
- name: 🖨️ Copy dev branch plugin to nightly branch
run: |
cp ./addons/glecs/ ../nightly
- name: 📤 Commit to nightly branch
run: |
cd ../nightly
git commit --all -m "AUTO ${{ github.event.head_commit.message }}"