Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/build-ci-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push android image
uses: docker/build-push-action@v7
with:
context: .
target: android
push: true
tags: ${{ env.GHCR_IMAGE }}:android
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push test image
uses: docker/build-push-action@v7
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
contents: read
packages: read
container:
image: ghcr.io/${{ github.repository_owner }}/stackwallet-ci:latest
image: ghcr.io/${{ github.repository_owner }}/stackwallet-ci:android
credentials:
username: ${{ github.actor }}
password: ${{ github.token }}
Expand Down Expand Up @@ -190,6 +190,12 @@ jobs:
- name: Build APKs
run: flutter build apk --split-per-abi --release

- name: Clean intermediates before AAB
run: |
rm -rf build/app/intermediates
rm -rf build/app/tmp
find build -name '*.o' -delete 2>/dev/null || true

- name: Build AAB
run: flutter build appbundle --release

Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,21 @@ jobs:
env:
CHANGE_NOW: ${{ secrets.CHANGE_NOW }}
run: |
echo "$CHANGE_NOW" | base64 --decode > lib/external_api_keys.dart
if [ -n "$CHANGE_NOW" ]; then
echo "$CHANGE_NOW" | base64 --decode > lib/external_api_keys.dart
else
cat > lib/external_api_keys.dart << 'EOF'
const String kChangeNowApiKey = "";
const String kSimpleSwapApiKey = "";
const String kNanswapApiKey = "";
const String kNanoSwapRpcApiKey = "";
const String kWizSwapApiKey = "";
const kShopInBitAccessKey = "";
const kShopInBitPartnerSecret = "";
const kCakePayApiToken = "";
const kExolixApiKey = "";
EOF
fi

- name: Ensure app config for tests
run: bash scripts/ensure_test_app_config.sh
Expand Down
79 changes: 79 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,85 @@ RUN git config --system --add safe.directory '*'
RUN flutter --version && rustc --version && cargo --version && node --version && go version


# Android-only image: no Linux/Windows cross-compilers, no OpenCV/OpenCL, single Rust toolchain with android targets
FROM ubuntu:24.04 AS android

ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl file git gnupg python3 sudo unzip xz-utils \
build-essential cmake ninja-build pkg-config \
libssl-dev zlib1g-dev \
openjdk-21-jdk-headless \
&& rm -rf /var/lib/apt/lists/*

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain 1.89.0 --profile minimal --no-modify-path \
&& rustup target add \
aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android \
--toolchain 1.89.0 \
&& cargo install cargo-ndk \
&& chmod -R a+rwX "$CARGO_HOME" "$RUSTUP_HOME"

ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64

ENV ANDROID_SDK_ROOT=/opt/android-sdk \
ANDROID_HOME=/opt/android-sdk \
ANDROID_NDK_ROOT=/opt/android-sdk/ndk/28.2.13676358 \
ANDROID_NDK_HOME=/opt/android-sdk/ndk/28.2.13676358 \
PATH=/opt/android-sdk/cmdline-tools/latest/bin:/opt/android-sdk/platform-tools:$PATH

RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" \
&& curl -fsSL https://dl.google.com/android/repository/commandlinetools-linux-14742923_latest.zip \
-o /tmp/cmdline-tools.zip \
&& echo "48833c34b761c10cb20bcd16582129395d121b27 /tmp/cmdline-tools.zip" | sha1sum -c \
&& unzip -q /tmp/cmdline-tools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" \
&& mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest" \
&& rm /tmp/cmdline-tools.zip \
&& mkdir -p "$ANDROID_SDK_ROOT/licenses" \
&& printf '\n24333f8a63b6825ea9c5514f83c2829b004d1fee\n8933bad161af4178b1185d1a37fbf41ea5269c55d7b9237478ea8ec3307c27e4' \
> "$ANDROID_SDK_ROOT/licenses/android-sdk-license" \
&& printf '\n84831b9409646a918e30573bab4c9c91346d8abd' \
> "$ANDROID_SDK_ROOT/licenses/android-sdk-preview-license" \
&& printf '\n859f317696f67ef3d7f30a50a5560e7834b43903' \
> "$ANDROID_SDK_ROOT/licenses/android-sdk-arm-dbt-license" \
&& sdkmanager \
"platform-tools" \
"build-tools;35.0.0" \
"platforms;android-35" \
"ndk;28.2.13676358" \
&& chmod -R a+rwX "$ANDROID_SDK_ROOT"

ENV PATH=/usr/local/go/bin:$PATH

RUN curl -fsSL https://go.dev/dl/go1.24.13.linux-amd64.tar.gz -o /tmp/go.tar.gz \
&& echo "1fc94b57134d51669c72173ad5d49fd62afb0f1db9bf3f798fd98ee423f8d730 /tmp/go.tar.gz" | sha256sum -c \
&& tar -C /usr/local -xzf /tmp/go.tar.gz \
&& rm /tmp/go.tar.gz

ENV FLUTTER_HOME=/opt/flutter \
PATH=/opt/flutter/bin:/opt/flutter/bin/cache/dart-sdk/bin:$PATH

RUN git clone --depth 1 --branch 3.38.1 https://github.com/flutter/flutter.git "$FLUTTER_HOME" \
&& git config --global --add safe.directory '*' \
&& flutter config --no-analytics \
&& flutter precache --android \
&& chmod -R a+rwX "$FLUTTER_HOME"

RUN git config --system --add safe.directory '*'

RUN flutter --version && rustc --version && cargo --version && go version


# Minimal image for flutter test (no Rust, no Android SDK, no cross-compilers)
FROM ubuntu:24.04 AS test

Expand Down
Loading