Fix boundary selection outside of alert mode #2410
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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-2024-7-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn-2024-7 | |
- 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: 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: | |
surge_url: prism-${{ github.event.pull_request.number }}.surge.sh | |
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-2024-7-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn-2024-7 | |
- 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 surge | |
uses: dswistowski/surge-sh-action@v1 | |
with: | |
domain: ${{ env.surge_url }} | |
project: "frontend/build/." | |
login: ${{ secrets.surge_login }} | |
token: ${{ secrets.surge_token }} | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')" | |
- name: Comment PR | |
uses: marocchino/sticky-pull-request-comment@v1 | |
continue-on-error: true | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: | | |
Build succeeded and deployed at https://${{ env.surge_url }} | |
(hash ${{ github.event.pull_request.head.sha }} deployed at ${{ steps.date.outputs.date }}) | |
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 }} | |
surge_url: prism-master-${{ matrix.country }}.surge.sh | |
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-${{ hashFiles('**/frontend/yarn.lock') }}-${{ hashFiles('**/common/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- 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 surge | |
uses: dswistowski/surge-sh-action@v1 | |
with: | |
domain: ${{ env.surge_url }} | |
project: "frontend/build/." | |
login: ${{ secrets.surge_login }} | |
token: ${{ secrets.surge_token }} |