-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (141 loc) · 7.02 KB
/
Copy pathandroid.yml
File metadata and controls
161 lines (141 loc) · 7.02 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Android APK build for Goemon64Recomp-Android.
#
# Mirrors the (removed) desktop validate.yml recompilation recipe, adapted for a
# cross-compiled arm64 Android build. Like every N64 recomp, building REQUIRES the
# base ROM to generate the recompiled C — it is never committed and never shipped
# in the APK. Following the Zelda64Recomp pattern, the ROM lives in a PRIVATE
# companion repo and is pulled at build time via a PAT stored in the secret
# G64RS_REPO_WITH_PAT (the authenticated clone URL of that private repo).
#
# Required secret:
# G64RS_REPO_WITH_PAT -> https://<user>:<PAT>@github.com/ogdanimal/Goemon64RecompSecrets.git
# The private repo must contain mnsg.z64 (the decompressed US ROM) at its root.
#
# The produced APK is a DEBUG-signed loader: it contains the recompiled game code
# + the mod's own UI assets, but NO game data. The user supplies their own ROM at
# runtime. Signed release builds are produced by a separate tag-triggered workflow
# (android-release.yml), which has existed since v1.0.0.
name: android
on:
workflow_dispatch:
push:
branches: [dev, main]
paths-ignore:
- '**.md'
- 'docs/**'
- '.gitignore'
# Least privilege: this workflow only reads the repo and uploads an artifact
# (artifacts don't need repo write). Third-party actions + a full Gradle build
# run here, so deny everything the default token would otherwise grant.
# (android-release.yml sets its own minimal `contents: write` for the Release.)
permissions:
contents: read
concurrency:
group: android-${{ github.ref }}
cancel-in-progress: true
jobs:
build-apk:
name: build arm64 APK (debug)
runs-on: ubuntu-latest
env:
# Same N64Recomp commit the desktop CI pinned; bump deliberately.
N64RECOMP_COMMIT: '81213c1831fab2521a6a5459c67b63437d67e253'
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
submodules: recursive
# Issue #15 regression tripwire. RT64's dual source blending is invalid on
# every Mali GPU and the driver renders garbage instead of failing, so an
# ungated SRC1_ factor or secondary shader output would ship a white screen
# to hardware neither CI nor our test devices have. Runs before the long
# build so the failure is immediate.
- name: Guard dual source blending gating
run: ./.github/scripts/check-dual-src-blend.sh
# The guard itself has regressed twice while being hardened, both times by
# a fix for a false positive quietly opening a false negative. This suite
# pins every case either direction against synthesized fixtures.
- name: Test the dual source blending guard
run: ./.github/scripts/test-dual-src-blend-guard.sh
# The gradle-wrapper.jar is committed to the repo and executes with the ROM
# PAT in scope; validate it against Gradle's published good hashes so a
# tampered wrapper can't run. SHA-pinned like every other action here (H7).
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@ed408507eac070d1f99cc633dbcf757c94c7933a # v4
- name: ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: android-arm64-${{ env.N64RECOMP_COMMIT }}
- name: Fetch private build inputs (ROM)
run: |
git clone "${{ secrets.G64RS_REPO_WITH_PAT }}" Goemon64RecompSecrets
# Copy only the ROM, not a wildcard — a wildcard would spray any future
# file added to the secrets repo straight into the build tree.
cp -v ./Goemon64RecompSecrets/mnsg.z64 ./
# Delete the clone immediately (its .git/config holds the PAT), then
# verify the ROM so a wrong/missing file fails clearly here rather than
# as a confusing recompiler error downstream.
rm -rf Goemon64RecompSecrets
echo "6ea0ed71032ce08fc2745f412d84936382197494 mnsg.z64" | sha1sum -c -
- name: Install host toolchain
run: |
sudo apt-get update
sudo apt-get install -y ninja-build cmake clang lld llvm make
- name: Build N64Recomp & RSPRecomp (host)
run: |
export PATH="/usr/lib/ccache:$PATH"
git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource
cd N64RecompSource
git checkout "$N64RECOMP_COMMIT"
git submodule update --init --recursive
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
cmake --build build --config Release --target N64RecompCLI -j "$(nproc)"
cmake --build build --config Release --target RSPRecomp -j "$(nproc)"
cp build/N64Recomp ../N64Recomp
cp build/RSPRecomp ../RSPRecomp
- name: Recompile game + RSP microcode (host; needs ROM)
run: |
./N64Recomp mnsg.toml # -> RecompiledFuncs/*.c
./RSPRecomp aspMain.toml # -> rsp/aspMain.cpp
- name: Build host file_to_c
run: |
mkdir -p build-host-tools
clang++ -std=c++17 -O2 \
lib/rt64/src/tools/file_to_c/file_to_c.cpp \
-o build-host-tools/file_to_c
test -x build-host-tools/file_to_c
- name: Generate patches codegen (host; the Android CMake path skips this)
run: |
make -C patches CC=clang LD=ld.lld
./N64Recomp patches.toml # -> patches/patches.bin + RecompiledPatches/*
./build-host-tools/file_to_c \
patches/patches.bin mm_patches_bin \
RecompiledPatches/patches_bin.c RecompiledPatches/patches_bin.h
- name: Set up JDK 17
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5
with:
distribution: temurin
java-version: '17'
- name: Set up Android SDK
uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4
- name: Install pinned NDK + CMake
run: |
yes | sdkmanager --licenses > /dev/null || true
sdkmanager "ndk;27.1.12297006" "cmake;3.22.1"
- name: Build debug APK (arm64-v8a)
working-directory: android
# Matches the release workflow's -PcustomDriver=true so CI actually
# compiles the configuration that ships: libadrenotools, the four hook
# libraries and plume's loader hook. Without it here, a break in any of
# them would first surface in the release build itself.
run: ./gradlew assembleDebug --no-daemon --stacktrace -PcustomDriver=true
- name: Upload APK artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: Goemon64-android-debug-${{ github.sha }}
path: android/app/build/outputs/apk/debug/*.apk
if-no-files-found: error
# Debug CI APKs are transient test builds; 14 days is plenty (default 90).
retention-days: 14