Skip to content

Add admin3 boundary; fix issue with admin code; COUNTRY=zimbabwe #62

Add admin3 boundary; fix issue with admin code; COUNTRY=zimbabwe

Add admin3 boundary; fix issue with admin code; COUNTRY=zimbabwe #62

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
name: frontend_tests
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/cache@v2
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 --network-timeout 100000
yarn setup:common
- name: yarn lint
run: cd frontend && yarn lint
- name: yarn test
run: cd frontend && yarn test
- name: json check
run: cd frontend && yarn prettier:json-check
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 16.x
uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/cache@v2
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: 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
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 16.x
uses: actions/setup-node@v3
with:
node-version: 16
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
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 }}