Skip to content

Commit

Permalink
Add E2E tests for Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-sajko committed Jul 15, 2024
1 parent ea5a609 commit c1855c2
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .github/actions/build-android/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: 'Build Android App'
description: 'Build the Android app'
runs:
using: 'composite'
steps:
- name: Build Android App
shell: bash
working-directory: android
run: ./gradlew assembleRelease
13 changes: 13 additions & 0 deletions .github/actions/build-ios/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Build iOS App'
description: 'Build the iOS app'
runs:
using: 'composite'
steps:
- name: Build iOS App
shell: bash
working-directory: ios
run: |
xcodebuild build -scheme 'WeatherApp' \
-configuration Debug \
-workspace 'WeatherApp.xcworkspace' \
-destination 'generic/platform=iOS Simulator' CONFIGURATION_BUILD_DIR=$PWD/build
10 changes: 10 additions & 0 deletions .github/actions/install-android/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'Install Android dependencies'
description: 'Install dependencies for the project'
runs:
using: 'composite'
steps:
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
24 changes: 24 additions & 0 deletions .github/actions/install-ios/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Install iOS dependencies'
description: 'Install dependencies for the project'
runs:
using: 'composite'
steps:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true

- name: Install Bundler
shell: bash
working-directory: ios
run: bundle install

- name: Install CocoaPods
shell: bash
run: sudo gem install cocoapods

- name: Install Pods
shell: bash
working-directory: ios
run: pod install
6 changes: 4 additions & 2 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ description: 'Install dependencies for the project'
runs:
using: 'composite'
steps:
- name: Copy .env file
- name: Create .env file
shell: bash
run: cp .env.template .env
run: |
touch .env
echo WEATHER_API_KEY=${{ secrets.WEATHER_API_KEY }} >> .env
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: E2E Tests

on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
ios-e2e-tests:
runs-on: macos-latest

strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- uses: ./.github/actions/install-ios
- uses: ./.github/actions/install-android
- uses: ./.github/actions/build-ios
- uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: build/WeatherApp.app

android-e2e-tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

outputs:
apk: android/app/build/outputs/apk/release/app-release.apk

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- uses: ./.github/actions/install-android
- uses: ./.github/actions/build-android
- uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app/build/outputs/apk/debug/app-debug.apk
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: CI
name: Unit Tests

on:
push:
Expand Down

0 comments on commit c1855c2

Please sign in to comment.