Skip to content

Commit ea92006

Browse files
Merge pull request #1349 from cypherstack/ci
fall back to stub external_api_keys.dart on fork PRs
2 parents 1431e10 + 16b1bf9 commit ea92006

4 files changed

Lines changed: 111 additions & 2 deletions

File tree

.github/workflows/build-ci-image.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ jobs:
4040
cache-from: type=gha
4141
cache-to: type=gha,mode=max
4242

43+
- name: Build and push android image
44+
uses: docker/build-push-action@v7
45+
with:
46+
context: .
47+
target: android
48+
push: true
49+
tags: ${{ env.GHCR_IMAGE }}:android
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max
52+
4353
- name: Build and push test image
4454
uses: docker/build-push-action@v7
4555
with:

.github/workflows/build.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
contents: read
103103
packages: read
104104
container:
105-
image: ghcr.io/${{ github.repository_owner }}/stackwallet-ci:latest
105+
image: ghcr.io/${{ github.repository_owner }}/stackwallet-ci:android
106106
credentials:
107107
username: ${{ github.actor }}
108108
password: ${{ github.token }}
@@ -190,6 +190,12 @@ jobs:
190190
- name: Build APKs
191191
run: flutter build apk --split-per-abi --release
192192

193+
- name: Clean intermediates before AAB
194+
run: |
195+
rm -rf build/app/intermediates
196+
rm -rf build/app/tmp
197+
find build -name '*.o' -delete 2>/dev/null || true
198+
193199
- name: Build AAB
194200
run: flutter build appbundle --release
195201

.github/workflows/test.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,21 @@ jobs:
4343
env:
4444
CHANGE_NOW: ${{ secrets.CHANGE_NOW }}
4545
run: |
46-
echo "$CHANGE_NOW" | base64 --decode > lib/external_api_keys.dart
46+
if [ -n "$CHANGE_NOW" ]; then
47+
echo "$CHANGE_NOW" | base64 --decode > lib/external_api_keys.dart
48+
else
49+
cat > lib/external_api_keys.dart << 'EOF'
50+
const String kChangeNowApiKey = "";
51+
const String kSimpleSwapApiKey = "";
52+
const String kNanswapApiKey = "";
53+
const String kNanoSwapRpcApiKey = "";
54+
const String kWizSwapApiKey = "";
55+
const kShopInBitAccessKey = "";
56+
const kShopInBitPartnerSecret = "";
57+
const kCakePayApiToken = "";
58+
const kExolixApiKey = "";
59+
EOF
60+
fi
4761
4862
- name: Ensure app config for tests
4963
run: bash scripts/ensure_test_app_config.sh

Dockerfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,85 @@ RUN git config --system --add safe.directory '*'
8888
RUN flutter --version && rustc --version && cargo --version && node --version && go version
8989

9090

91+
# Android-only image: no Linux/Windows cross-compilers, no OpenCV/OpenCL, single Rust toolchain with android targets
92+
FROM ubuntu:24.04 AS android
93+
94+
ENV DEBIAN_FRONTEND=noninteractive \
95+
TZ=Etc/UTC \
96+
LANG=C.UTF-8 \
97+
LC_ALL=C.UTF-8
98+
99+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
100+
101+
RUN apt-get update && apt-get install -y --no-install-recommends \
102+
ca-certificates curl file git gnupg python3 sudo unzip xz-utils \
103+
build-essential cmake ninja-build pkg-config \
104+
libssl-dev zlib1g-dev \
105+
openjdk-21-jdk-headless \
106+
&& rm -rf /var/lib/apt/lists/*
107+
108+
ENV RUSTUP_HOME=/usr/local/rustup \
109+
CARGO_HOME=/usr/local/cargo \
110+
PATH=/usr/local/cargo/bin:$PATH
111+
112+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
113+
| sh -s -- -y --default-toolchain 1.89.0 --profile minimal --no-modify-path \
114+
&& rustup target add \
115+
aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android \
116+
--toolchain 1.89.0 \
117+
&& cargo install cargo-ndk \
118+
&& chmod -R a+rwX "$CARGO_HOME" "$RUSTUP_HOME"
119+
120+
ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
121+
122+
ENV ANDROID_SDK_ROOT=/opt/android-sdk \
123+
ANDROID_HOME=/opt/android-sdk \
124+
ANDROID_NDK_ROOT=/opt/android-sdk/ndk/28.2.13676358 \
125+
ANDROID_NDK_HOME=/opt/android-sdk/ndk/28.2.13676358 \
126+
PATH=/opt/android-sdk/cmdline-tools/latest/bin:/opt/android-sdk/platform-tools:$PATH
127+
128+
RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" \
129+
&& curl -fsSL https://dl.google.com/android/repository/commandlinetools-linux-14742923_latest.zip \
130+
-o /tmp/cmdline-tools.zip \
131+
&& echo "48833c34b761c10cb20bcd16582129395d121b27 /tmp/cmdline-tools.zip" | sha1sum -c \
132+
&& unzip -q /tmp/cmdline-tools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" \
133+
&& mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest" \
134+
&& rm /tmp/cmdline-tools.zip \
135+
&& mkdir -p "$ANDROID_SDK_ROOT/licenses" \
136+
&& printf '\n24333f8a63b6825ea9c5514f83c2829b004d1fee\n8933bad161af4178b1185d1a37fbf41ea5269c55d7b9237478ea8ec3307c27e4' \
137+
> "$ANDROID_SDK_ROOT/licenses/android-sdk-license" \
138+
&& printf '\n84831b9409646a918e30573bab4c9c91346d8abd' \
139+
> "$ANDROID_SDK_ROOT/licenses/android-sdk-preview-license" \
140+
&& printf '\n859f317696f67ef3d7f30a50a5560e7834b43903' \
141+
> "$ANDROID_SDK_ROOT/licenses/android-sdk-arm-dbt-license" \
142+
&& sdkmanager \
143+
"platform-tools" \
144+
"build-tools;35.0.0" \
145+
"platforms;android-35" \
146+
"ndk;28.2.13676358" \
147+
&& chmod -R a+rwX "$ANDROID_SDK_ROOT"
148+
149+
ENV PATH=/usr/local/go/bin:$PATH
150+
151+
RUN curl -fsSL https://go.dev/dl/go1.24.13.linux-amd64.tar.gz -o /tmp/go.tar.gz \
152+
&& echo "1fc94b57134d51669c72173ad5d49fd62afb0f1db9bf3f798fd98ee423f8d730 /tmp/go.tar.gz" | sha256sum -c \
153+
&& tar -C /usr/local -xzf /tmp/go.tar.gz \
154+
&& rm /tmp/go.tar.gz
155+
156+
ENV FLUTTER_HOME=/opt/flutter \
157+
PATH=/opt/flutter/bin:/opt/flutter/bin/cache/dart-sdk/bin:$PATH
158+
159+
RUN git clone --depth 1 --branch 3.38.1 https://github.com/flutter/flutter.git "$FLUTTER_HOME" \
160+
&& git config --global --add safe.directory '*' \
161+
&& flutter config --no-analytics \
162+
&& flutter precache --android \
163+
&& chmod -R a+rwX "$FLUTTER_HOME"
164+
165+
RUN git config --system --add safe.directory '*'
166+
167+
RUN flutter --version && rustc --version && cargo --version && go version
168+
169+
91170
# Minimal image for flutter test (no Rust, no Android SDK, no cross-compilers)
92171
FROM ubuntu:24.04 AS test
93172

0 commit comments

Comments
 (0)