Skip to content

Update SDK Version to 30 #435

Update SDK Version to 30

Update SDK Version to 30 #435

Workflow file for this run

name: CI/CD
# JavaScript CI and iOS, Android, and Codepush deployment
on:
push:
branches: [develop, master]
pull_request:
branches: [develop, master]
env:
ENVFILE: ${{ (github.ref == 'refs/heads/master' || github.base_ref == 'refs/heads/master') && '.env.production' || '.env.staging' }}
jobs:
split-tests:
runs-on: ubuntu-latest
outputs:
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- id: set-test-chunks
name: Set Chunks
run: echo "::set-output name=test-chunks::$(yarn --silent test --listTests --json | jq -cM '[_nwise(length / 4 | floor)]')"
- id: set-test-chunk-ids
name: Set Chunk IDs
run: echo "::set-output name=test-chunk-ids::$(echo $CHUNKS | jq -cM 'to_entries | map(.key)')"
env:
CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
test:
runs-on: ubuntu-latest
name: test (chunk ${{ matrix.chunk }})
needs:
- split-tests
strategy:
matrix:
chunk: ${{ fromJson(needs.split-tests.outputs['test-chunk-ids']) }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- name: πŸ“ˆ Run GraphQL Codegen
run: |
yarn gql:codegen
yarn gql:schema
- name: πŸ§ͺ Test (chunk ${{ matrix.chunk }})
run: echo $CHUNKS | jq '.[${{ matrix.chunk }}] | .[] | @text' | xargs yarn test:coverage --ci
env:
CHUNKS: ${{ needs.split-tests.outputs['test-chunks'] }}
- name: Codecov
run: bash <(curl -s https://codecov.io/bash)
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- name: πŸ“ˆ Run GraphQL Codegen
run: |
yarn gql:codegen
yarn gql:schema
- name: πŸ’¨ ESLint
run: yarn lint
typescript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- name: πŸ“ˆ Run GraphQL Codegen
run: |
yarn gql:codegen
yarn gql:schema
- name: βœ… TypeScript lint
run: yarn lint:ts
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- name: πŸ’… Prettier Check
run: yarn prettier:check
onesky-upload:
runs-on: ubuntu-latest
needs: [test, eslint, typescript, prettier]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- name: β›…πŸ”Ό OneSky Upload
env:
ONESKY_API_KEY: ${{ secrets.ONESKY_API_KEY }}
ONESKY_SECRET_KEY: ${{ secrets.ONESKY_SECRET_KEY }}
run: yarn onesky:upload
ios-codepush:
runs-on: ubuntu-latest
needs: [test, eslint, typescript, prettier]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- name: πŸ“ˆ Run GraphQL Codegen
run: |
yarn gql:codegen
yarn gql:schema
- name: β›… OneSky Download
env:
ONESKY_API_KEY: ${{ secrets.ONESKY_API_KEY }}
ONESKY_SECRET_KEY: ${{ secrets.ONESKY_SECRET_KEY }}
run: yarn onesky:download
- name: πŸ—οΈπŸš€πŸ Build and Codepush iOS
env:
APPCENTER_TOKEN: ${{ secrets.APPCENTER_TOKEN }}
# Codepush can't figure out how to parse MARKETING_VERSION https://github.com/microsoft/react-native-code-push/issues/1665 https://stackoverflow.com/a/58769925/665224
run: yarn codepush-ios-staging --token "$APPCENTER_TOKEN" --sourcemap-output sourcemap.ios.js --extra-bundler-option="--sourcemap-sources-root" --extra-bundler-option="./" --description "#${{ github.run_id }} ${{ github.sha }} | ${{ github.event.head_commit.message }}" -t `sed -n '/MARKETING_VERSION/{s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;}' ./ios/MissionHub.xcodeproj/project.pbxproj`
- name: πŸ”ΌπŸπŸ—ΊοΈ Upload iOS sourcemaps to Rollbar
env:
ROLLBAR_POST_SERVER_ITEM_TOKEN: ${{ secrets.ROLLBAR_POST_SERVER_ITEM_TOKEN }}
run: |
curl https://api.rollbar.com/api/1/sourcemap \
-F access_token=$ROLLBAR_POST_SERVER_ITEM_TOKEN \
-F version=${{ github.sha }}.ios \
-F minified_url=http://reactnativehost/main.jsbundle \
-F source_map=@sourcemap.ios.js
android-codepush:
runs-on: ubuntu-latest
needs: [test, eslint, typescript, prettier]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- name: πŸ“ˆ Run GraphQL Codegen
run: |
yarn gql:codegen
yarn gql:schema
- name: β›… OneSky Download
env:
ONESKY_API_KEY: ${{ secrets.ONESKY_API_KEY }}
ONESKY_SECRET_KEY: ${{ secrets.ONESKY_SECRET_KEY }}
run: yarn onesky:download
- name: πŸ—οΈπŸš€πŸ€– Build and Codepush Android
env:
APPCENTER_TOKEN: ${{ secrets.APPCENTER_TOKEN }}
run: yarn codepush-android-staging --token "$APPCENTER_TOKEN" --sourcemap-output sourcemap.android.js --extra-bundler-option="--sourcemap-sources-root" --extra-bundler-option="./" --description "#${{ github.run_id }} ${{ github.sha }} | ${{ github.event.head_commit.message }}"
- name: πŸ”ΌπŸ€–πŸ—ΊοΈ Upload Android sourcemaps to Rollbar
env:
ROLLBAR_POST_SERVER_ITEM_TOKEN: ${{ secrets.ROLLBAR_POST_SERVER_ITEM_TOKEN }}
run: |
curl https://api.rollbar.com/api/1/sourcemap \
-F access_token=$ROLLBAR_POST_SERVER_ITEM_TOKEN \
-F version=${{ github.sha }}.android \
-F minified_url=http://reactnativehost/main.jsbundle \
-F source_map=@sourcemap.android.js
ios-deploy:
runs-on: macos-latest
needs: [test, eslint, typescript, prettier]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- name: πŸ“ˆ Run GraphQL Codegen
run: |
yarn gql:codegen
yarn gql:schema
- name: β›… OneSky Download
env:
ONESKY_API_KEY: ${{ secrets.ONESKY_API_KEY }}
ONESKY_SECRET_KEY: ${{ secrets.ONESKY_SECRET_KEY }}
run: yarn onesky:download
- name: πŸ’Ž Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: βž• Add Commit SHA to ENVFILE
run: echo "COMMIT_SHA=$GITHUB_SHA" >> ./.env.production
- name: πŸ— Configure GitHub login
run: echo -e "machine github.com\n login $CI_USER_TOKEN" >> ~/.netrc
env:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN}}
- name: πŸ—οΈπŸš€πŸ Build and push to Testflight
uses: maierj/fastlane-action@v2.0.0
with:
lane: ios beta
subdirectory: ios
env:
TRAVIS_BRANCH: ${{ github.ref }}
TRAVIS_TAG: ${{ github.ref }}
TRAVIS_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
TRAVIS_BUILD_NUMBER: ${{ github.run_id }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
SLACK_URL: ${{ secrets.SLACK_URL }}
android-deploy:
runs-on: ubuntu-latest
needs: [test, eslint, typescript, prettier]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
with:
# Used for computing the Android versionCode https://github.com/CruGlobal/missionhub-react-native/blob/4c37730c21baeea3a304702b1bbbbce3d11f320d/android/app/build.gradle#L145
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: egordm/gha-yarn-node-cache@v1
- name: πŸ“¦ Install Dependencies
run: yarn
- name: πŸ“ˆ Run GraphQL Codegen
run: |
yarn gql:codegen
yarn gql:schema
- name: β›… OneSky Download
env:
ONESKY_API_KEY: ${{ secrets.ONESKY_API_KEY }}
ONESKY_SECRET_KEY: ${{ secrets.ONESKY_SECRET_KEY }}
run: yarn onesky:download
- name: β˜• Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: πŸ’Ž Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: βž• Add Commit SHA to ENVFILE
run: echo "COMMIT_SHA=$GITHUB_SHA" >> ./.env.production
- name: πŸ”“ Decrypt GooglePlayAPI.json
# Using "-md md5" to support old file from previous version of OpenSSL https://www.openssl.org/docs/faq.html#USER3
run: openssl aes-256-cbc -pass "pass:$GOOGLE_PLAY_API_FILE_PASSWORD" -in ./android/fastlane/GooglePlayAPI.enc -out ./android/fastlane/GooglePlayAPI.json -d -a -md md5
env:
GOOGLE_PLAY_API_FILE_PASSWORD: ${{ secrets.GOOGLE_PLAY_API_FILE_PASSWORD }}
- name: πŸ—οΈπŸš€πŸ€– Build and push to Android Beta
uses: maierj/fastlane-action@v2.0.0
with:
lane: android beta
subdirectory: android
env:
TRAVIS_BRANCH: ${{ github.ref }}
TRAVIS_TAG: ${{ github.ref }}
TRAVIS_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
TRAVIS_BUILD_NUMBER: ${{ github.run_id }}
GOOGLE_PLAY_UPLOAD_KEY_PASSWORD: ${{ secrets.GOOGLE_PLAY_UPLOAD_KEY_PASSWORD }}
SLACK_URL: ${{ secrets.SLACK_URL }}