Skip to content

Commit

Permalink
ci: fix testing action, and fix building with gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
coopeeo committed Aug 8, 2024
1 parent 0cf6fdb commit 7eaee1c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 13 deletions.
44 changes: 33 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
branches:
- '**'

env:
test-mod-path: example-mod-test
test-geode-nightly: false

geode-sdk-type: ''

jobs:
fetch-geode-version:
name: Get Geode Version
Expand All @@ -17,9 +23,19 @@ jobs:
id: get_version
run: |
# Get latest Geode version
GEODE_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/geode-sdk/geode/releases/latest | jq -r .tag_name)
if [ ${{ env.test-geode-nightly }} == true ]; then
echo "Getting latest version specified in nightly build"
GEODE_VERSION=$(curl -s https://raw.githubusercontent.com/geode-sdk/geode/nightly/VERSION)
else
echo "Getting latest version"
GEODE_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/geode-sdk/geode/releases/latest | jq -r .tag_name)
fi
GEODE_VERSION=${GEODE_VERSION#v}
echo "Version: $GEODE_VERSION"
echo "Type: ${{ env.test-geode-nightly == true && 'nightly' || 'latest' }}"
echo "geode_version=$GEODE_VERSION" >> $GITHUB_OUTPUT
build:
strategy:
fail-fast: false
Expand Down Expand Up @@ -53,22 +69,21 @@ jobs:
- uses: actions/checkout@v4
with:
repository: geode-catgirls/example-mod
path: example-mod-test
#repository: geode-sdk/texturelfr
#path: textureldr
path: ${{ env.test-mod-path }}

# Modify files step (added by geode-catgirls)
- name: Modify example-mod files
- name: Modify Example Mod Files
id: modify-mod-files
shell: bash
run: |
# Get Geode version from the previous step
GEODE_VERSION="${{ needs.fetch-geode-version.outputs.geode_ver }}"
if [ $GEODE_VERSION == null ]; then
echo "couldn't get le version, try again."
echo "Could not get the latest version for testing"
exit 1;
fi
# Set path of mod.json file
mod_json_path="example-mod-test/mod.json"
mod_json_path="${{ env.test-mod-path }}/mod.json"
# Read the current mod.json content
mod_json=$(cat $mod_json_path)
Expand All @@ -91,14 +106,21 @@ jobs:
# Write updated_mod_json variable contents to mod.json file
echo $updated_mod_json > $mod_json_path
# Write thing to GitHub ENV
echo "geode-sdk-type=${{ env.test-geode-nightly == true && 'nightly' || 'given' }}" >> $GITHUB_ENV
# Print Geode Version and if we are running nightly
echo "Version: $GEODE_VERSION"
echo "Nightly?: ${{ env.test-geode-nightly }}"
- name: Build the mod
uses: ./
with:
# sdk: nightly
gh-pat: ${{ secrets.GH_PAT }}
sdk: ${{ env.geode-sdk-type }}
build-config: RelWithDebInfo
#path: textureldr
path: example-mod-test
path: ${{ env.test-mod-path }}
combine: true
target: ${{ matrix.config.target }}

Expand Down
28 changes: 26 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ inputs:
description: Whether to use LTO (Link Time Optimization) via the CMAKE_INTERPROCEDURAL_OPTIMIZATION flag, improving build size. Defaults to true
required: false
default: true
gh-pat:
description: GitHub personal access token for downloading stuffs
required: false
default: no token lol

outputs:
build-output:
Expand Down Expand Up @@ -196,6 +200,15 @@ runs:
version: ${{ inputs.cli }}
platform: ${{ steps.platform.outputs.target_id }}

- name: Download Geode SDK
if: steps.platform.outputs.target_id == 'ios'
uses: actions/checkout@v4
with:
repository: geode-catgirls/geode-cgs
token: ${{ inputs.gh-pat }}
ref: nightly
path: geode-sdk-clone

- name: Setup Geode SDK
shell: bash
run: |
Expand All @@ -206,7 +219,9 @@ runs:
mkdir -p "$CLI_PROFILE/Contents/geode/mods"
geode profile add --name GithubActions "$CLI_PROFILE/GeometryDash.exe" win
geode sdk install "${{ github.workspace }}/geode-sdk-clone"
if [ "${{ steps.platform.outputs.target_id }}" != "ios" ]; then
geode sdk install "${{ github.workspace }}/geode-sdk-clone"
fi
# silly github actions wont refresh the env
export GEODE_SDK="${{ github.workspace }}/geode-sdk-clone"
Expand All @@ -224,7 +239,16 @@ runs:
echo "Updating to version $TARGET_GEODE_VERSION from $MOD_JSON_PATH"
echo "!! WARNING !!"
echo "building against NIGHTLY as WORKAROUND"
geode sdk update nightly
if [ "${{ steps.platform.outputs.target_id }}" == "ios" ]; then
echo "doin ios stuff and already installed meow meow, editing geode cli config"
#edited_config=
echo "Old Config: $(cat /Users/Shared/Geode/config.json)"
echo $(cat /Users/Shared/Geode/config.json | jq '."sdk-nightly" = true | ."sdk-version" = null') > /Users/Shared/Geode/config.json
echo "New Config: $(cat /Users/Shared/Geode/config.json)"
#geode sdk update nightly
else
geode sdk update nightly
fi
geode sdk install-binaries --platform ${{ steps.platform.outputs.target_id }}
#uncomment these when geode ios releases:
Expand Down

0 comments on commit 7eaee1c

Please sign in to comment.