Skip to content
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

DRAFT: feat: setup GitHub actions fastlane #7

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cd50129
Added details screen, implemented custom header with back functionali…
kamilkedzierski Jul 17, 2024
21e38b6
Changed post to get
kamilkedzierski Jul 19, 2024
dd09a68
Added unit and integration tests, change post to get..., added some a…
kamilkedzierski Jul 18, 2024
2431013
Added simple e2e tests
kamilkedzierski Jul 18, 2024
9863756
Added native module package for getting users location, added lucide …
kamilkedzierski Jul 22, 2024
78a2f52
Cleaned up native modules code, added reac-native-permission to handl…
kamilkedzierski Jul 22, 2024
fac8eef
Init github actions
kamilkedzierski Jul 22, 2024
3e9f0a3
Fixed unit tests
kamilkedzierski Jul 22, 2024
266f2a7
Added .env.test into workflow
kamilkedzierski Jul 22, 2024
feb6f0c
Removed e2e tests and added caching dependencies
kamilkedzierski Jul 22, 2024
05c781a
fixed spacing issue
kamilkedzierski Jul 22, 2024
605cc0a
Added e2e tests
kamilkedzierski Jul 22, 2024
3a09a56
Changed npm to yarn
kamilkedzierski Jul 22, 2024
97efdad
removed add-path as it needs upgrade
kamilkedzierski Jul 22, 2024
98e138a
Removed global add
kamilkedzierski Jul 22, 2024
96601b5
Added missing scripts from Stripe example
kamilkedzierski Jul 22, 2024
3abd5dc
Added one more missing script...
kamilkedzierski Jul 22, 2024
7b3bd27
Messed up a bit - had to remove a couple of scripts as I realised tha…
kamilkedzierski Jul 22, 2024
d9aeeb4
Fixed release option
kamilkedzierski Jul 22, 2024
5238757
Adjusted yml file
kamilkedzierski Jul 22, 2024
505c253
Added fastlane simple build without signing
kamilkedzierski Jul 23, 2024
1538b2f
Fixed workflow issue
kamilkedzierski Jul 23, 2024
c526114
Fastlane should work now - fixed issue
kamilkedzierski Jul 23, 2024
aa70b8d
Added Java 17 setup
kamilkedzierski Jul 23, 2024
63e30ab
Add path "android" to artifact path
kamilkedzierski Jul 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
OPEN_WEATHER_API_KEY=YOUR_API_KEY
OPEN_WEATHER_API_KEY=YOUR_API_KEY
OPEN_WEATHER_BASE_URL=BASE_URL
143 changes: 143 additions & 0 deletions .github/workflows/build-release-without-signing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Build release without signing - Android and iOS

on:
pull_request:
branches: ['main']

jobs:
build-android:
runs-on: ubuntu-latest
environment: production

steps:
- name: checkout
uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: 'Create .env file'
run: |
touch .env
echo OPEN_WEATHER_API_KEY=${{ secrets.OPEN_WEATHER_API_KEY }} >> .env
echo OPEN_WEATHER_BASE_URL=${{ secrets.OPEN_WEATHER_BASE_URL }} >> .env

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 22
cache: 'yarn'
- name: Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

- name: Cache Yarn dependencies
uses: actions/cache@v3
with:
path: |
**/node_modules
!**/node_modules/.cache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Cache Ruby dependencies
uses: actions/cache@v3
with:
path: |
vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Install dependencies
run: yarn

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.4
bundler: 2.5.11

- name: Setup Java environment
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Install dependencies
run: |
gem install bundler
bundle install

- name: Run Fastlane
run: yarn fastlane:build:android

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: android-release-app
path: android/app/build/outputs/apk/release/app-release.apk

build-ios:
runs-on: macos-latest
environment: production
steps:
- name: checkout
uses: actions/checkout@v4
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v2
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: 'Create .env file for iOS'
run: |
touch .env
echo OPEN_WEATHER_API_KEY=${{ secrets.OPEN_WEATHER_API_KEY }} >> .env
echo OPEN_WEATHER_BASE_URL=${{ secrets.OPEN_WEATHER_BASE_URL }} >> .env
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.4
bundler: 2.5.11
- name: Cache Ruby dependencies
uses: actions/cache@v3
with:
path: |
vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install dependencies
run: |
gem install bundler
bundle install
- name: Install Dependencies
run: yarn bootstrap
- name: Run Fastlane for iOS
run: yarn fastlane:build:ios
127 changes: 127 additions & 0 deletions .github/workflows/e2e-test-production-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: E2E Test - Main PR

on:
pull_request:
branches: ['main']

jobs:
test-android:
name: e2e-android-test
runs-on: ubuntu-latest
environment: production
steps:
- name: checkout
uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 22
cache: 'yarn'

- name: Install React Native CLI
run: yarn add react-native-cli

- name: Install Dependencies
run: yarn

- name: Setup Java environment
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

- name: Install Maestro CLI
run: curl -Ls "https://get.maestro.mobile.dev" | bash

- name: Add Maestro to path
run: echo "${HOME}/.maestro/bin" >> $GITHUB_PATH

- name: Run Android Emulator and app
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
arch: x86_64
target: google_apis
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
yarn run-android-release
yarn test:e2e

test-ios:
name: e2e-ios-test
runs-on: macos-13
environment: production
steps:
- name: checkout
uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- uses: actions/cache@v2
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 22
cache: 'yarn'

- name: Install React Native CLI
run: yarn add react-native-cli

- name: Install Dependencies
run: yarn bootstrap

- name: Install Maestro CLI
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
brew tap facebook/fb
brew install facebook/fb/idb-companion

- name: Add Maestro to path
run: echo "${HOME}/.maestro/bin" >> $GITHUB_PATH

- name: Build iOS App
run: |
yarn run-ios-release

- name: Run tests
run: |
yarn test:e2e
42 changes: 42 additions & 0 deletions .github/workflows/unit-test-production-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Unit Test - Main PR

on:
pull_request:
branches: ['main']

jobs:
unit-test:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: 'Create .env.test file'
run: |
touch .env.test
echo OPEN_WEATHER_API_KEY=${{ secrets.OPEN_WEATHER_API_KEY }} >> .env.test
echo OPEN_WEATHER_BASE_URL=${{ secrets.OPEN_WEATHER_BASE_URL }} >> .env.test

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 22
cache: 'yarn'

- name: Cache Yarn dependencies
uses: actions/cache@v3
with:
path: |
**/node_modules
!**/node_modules/.cache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn

- name: Run unit tests
run: yarn test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ yarn-error.log
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.env
.env
.env.*
!.env.example
1 change: 1 addition & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function App() {
background: config.tokens.colors.white,
},
};

return (
<GluestackUIProvider config={config}>
<StatusBar backgroundColor="$trueGray200" barStyle="dark-content" />
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ ruby ">= 2.6.10"
# bound in the template on Cocoapods with next React Native release.
gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
gem 'fastlane', '~> 2.221.1'
Loading
Loading