feat: automate run tests #5
Workflow file for this run
This file contains hidden or 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: Run Tests | |
| on: | |
| pull_request: | |
| branches: | |
| - '**' | |
| jobs: | |
| test-android: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://npm.pkg.github.com' | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4.7.0 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: gradle | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Install dependencies | |
| run: |- | |
| npm install | |
| cd example-app | |
| npm install | |
| - name: Create environment.ts | |
| run: | | |
| mkdir -p example-app/src/environments | |
| cat > example-app/src/environments/environment.ts <<'EOF' | |
| export const environment = { | |
| IONIC_API_KEY: 'fake-api-key', | |
| IONIC_API_SECRET: 'fake-api-secret', | |
| IONIC_SITE_ID: 'fake-site-id', | |
| IONIC_REGION: 'beta', | |
| IONIC_COMPANY_NAME: 'Glia Widgets Ionic', | |
| }; | |
| EOF | |
| - name: Sync Capacitor | |
| run: | | |
| npm run build | |
| cd example-app | |
| npm run build | |
| npx cap sync android | |
| - name: Run Android Build | |
| run: | | |
| cd example-app/android | |
| ./gradlew app:assembleDebug | |
| test-ios: | |
| runs-on: macos-15 | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://npm.pkg.github.com' | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.2 | |
| bundler-cache: true | |
| - name: Set up Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: latest-stable | |
| - name: Install dependencies | |
| run: |- | |
| npm install | |
| cd example-app | |
| npm install | |
| - name: Create environment.ts | |
| run: | | |
| mkdir -p example-app/src/environments | |
| cat > example-app/src/environments/environment.ts <<'EOF' | |
| export const environment = { | |
| IONIC_API_KEY: 'fake-api-key', | |
| IONIC_API_SECRET: 'fake-api-secret', | |
| IONIC_SITE_ID: 'fake-site-id', | |
| IONIC_REGION: 'beta', | |
| IONIC_COMPANY_NAME: 'Glia Widgets Ionic', | |
| }; | |
| EOF | |
| - name: Sync Capacitor | |
| run: | | |
| npm run build | |
| cd example-app | |
| npm run build | |
| npx cap sync ios | |
| - name: Run iOS Build | |
| run: | | |
| cd example-app/ios/App | |
| xcodebuild -workspace App.xcworkspace -scheme App -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' -showBuildTimingSummary build |