Skip to content

Update gemfile

Update gemfile #701

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]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
ENVFILE: ${{ (github.ref == 'refs/heads/master' || github.base_ref == 'refs/heads/master') && '.env.production' || '.env.staging' }}
permissions:
id-token: write
contents: read
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: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_IAM_ONESKY_ROLE_ARN }}
aws-region: us-east-1
- name: Import OneSky Keys
uses: dkershner6/aws-ssm-getparameters-action@v1
with:
parameterPairs: |
/shared/onesky/PUBLIC_KEY = ONESKY_API_KEY,
/shared/onesky/SECRET_KEY = ONESKY_SECRET_KEY
- name: β›…πŸ”Ό OneSky Upload
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: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_IAM_ONESKY_ROLE_ARN }}
aws-region: us-east-1
- name: Import OneSky Keys
uses: dkershner6/aws-ssm-getparameters-action@v1
with:
parameterPairs: |
/shared/onesky/PUBLIC_KEY = ONESKY_API_KEY,
/shared/onesky/SECRET_KEY = ONESKY_SECRET_KEY
- name: β›… OneSky Download
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 [email protected]
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: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_IAM_ONESKY_ROLE_ARN }}
aws-region: us-east-1
- name: Import OneSky Keys
uses: dkershner6/aws-ssm-getparameters-action@v1
with:
parameterPairs: |
/shared/onesky/PUBLIC_KEY = ONESKY_API_KEY,
/shared/onesky/SECRET_KEY = ONESKY_SECRET_KEY
- name: β›… OneSky Download
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 [email protected]
ios-deploy:
runs-on: macos-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: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_IAM_ONESKY_ROLE_ARN }}
aws-region: us-east-1
- name: Import OneSky Keys
uses: dkershner6/aws-ssm-getparameters-action@v1
with:
parameterPairs: |
/shared/onesky/PUBLIC_KEY = ONESKY_API_KEY,
/shared/onesky/SECRET_KEY = ONESKY_SECRET_KEY
- name: β›… OneSky Download
run: yarn onesky:download
- name: πŸ’Ž Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- 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
- name: πŸ”’ Set correct permissions for .netrc
run: chmod 0600 ~/.netrc
env:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN}}
- name: Import App Store Connect API Key
env:
APP_STORE_CONNECT_API_JSON_PAYLOAD: ${{ secrets.APP_STORE_CONNECT_API_JSON_PAYLOAD }}
run: echo $APP_STORE_CONNECT_API_JSON_PAYLOAD > ios/fastlane/AppleAppStoreApi.json
- name: Increment Xcode Project Build Number
uses: maierj/[email protected]
with:
lane: ios cru_shared_lane_increment_xcode_project_build_number
subdirectory: ios
- name: πŸ—οΈπŸš€πŸ Build and push to Testflight
uses: maierj/[email protected]
with:
lane: ios cru_shared_lane_build_and_deploy_for_testflight_release is_running_in_ci:true
subdirectory: ios
env:
MATCH_GIT_BASIC_AUTHORIZATION_PAT: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION_PAT }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
- name: Archive Fastlane Gym Logs
if: always()
uses: actions/upload-artifact@v3
with:
name: fastlane-gym-logs
path: '/Users/runner/Library/Logs/gym/MissionHub-MissionHub.log'
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: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_IAM_ONESKY_ROLE_ARN }}
aws-region: us-east-1
- name: Import OneSky Keys
uses: dkershner6/aws-ssm-getparameters-action@v1
with:
parameterPairs: |
/shared/onesky/PUBLIC_KEY = ONESKY_API_KEY,
/shared/onesky/SECRET_KEY = ONESKY_SECRET_KEY
- name: β›… OneSky Download
run: yarn onesky:download
- name: β˜• Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: πŸ’Ž Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: βž• Add Commit SHA to ENVFILE
run: echo "COMMIT_SHA=$GITHUB_SHA" >> ./.env.production
- name: πŸ”“ Import GooglePlayAPI.json
env:
GOOGLE_PLAY_API_KEY: ${{ secrets.GOOGLE_PLAY_API_KEY }}
run: echo $GOOGLE_PLAY_API_KEY > ./android/fastlane/GooglePlayAPI.json
- name: πŸ—οΈπŸš€πŸ€– Build and push to Android Beta
uses: maierj/[email protected]
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 }}