Skip to content

Commit

Permalink
ci-cd: Setup CI/CD ref dev-1955
Browse files Browse the repository at this point in the history
  • Loading branch information
roxk committed Sep 3, 2024
1 parent 88c15be commit 26b11f9
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI

on:
push:
branches:
- "*"
- "!gh-pages"
tags:
- "*"
pull_request:
branches:
- "*"
- "!gh-pages"

jobs:
test-xamarin:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
global-json-file: ./global.json
- working-directory: ./XamarinFormSample
run: dotnet format --verify-no-changes
test-flutter:
runs-on: macos-12
steps:
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.0'
channel: 'stable'
- working-directory: flutter-example
run: |
flutter pub get
flutter test
flutter analyze --no-fatal-infos
dart format --set-exit-if-changed lib
xamarin_android:
runs-on: macos-12
needs: ["test-xamarin"]
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- uses: actions/setup-dotnet@v3
with:
global-json-file: ./global.json
- run: npm install -g appcenter-cli
- name: Set Xamarin SDK versions
run: |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --ios=16.2 --android=13.2
- name: nuget restore
run: |
nuget restore ./XamarinFormSample/XamarinFormSample/XamarinFormSample.csproj
nuget restore ./XamarinFormSample/XamarinFormSample.Android/XamarinFormSample.Android.csproj
- name: Set versionCode
run: |
VERSION_CODE=$(date +%s)
sed -I "" -E 's/android:versionCode="[[:digit:]]+"/android:versionCode="'"$VERSION_CODE"'"/' XamarinFormSample/XamarinFormSample.Android/Properties/AndroidManifest.xml
- name: msbuild
run: msbuild ./XamarinFormSample/XamarinFormSample.Android/XamarinFormSample.Android.csproj /p:Configuration=Release /t:PackageForAndroid
- name: Run zipalign
run: |
BUILD_TOOLS_VERSION="30.0.3"
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/zipalign" -p -f -v 4 ./XamarinFormSample/XamarinFormSample.Android/bin/Release/com.authgear.migrate.tool.xamarin.flutter.sample.apk "$RUNNER_TEMP/app-aligned.apk"
- name: Run apksigner
env:
ANDROID_KEYSTORE_PASSWORD: Abcd1234!
ANDROID_KEY_ALIAS: main
ANDROID_KEY_PASSWORD: Abcd1234!
run: |
BUILD_TOOLS_VERSION="30.0.3"
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/apksigner" sign \
--ks keystore-main.jks \
--ks-key-alias "$ANDROID_KEY_ALIAS" \
--ks-pass "pass:$ANDROID_KEYSTORE_PASSWORD" \
--key-pass "pass:$ANDROID_KEY_PASSWORD" \
--out "$RUNNER_TEMP/app-signed.apk" \
"$RUNNER_TEMP/app-aligned.apk"
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "6.0.408",
"rollForward": "latestPatch"
}
}

0 comments on commit 26b11f9

Please sign in to comment.