Skip to content

Commit 321c287

Browse files
authored
test on example mod instead of Texture Loader (#16)
* Fetches the template mod and sets the geode in mod.json to always be the latest, instead of relying on texture loader to do it
1 parent 4e058e1 commit 321c287

File tree

1 file changed

+72
-4
lines changed

1 file changed

+72
-4
lines changed

.github/workflows/test.yml

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,32 @@ on:
66
branches:
77
- '**'
88

9+
env:
10+
test-mod-path: example-mod-test
11+
test-geode-nightly: false
12+
# Line below makes IDEs with github actions intelisense or whatever its called in editors shut up about an unknown env variable
13+
geode-sdk-type: ''
14+
915
jobs:
16+
fetch-geode-version:
17+
name: Get Geode Version
18+
runs-on: ubuntu-latest
19+
outputs:
20+
geode_ver: ${{ steps.get_version.outputs.geode_version }}
21+
steps:
22+
- name: Get latest release tag
23+
id: get_version
24+
run: |
25+
# Get latest Geode version
26+
if [ ${{ env.test-geode-nightly }} == true ]; then
27+
GEODE_VERSION=$(curl -s https://raw.githubusercontent.com/geode-sdk/geode/nightly/VERSION)
28+
else
29+
GEODE_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/geode-sdk/geode/releases/latest | jq -r .tag_name)
30+
fi
31+
32+
GEODE_VERSION=${GEODE_VERSION#v}
33+
echo "geode_version=$GEODE_VERSION" >> $GITHUB_OUTPUT
34+
1035
build:
1136
strategy:
1237
fail-fast: false
@@ -28,28 +53,71 @@ jobs:
2853

2954
name: ${{ matrix.config.name }}
3055
runs-on: ${{ matrix.config.os }}
56+
needs: ['fetch-geode-version']
3157

3258
steps:
3359
- uses: actions/checkout@v4
3460

3561
- uses: actions/checkout@v4
3662
with:
37-
repository: geode-sdk/textureldr
38-
path: textureldr
63+
repository: geode-sdk/example-mod
64+
path: ${{ env.test-mod-path }}
65+
66+
- name: Modify Example Mod Files
67+
shell: bash
68+
run: |
69+
# Get Geode version from the previous step
70+
GEODE_VERSION="${{ needs.fetch-geode-version.outputs.geode_ver }}"
71+
if [ $GEODE_VERSION == null ]; then
72+
echo "Could not get the latest version for testing"
73+
exit 1;
74+
fi
75+
76+
# Set path of mod.json file
77+
mod_json_path="${{ env.test-mod-path }}/mod.json"
78+
79+
# Read the current mod.json content
80+
mod_json=$(cat $mod_json_path)
81+
82+
# Replace the placeholders
83+
updated_mod_json=$(echo "$mod_json" | jq \
84+
--arg geode_version "$GEODE_VERSION" \
85+
--arg mod_id "geode.example" \
86+
--arg mod_name "Example Mod" \
87+
--arg mod_version "0.0.0" \
88+
--arg mod_description "The example Geode mod!" \
89+
--arg developer "Geode Team" \
90+
'.geode = $geode_version |
91+
.id = $mod_id |
92+
.name = $mod_name |
93+
.version = $mod_version |
94+
.description = $mod_description |
95+
.developer = $developer')
96+
97+
# Write updated_mod_json variable contents to mod.json file
98+
echo $updated_mod_json > $mod_json_path
99+
100+
# Write thing to GitHub ENV
101+
echo "geode-sdk-type=$(${{ env.test-geode-nightly }} == true ? "nightly" : "given")" >> $GITHUB_ENV
102+
103+
# Print Geode Version and if we are running nightly
104+
echo "Version: $GEODE_VERSION"
105+
echo "Nightly?: ${{ env.test-geode-nightly }}"
39106
40107
- name: Build the mod
41108
uses: ./
42109
with:
110+
sdk: ${{ env.geode-sdk-type }}
43111
build-config: RelWithDebInfo
112+
path: ${{ env.test-mod-path }}
44113
export-pdb: true
45114
bundle-pdb: true
46115
export-symbols: true
47-
path: textureldr
48116
combine: true
49117
target: ${{ matrix.config.target }}
50118

51119
package:
52-
name: Package both builds
120+
name: Package builds
53121
runs-on: ubuntu-latest
54122
needs: ['build']
55123

0 commit comments

Comments
 (0)