wip: ci: try building for ios #243
This file contains 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: Flutter CI | |
on: [push, pull_request] | |
jobs: | |
static-analysis: | |
name: Static analysis | |
runs-on: ubuntu-latest | |
steps: | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- run: | | |
for PKG in native network core; do | |
(cd meesign_$PKG; dart pub get) | |
done | |
flutter pub get | |
- run: flutter analyze --no-fatal-infos | |
- run: dart format --output none --set-exit-if-changed . | |
dart-test: | |
name: Dart test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: main | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
version: "23.x" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install pdfsig | |
run: sudo apt-get install -y poppler-utils | |
- name: Setup server | |
run: | | |
wget https://raw.githubusercontent.com/crocs-muni/meesign-server/main/generate_keys.sh | |
bash generate_keys.sh | |
chmod a+r keys/* | |
podman pull crocsmuni/meesign:nightly | |
podman run --detach \ | |
--publish 1337:1337 --volume $(pwd)/keys/:/meesign/keys/:Z \ | |
crocsmuni/meesign:nightly | |
- run: | | |
for PKG in native network core; do | |
(cd meesign_$PKG; dart pub get) | |
done | |
- name: Run tests | |
run: cd meesign_core; dart --enable-experiment=native-assets test | |
build: | |
name: ${{ matrix.target }} build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
target: [Windows, Linux, macOS, Android, iOS] | |
include: | |
- os: windows-latest | |
target: Windows | |
build_target: windows | |
build_path: build\windows\x64\runner\Release | |
asset_extension: .zip | |
asset_content_type: application/zip | |
- os: ubuntu-latest | |
target: Linux | |
build_target: linux | |
build_path: build/linux/x64/release/bundle | |
asset_extension: .tar.gz | |
asset_content_type: application/gzip | |
- os: macos-14 | |
target: macOS | |
build_target: macos | |
build_path: build/macos/Build/Products/Release | |
asset_extension: .zip | |
asset_content_type: application/zip | |
- os: ubuntu-latest | |
target: Android | |
build_target: apk | |
build_path: build/app/outputs/flutter-apk | |
asset_extension: .apk | |
asset_content_type: application/vnd.android.package-archive | |
- os: macos-14 | |
target: iOS | |
build_target: ios | |
build_path: build/ios | |
asset_extension: .zip | |
asset_content_type: application/zip | |
# Disable fail-fast as we want results from all even if one fails. | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
version: "23.x" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clone Flutter repository with stable channel | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: main | |
cache: true | |
- name: Install Android dependencies | |
if: matrix.target == 'Android' | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set up Rust for Android | |
if: matrix.target == 'Android' | |
env: | |
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/25.2.9519653 | |
ANDROID_API: 33 | |
# add rust android targets, | |
# point cargo to local Android NDK installation | |
run: | | |
rustup target add \ | |
aarch64-linux-android \ | |
armv7-linux-androideabi \ | |
x86_64-linux-android \ | |
i686-linux-android | |
bash ./tool/cargo-config-gen-android.sh >> ~/.cargo/config.toml | |
cat ~/.cargo/config.toml | |
- name: Set up Rust for iOS | |
if: matrix.target == 'iOS' | |
run: rustup target add aarch64-apple-ios | |
- name: Set up Rust for macOS | |
if: matrix.target == 'macOS' | |
run: | | |
rustup target add \ | |
x86_64-apple-darwin \ | |
aarch64-apple-darwin | |
- name: Install Linux dependencies | |
if: matrix.target == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libgtk-3-dev libx11-dev libblkid-dev \ | |
pkg-config cmake ninja-build | |
- name: Enable desktop support | |
if: matrix.target != 'Android' | |
run: | | |
flutter config --enable-linux-desktop | |
flutter config --enable-windows-desktop | |
flutter config --enable-macos-desktop | |
- name: Enable native assets | |
run: flutter config --enable-native-assets | |
# Fetch dart packages | |
- run: flutter pub get | |
- name: Build app | |
run: > | |
flutter build -v ${{ matrix.build_target }} | |
--release | |
--dart-define=ALLOW_BAD_CERTS=true | |
# Package the build. | |
- name: Copy VC redistributables to release directory for Windows | |
if: matrix.target == 'Windows' | |
run: | | |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') . | |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') . | |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') . | |
working-directory: ${{ matrix.build_path }} | |
- name: Rename build for Android | |
if: matrix.target == 'Android' | |
run: mv app-release.apk $GITHUB_WORKSPACE/meesign_client_${{ matrix.target }}.apk | |
working-directory: ${{ matrix.build_path }} | |
- name: Compress build for Linux | |
if: matrix.target == 'Linux' | |
run: tar czf $GITHUB_WORKSPACE/meesign_client_${{ matrix.target }}.tar.gz * | |
working-directory: ${{ matrix.build_path }} | |
- name: Compress build for Windows | |
if: matrix.target == 'Windows' | |
run: compress-archive -Path * -DestinationPath ${env:GITHUB_WORKSPACE}\meesign_client_${{ matrix.target }}.zip | |
working-directory: ${{ matrix.build_path }} | |
- name: Compress build for macOS | |
if: matrix.target == 'macOS' | |
run: ditto -c -k --sequesterRsrc --keepParent meesign_client.app $GITHUB_WORKSPACE/meesign_client_${{ matrix.target }}.zip | |
working-directory: ${{ matrix.build_path }} | |
- name: Compress build for iOS | |
if: matrix.target == 'iOS' | |
run: | | |
ls -l | |
ditto -c -k --sequesterRsrc --keepParent ipa $GITHUB_WORKSPACE/meesign_client_${{ matrix.target }}.zip | |
working-directory: ${{ matrix.build_path }} | |
# Upload the build. | |
- name: Upload build outputs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: meesign_client_${{ matrix.target }}${{ matrix.asset_extension }} | |
path: ./meesign_client_${{ matrix.target }}${{ matrix.asset_extension }} | |
retention-days: 10 |