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
i squashed some more commits as well
  • Loading branch information
coopeeo committed Aug 8, 2024
1 parent dc91d32 commit e0f351a
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 40 deletions.
62 changes: 48 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,36 @@ on:
branches:
- '**'

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

geode-sdk-type: ''

jobs:
fetch-geode-version:
name: Get Geode Version
runs-on: ubuntu-latest
outputs:
geode_ver: ${{ steps.get_version.outputs.geode_version }}
steps:
- name: Get latest release tag
id: get_version
run: |
# Get latest Geode version
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 All @@ -32,31 +61,29 @@ jobs:

name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
needs: ['fetch-geode-version']

steps:
- uses: actions/checkout@v4

- 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 latest Geode version (and dont put the jq with the curl request, for some reason.)
GEODE_VERSION=$(curl -s https://api.github.com/repos/geode-sdk/geode/releases/latest)
GEODE_VERSION=$(echo $GEODE_VERSION | jq -r .tag_name)
GEODE_VERSION=${GEODE_VERSION#v}
# Get Geode version from the previous step
GEODE_VERSION="${{ needs.fetch-geode-version.outputs.geode_ver }}"
if [ $GEODE_VERSION == null ]; then
GEODE_VERSION="3.2.0"
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 @@ -79,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
52 changes: 26 additions & 26 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 @@ -189,37 +193,22 @@ runs:
shell: bash
run: echo "GEODE_BINDINGS_REPO_PATH=$GITHUB_WORKSPACE/bindings-repo" >> $GITHUB_ENV

- name: Download CLI (iOS)
uses: robinraju/release-downloader@v1.9
with:
repository: geode-catgirls/cli
latest: ${{ inputs.cli == 'latest' }}
tag: ${{ inputs.cli != 'latest' && inputs.cli || '' }}
fileName: "*-${{ steps.platform.outputs.id }}.zip"
tarBall: false
zipBall: false
out-file-path: "cli"
if: steps.platform.outputs.target_id == 'ios'

- name: Download CLI (not iOS)
uses: robinraju/release-downloader@v1.9
with:
repository: geode-sdk/cli
latest: ${{ inputs.cli == 'latest' }}
tag: ${{ inputs.cli != 'latest' && inputs.cli || '' }}
fileName: "*-${{ steps.platform.outputs.id }}.zip"
tarBall: false
zipBall: false
out-file-path: "cli"
if: steps.platform.outputs.target_id != 'ios'

- name: Setup CLI
#uses: geode-sdk/cli/.github/actions/setup@main
uses: geode-catgirls/build-geode-mod/ios-cli-setup@main
with:
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 @@ -230,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 @@ -248,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 e0f351a

Please sign in to comment.