Skip to content

Step 6 - add Continuous Integration and E2E Tests workflows #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: damiannowak/step-5-native-location-module
Choose a base branch
from
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ios/*
android/*
93 changes: 93 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Continuous Integration
on: pull_request
run-name: ${{ github.actor }} has opened a PR

jobs:
continuous-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '21'
cache: yarn
cache-dependency-path: yarn.lock
- run: npm install -g yarn
- run: yarn install
- run: yarn lint
- run: yarn test
e2e-tests-android:
runs-on: ubuntu-latest
needs: [continuous-integration]
outputs:
apk: android/app/build/outputs/apk/release/app-release.apk

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '21'
cache: yarn
cache-dependency-path: yarn.lock
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- run: npm install -g yarn
- run: yarn install
- name: Create .env file
run: |
touch .env
echo API_URL=${{ secrets.API_URL }} >> .env
echo API_KEY=${{ secrets.API_KEY }} >> .env
echo API_ICON_URL=${{ secrets.API_ICON_URL }} >> .env
- run: yarn android:build:release
- uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: android/app/build/outputs/apk/release/app-release.apk
e2e-tests-ios:
runs-on: macOS-latest
needs: [continuous-integration]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '21'
cache: yarn
cache-dependency-path: yarn.lock
- run: npm install -g yarn
- run: yarn install

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 2.7.8
- run: bundle install
- name: Cache Pods
uses: actions/cache@v4
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-
- name: Pod install
working-directory: ios
run: bundle exec pod install

- name: Create .env file
run: |
touch .env
echo API_URL=${{ secrets.API_URL }} >> .env
echo API_KEY=${{ secrets.API_KEY }} >> .env
echo API_ICON_URL=${{ secrets.API_ICON_URL }} >> .env
- run: yarn ios:build:release

- name: Find ios .app file location
id: find_ios_app_file
run: |
echo "IOS_APP_FILE=$(find $HOME/Library/Developer/Xcode/DerivedData -type d -name "WeatherApp.app")" >> "$GITHUB_ENV"
- uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: ${{ env.IOS_APP_FILE }}
File renamed without changes.
File renamed without changes.
12 changes: 5 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ GEM
base64
nkf
rexml
activesupport (6.1.7.7)
activesupport (7.0.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
Expand Down Expand Up @@ -66,10 +65,10 @@ GEM
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
json (2.7.1)
minitest (5.22.2)
minitest (5.22.3)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
Expand All @@ -89,7 +88,6 @@ GEM
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.6.13)

PLATFORMS
ruby
Expand All @@ -99,7 +97,7 @@ DEPENDENCIES
cocoapods (>= 1.13, < 1.15)

RUBY VERSION
ruby 2.6.10p210
ruby 2.7.8p225

BUNDLED WITH
1.17.2
2.1.4
2 changes: 0 additions & 2 deletions app/features/cities/CitiesList/CitiesListScreen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import {
import CitiesListScreen from './CitiesListScreen.tsx';
import {GET_WEATHER_FOR_CITIES_RESPONSE_DATA} from '../../../../jest/mocks/data';
import {
setupGetCityWeatherForLocationSuccessHandler,
setupGetWeatherForCitiesEmptyDataHandler,
setupGetWeatherForCitiesFailedHandler,
setupGetWeatherForCitiesSuccessHandler,
} from '../../../../jest/mocks/handlers.ts';
import {ProvidersWrapper} from '../../../../jest/utils.tsx';

describe('Screen: CitiesListScreen', () => {
beforeEach(() => setupGetCityWeatherForLocationSuccessHandler());
describe('success', () => {
beforeEach(() => setupGetWeatherForCitiesSuccessHandler());
it('should display cities list', async () => {
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

import {AppRegistry} from 'react-native';

import App from './app/App';
import {name as appName} from './app.json';

Expand Down
12 changes: 6 additions & 6 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ PODS:
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- glog (0.3.5)
- hermes-engine (0.73.5):
- hermes-engine/Pre-built (= 0.73.5)
- hermes-engine/Pre-built (0.73.5)
- hermes-engine (0.73.6):
- hermes-engine/Pre-built (= 0.73.6)
- hermes-engine/Pre-built (0.73.6)
- libevent (2.1.12)
- OpenSSL-Universal (1.1.1100)
- RCT-Folly (2022.05.16.00):
Expand Down Expand Up @@ -1356,7 +1356,7 @@ SPEC CHECKSUMS:
FlipperKit: 37525a5d056ef9b93d1578e04bc3ea1de940094f
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: 1d1835b2cc54c381909d94d1b3c8e0a2f1a94a0e
hermes-engine: 9cecf9953a681df7556b8cc9c74905de8f3293c0
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
Expand Down Expand Up @@ -1407,8 +1407,8 @@ SPEC CHECKSUMS:
RNScreens: 17e2f657f1b09a71ec3c821368a04acbb7ebcb46
RNVectorIcons: 73ab573085f65a572d3b6233e68996d4707fd505
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 805bf71192903b20fc14babe48080582fee65a80
Yoga: d17d2cc8105eed528474683b42e2ea310e1daf61

PODFILE CHECKSUM: 62d91a1b81ffee03ab62d1b2484944d15f323dc2

COCOAPODS: 1.15.2
COCOAPODS: 1.14.3
6 changes: 5 additions & 1 deletion jest/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import {setupGetCityWeatherForLocationSuccessHandler} from './mocks/handlers.ts';
import {server} from './mocks/server.ts';
import {testQueryClient} from './utils.tsx';

beforeAll(() => {
server.listen();
});

beforeEach(() => {
setupGetCityWeatherForLocationSuccessHandler();
});

afterEach(() => {
server.resetHandlers();
testQueryClient.clear();
});

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
"private": true,
"scripts": {
"android": "react-native run-android",
"android:build:release": "cd android && ./gradlew assembleRelease",
"ios": "react-native run-ios",
"ios:build:release": "cd ios && xcodebuild -scheme 'WeatherApp' -workspace 'WeatherApp.xcworkspace' -configuration 'Release' -sdk 'iphonesimulator' -destination 'generic/platform=iOS Simulator'",
"pod-install": "cd ios && bundle exec pod install",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"e2e": "maestro test ./e2e/main.yaml"
"e2e": "maestro test .maestro/main.yaml"
},
"dependencies": {
"@react-native-community/netinfo": "^11.3.1",
Expand Down