Skip to content

move to production #3128

move to production

move to production #3128

name: mobile-app-code-tests
on:
pull_request:
branches:
- main
- staging
- master
jobs:
check:
name: check for changes in the mobile app
outputs:
run_app_tests: ${{ steps.check_files.outputs.run_app_tests }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: check modified app folder
id: check_files
run: |
echo "=============== list modified files ==============="
git diff --name-only HEAD^ HEAD
echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
echo "run_app_tests=false" >>$GITHUB_OUTPUT
while IFS= read -r file
do
echo $file
if [[ $file == mobile/* ]]; then
echo "run_app_tests=true" >>$GITHUB_OUTPUT
fi
done < files.txt
drive:
name: App code tests
needs: [check]
if: needs.check.outputs.run_app_tests == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: mobile
steps:
- name: Checkout
uses: actions/checkout@v3.5.2
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1.1.0
with:
credentials_json: ${{ secrets.GCP_SA_CREDENTIALS }}
- name: Set up gcloud Cloud SDK environment
uses: google-github-actions/setup-gcloud@v1.1.0
- name: Add .env files
run: |
gcloud secrets versions access latest --secret="prod-env-mobile-app" > .env.prod
gcloud secrets versions access latest --secret="prod-env-mobile-app" > .env.dev
- name: Install Flutter
uses: subosito/flutter-action@v2.10.0
with:
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Run tests
run: flutter test --coverage
continue-on-error: true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
directory: mobile/coverage/