Skip to content

Update readiness coloring #3060

Update readiness coloring

Update readiness coloring #3060

Workflow file for this run

# for comment on PR, follow instruction for: https://github.com/marketplace/actions/sticky-pull-request-comment
name: PRISM CI - Frontend
on:
# Run on all pull requests and on pushes to master.
pull_request:
push:
branches:
- master
jobs:
frontend_tests:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
max-parallel: 2
name: frontend_tests
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-2025-2-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-2025-2
- name: Install dependencies if needed.
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
cd frontend
yarn install --frozen-lockfile --network-timeout 100000
yarn setup:common
- name: setup 'common' package
run: cd frontend && yarn run setup:common
- name: Lint
run: cd frontend && yarn lint:ci
- name: Test
run: |
cd frontend
yarn test
- name: JSON check
run: cd frontend && yarn prettier:json-check
- name: Layer availability check
if: matrix.os == 'ubuntu-latest'
run: |
cd frontend && yarn preprocess-layers
DIFF=$(git diff --name-only)
if [ "$DIFF" != "" ]; then
echo "Files have changed. Make sure to run yarn preprocess-layers and commit changes."
echo "$DIFF"
exit 1
fi
- name: Check boundary keys
run: cd frontend && yarn check-boundary-keys
- name: Build
run: cd frontend && yarn build
frontend_build_and_deploy:
needs: frontend_tests
if: github.event_name == 'pull_request'
name: frontend_build_and_deploy
runs-on: ubuntu-latest
env:
GIT_HASH: ${{ github.event.pull_request.head.sha }}
firebase_channel: prism-${{ github.event.pull_request.number }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-2025-3-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-2025-3
- name: Install dependencies if needed.
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
cd frontend
yarn install --frozen-lockfile
yarn setup:common
- name: Find country variable
id: country_regex
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.event.pull_request.title }}
regex: 'COUNTRY=(\w+)'
- name: Echo country variable
run: echo "Country env is ${{ steps.country_regex.outputs.group1 }}"
- name: build frontend
run: |
cd frontend
REACT_APP_QA_MODE=true GENERATE_SOURCEMAP=false REACT_APP_COUNTRY=${{ steps.country_regex.outputs.group1 || 'mozambique'}} yarn build
- name: Deploy on firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_PRISM_FRONTEND }}"
projectId: "prism-frontend"
target: "staging-target"
entryPoint: "frontend"
channelId: ${{ env.firebase_channel }}
expires: 30d
master_frontend_build_and_deploy:
needs: frontend_tests
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: master_frontend_build_and_deploy
runs-on: ubuntu-latest
strategy:
matrix:
country: [mozambique, cambodia, rbd]
env:
REACT_APP_SENTRY_URL: ${{ secrets.REACT_APP_SENTRY_URL }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-2025-2-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-2025-2
- name: Install dependencies if needed.
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
cd frontend
yarn install --frozen-lockfile
yarn setup:common
- name: build frontend
run: |
cd frontend
GENERATE_SOURCEMAP=false REACT_APP_COUNTRY=${{ matrix.country }} yarn build
- name: Deploy on firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_PRISM_FRONTEND }}"
projectId: "prism-frontend"
target: "staging-target"
entryPoint: "frontend"
channelId: ${{ env.firebase_channel }}
expires: 30d