diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..b86a4af --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +ios/* +android/* diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml new file mode 100644 index 0000000..73cdda5 --- /dev/null +++ b/.github/workflows/continuous-integration.yaml @@ -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/action-maestro-cloud@v1.8.1 + 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/action-maestro-cloud@v1.8.1 + with: + api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }} + app-file: ${{ env.IOS_APP_FILE }} diff --git a/e2e/flows/cities-list-screen.yaml b/.maestro/flows/cities-list-screen.yaml similarity index 100% rename from e2e/flows/cities-list-screen.yaml rename to .maestro/flows/cities-list-screen.yaml diff --git a/e2e/flows/city-details-screen.yaml b/.maestro/flows/city-details-screen.yaml similarity index 100% rename from e2e/flows/city-details-screen.yaml rename to .maestro/flows/city-details-screen.yaml diff --git a/e2e/main.yaml b/.maestro/main.yaml similarity index 100% rename from e2e/main.yaml rename to .maestro/main.yaml diff --git a/e2e/subflows/go-back.yaml b/.maestro/subflows/go-back.yaml similarity index 100% rename from e2e/subflows/go-back.yaml rename to .maestro/subflows/go-back.yaml diff --git a/Gemfile.lock b/Gemfile.lock index ffa544d..d9afb71 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -89,7 +88,6 @@ GEM colored2 (~> 3.1) nanaimo (~> 0.3.0) rexml (~> 3.2.4) - zeitwerk (2.6.13) PLATFORMS ruby @@ -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 diff --git a/app/features/cities/CitiesList/CitiesListScreen.test.tsx b/app/features/cities/CitiesList/CitiesListScreen.test.tsx index 78282bf..e0da471 100644 --- a/app/features/cities/CitiesList/CitiesListScreen.test.tsx +++ b/app/features/cities/CitiesList/CitiesListScreen.test.tsx @@ -10,7 +10,6 @@ import { import CitiesListScreen from './CitiesListScreen.tsx'; import {GET_WEATHER_FOR_CITIES_RESPONSE_DATA} from '../../../../jest/mocks/data'; import { - setupGetCityWeatherForLocationSuccessHandler, setupGetWeatherForCitiesEmptyDataHandler, setupGetWeatherForCitiesFailedHandler, setupGetWeatherForCitiesSuccessHandler, @@ -18,7 +17,6 @@ import { import {ProvidersWrapper} from '../../../../jest/utils.tsx'; describe('Screen: CitiesListScreen', () => { - beforeEach(() => setupGetCityWeatherForLocationSuccessHandler()); describe('success', () => { beforeEach(() => setupGetWeatherForCitiesSuccessHandler()); it('should display cities list', async () => { diff --git a/index.js b/index.js index 7a02d48..5416ca1 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ */ import {AppRegistry} from 'react-native'; + import App from './app/App'; import {name as appName} from './app.json'; diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1c759e3..706f98f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -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): @@ -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 @@ -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 diff --git a/jest/setupTests.ts b/jest/setupTests.ts index d586462..61826a4 100644 --- a/jest/setupTests.ts +++ b/jest/setupTests.ts @@ -1,3 +1,4 @@ +import {setupGetCityWeatherForLocationSuccessHandler} from './mocks/handlers.ts'; import {server} from './mocks/server.ts'; import {testQueryClient} from './utils.tsx'; @@ -5,8 +6,11 @@ beforeAll(() => { server.listen(); }); +beforeEach(() => { + setupGetCityWeatherForLocationSuccessHandler(); +}); + afterEach(() => { - server.resetHandlers(); testQueryClient.clear(); }); diff --git a/package.json b/package.json index a31592f..7da0163 100644 --- a/package.json +++ b/package.json @@ -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",