Skip to content

Commit

Permalink
Support capacitor v6 and v7 #344
Browse files Browse the repository at this point in the history
ref DEV-2507
  • Loading branch information
tung2744 authored Feb 26, 2025
2 parents c88cf33 + 918f87f commit 477c861
Show file tree
Hide file tree
Showing 38 changed files with 2,470 additions and 4,475 deletions.
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BUNDLE_PATH: "vendor/bundle"
111 changes: 68 additions & 43 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Why do we specify bundler-cache: false?
##
## Ideally we should turn this on.
## But this flag runs bundle install and cache, which does not suit our use case here.
## See https://github.com/ruby/setup-ruby?tab=readme-ov-file#caching-bundle-install-automatically

name: CI

on:
Expand All @@ -12,12 +18,17 @@ on:

jobs:
test:
runs-on: ubuntu-22.04
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer
- run: bundle install
- run: npm ci
- run: npm ci
working-directory: ./website
Expand All @@ -34,18 +45,20 @@ jobs:
if: ${{ !cancelled() }}
- run: npm run test
if: ${{ !cancelled() }}
- run: npm run verify
if: ${{ !cancelled() }}
- run: npm run bundle
if: ${{ !cancelled() }}
- run: make docs
if: ${{ !cancelled() }}

webapp-image:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: make build-image
- uses: docker/login-action@v2
- uses: docker/login-action@v3
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.event_name == 'push' }}
with:
registry: quay.io
Expand All @@ -59,13 +72,16 @@ jobs:
test_react_native_android:
# When we change the runner image, the available Android build tools versions will also change.
# We need to update build.gradle too.
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
runs-on: macos-13
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: npm ci
- run: npm run build
- working-directory: ./example/reactnative
Expand All @@ -75,13 +91,16 @@ jobs:
run: ./gradlew :app:assembleRelease

test_capacitor_ios:
runs-on: macos-13
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer
- run: npm ci
- run: npm run build
- working-directory: ./example/capacitor
Expand All @@ -94,12 +113,15 @@ jobs:
working-directory: ./example/capacitor/ios/App
run: xcodebuild -quiet -workspace App.xcworkspace -scheme App -sdk iphonesimulator build
test_capacitor_android:
runs-on: macos-13
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: npm ci
- run: npm run build
- working-directory: ./example/capacitor
Expand All @@ -117,23 +139,17 @@ jobs:
needs: test
# When we change the runner image, the ruby version will change too.
# We need to update .tool-versions to make them the same.
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
runs-on: macos-13
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
# Do not specify ruby-version so that it picks the version declared in .tool-versions
# See https://github.com/ruby/setup-ruby?tab=readme-ov-file#supported-version-syntax
# ruby-version: "Unspecified intentionally. See the above comment"
# Ideally we should turn this on
# But this flag runs bundle install and cache, which does not suit our use case here.
# See https://github.com/ruby/setup-ruby?tab=readme-ov-file#caching-bundle-install-automatically
bundler-cache: false
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- run: sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer
- run: npm install -g appcenter-cli
- run: npm ci
- run: npm run build
Expand Down Expand Up @@ -191,13 +207,16 @@ jobs:
needs: test
# When we change the runner image, the available Android build tools versions will also change.
# We need to update build.gradle too.
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
runs-on: macos-13
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: npm install -g appcenter-cli
- run: npm ci
- run: npm run build
Expand All @@ -218,14 +237,14 @@ jobs:
echo -n "$ANDROID_KEYSTORE_BASE64" | base64 --decode -o $KEYSTORE_PATH
- name: Run zipalign
run: |
"$ANDROID_HOME/build-tools/33.0.2/zipalign" -c -v 4 ./example/reactnative/android/app/build/outputs/apk/release/app-release-unsigned.apk
"$ANDROID_HOME/build-tools/33.0.3/zipalign" -c -v 4 ./example/reactnative/android/app/build/outputs/apk/release/app-release-unsigned.apk
- name: Run apksigner
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.REACT_NATIVE_ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.REACT_NATIVE_ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.REACT_NATIVE_ANDROID_KEY_PASSWORD }}
run: |
"$ANDROID_HOME/build-tools/33.0.2/apksigner" sign \
"$ANDROID_HOME/build-tools/33.0.3/apksigner" sign \
--ks $RUNNER_TEMP/keystore.jks \
--ks-key-alias "$ANDROID_KEY_ALIAS" \
--ks-pass "pass:$ANDROID_KEYSTORE_PASSWORD" \
Expand All @@ -239,13 +258,16 @@ jobs:
capacitor_ios:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
needs: test
runs-on: macos-13
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer
- run: npm install -g appcenter-cli
- run: npm ci
- run: npm run build
Expand Down Expand Up @@ -301,12 +323,15 @@ jobs:
capacitor_android:
if: ${{ github.repository == 'authgear/authgear-sdk-js' && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
needs: test
runs-on: macos-13
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: npm install -g appcenter-cli
- run: npm ci
- run: npm run build
Expand All @@ -333,14 +358,14 @@ jobs:
echo -n "$ANDROID_KEYSTORE_BASE64" | base64 --decode -o $KEYSTORE_PATH
- name: Run zipalign
run: |
"$ANDROID_HOME/build-tools/33.0.2/zipalign" -c -v 4 ./example/capacitor/android/app/build/outputs/apk/release/app-release-unsigned.apk
"$ANDROID_HOME/build-tools/35.0.1/zipalign" -c -v 4 ./example/capacitor/android/app/build/outputs/apk/release/app-release-unsigned.apk
- name: Run apksigner
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.CAPACITOR_ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.CAPACITOR_ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.CAPACITOR_ANDROID_KEY_PASSWORD }}
run: |
"$ANDROID_HOME/build-tools/33.0.2/apksigner" sign \
"$ANDROID_HOME/build-tools/35.0.1/apksigner" sign \
--ks $RUNNER_TEMP/keystore.jks \
--ks-key-alias "$ANDROID_KEY_ALIAS" \
--ks-pass "pass:$ANDROID_KEYSTORE_PASSWORD" \
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ dist/
xcuserdata/
xcshareddata/
temp/

# Ruby
vendor/bundle/
6 changes: 3 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nodejs 20.9.0
nodejs 20.18.3
yarn 1.22.22
kubectl 1.21.8
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md?plain=1#L31
ruby 3.0.7
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#ruby
ruby 3.3.7
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## NOTE(louis): This Gemfile is intended for the whole project, except ./example/reactnative

source 'https://rubygems.org'

# Ruby 3.3 is the default.
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
# https://github.com/actions/runner-images/issues/11345
ruby "~> 3.3"

gem 'cocoapods', '~> 1.16'
Loading

0 comments on commit 477c861

Please sign in to comment.