Initial ebitengine android project #7
This file contains hidden or 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: Build APK (ARM only) | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.21" | |
| - name: Install ARM cross-compilers | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: Set up Android environment | |
| uses: android-actions/setup-android@v3 | |
| with: | |
| ndk-version: "26.2.11394342" # Explicitly specify NDK version | |
| sdk-platform: "android-34" | |
| sdk-build-tools: "34.0.0" | |
| - name: Configure environment | |
| run: | | |
| echo "ANDROID_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| echo "ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/26.2.11394342" >> $GITHUB_ENV | |
| echo "$GOPATH/bin" >> $GITHUB_PATH | |
| - name: Verify NDK installation | |
| run: | | |
| ls -la $ANDROID_NDK_HOME | |
| test -f $ANDROID_NDK_HOME/meta/platforms.json || exit 1 | |
| - name: Install gomobile | |
| run: | | |
| go install golang.org/x/mobile/cmd/gomobile@latest | |
| gomobile init | |
| - name: Clean Go cache | |
| run: | | |
| go clean -cache | |
| go clean -modcache | |
| - name: Build Android package (ARM only) | |
| run: | | |
| cd $GITHUB_WORKSPACE | |
| # First try to fix any Go import issues | |
| go mod tidy | |
| # Then build | |
| gomobile build \ | |
| -target=android/arm,android/arm64 \ | |
| -androidapi=34 \ | |
| -o game.apk \ | |
| ./cmd/game | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: game-apk | |
| path: game.apk |