Merge pull request #456 from GNS-Science/fix/update_tests #246
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
name: Deploy TEST | |
on: | |
push: | |
branches: [ deploy-test ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
environment: AWS_TEST | |
strategy: | |
matrix: | |
node-version: [18] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Node Setup | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@gns-science' | |
- name: Yarn Test | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.TOSHI_NEST_PACKAGE_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GENERATE_SOURCEMAP: false | |
run: | | |
yarn install --frozen-lockfile | |
yarn test | |
- name: Yarn build | |
env: | |
GENERATE_SOURCEMAP: false | |
run: | | |
echo "Configure build environment" | |
touch .env | |
echo "The following settings can be exposed, and are common to PROD and TEST.." | |
echo "VITE_HAZARD_COLOR_LIMIT=12" >> .env | |
echo "VITE_HAZARD_COLOR_MAP=portland" >> .env | |
echo "VITE_HAZARD_COLOR_UNCERTAINTY_OPACITY=0.8" >> .env | |
echo "VITE_MAP_IMTS=PGA,SA(0.1),SA(0.2),SA(0.3),SA(0.4),SA(0.5),SA(0.7),SA(1.0),SA(1.5),SA(2.0),SA(3.0),SA(4.0),SA(5.0),SA(6.0),SA(7.5),SA(10.0)" >> .env | |
echo "VITE_MAP_VS30S=150,175,200,225,250,275,300,350,375,400,450,500,600,750,900,1000,1500" >> .env | |
echo "VITE_MAP_STATISTICS=mean,cov,0.05,0.1,0.2,0.5,0.8,0.9,0.95" >> .env | |
echo "VITE_MAP_POES=0.02,0.025,0.05,0.1,0.18,0.22,0.39,0.40,0.63" >> .env | |
echo "VITE_MAP_COLOR_SCALE=jet,inferno,viridis,plasma,magma,cividis" >> .env | |
echo "VITE_MAP_ZOOM_MIN=2" >> .env | |
echo "VITE_MAP_ZOOM_MAX=12" >> .env | |
echo "VITE_MAP_ZOOM_SNAP=0.5" >> .env | |
echo "VITE_MAP_ZOOM_DELTA=0.5" >> .env | |
echo | |
echo "VITE_HAZARD_GMAX=5" >> .env | |
echo "VITE_HAZARD_GMIN=0" >> .env | |
echo "VITE_HAZARD_GMAX_LOG=5" >> .env | |
echo "VITE_HAZARD_GMIN_LOG=0.01" >> .env | |
echo "VITE_HAZARD_POEMAX=1" >> .env | |
echo "VITE_HAZARD_POEMIN=0.000001" >> .env | |
echo | |
echo "VITE_SA_PERIODMAX=10" >> .env | |
echo "VITE_SA_PERIODMIN=0" >> .env | |
echo "VITE_SA_PERIODMAX_LOG=10" >> .env | |
echo "VITE_SA_PERIODMIN_LOG=0.03" >> .env | |
echo "VITE_SA_GMAX=auto" >> .env | |
echo "VITE_SA_GMIN=0" >> .env | |
echo "VITE_SA_LOG_PGA_SUBSTITUTE=0.04" >> .env | |
echo | |
echo "VITE_MEAN=mean" >> .env | |
echo "VITE_UPPER1=0.9" >> .env | |
echo "VITE_UPPER2=0.95" >> .env | |
echo "VITE_LOWER1=0.1" >> .env | |
echo "VITE_LOWER2=0.05" >> .env | |
echo | |
echo "VITE_GA_ID=G-JRRN2P89FB" >> .env | |
echo "VITE_GA_DEBUG_MODE=true" >> .env | |
cat .env | |
echo "Now add the secrets.." | |
echo "VITE_GRAPHQL_API_KEY=${{secrets.VITE_GRAPHQL_API_KEY}}" >> .env | |
echo "Now add the vars.." | |
echo "VITE_DISCLAIMER_VERSION=${{vars.VITE_DISCLAIMER_VERSION}}" >> .env | |
echo "VITE_GRAPHQL_ENDPOINT=${{vars.VITE_GRAPHQL_ENDPOINT}}" >> .env | |
echo "VITE_RESOLUTION=${{vars.VITE_RESOLUTION}}" >> .env | |
echo "VITE_HAZARD_MODEL=${{vars.VITE_HAZARD_MODEL}}" >> .env | |
echo "VITE_GRID_ID=${{vars.VITE_GRID_ID}}" >> .env | |
echo "VITE_RADII_ID=${{vars.VITE_RADII_ID}}" >> .env | |
echo | |
yarn build | |
- name: Deploy to S3 | |
uses: GNS-Science/s3-sync-action@master | |
with: | |
args: --acl public-read --delete | |
env: | |
#The following are repository secrets | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
#The following are set up in AWS_TEST deployment environ | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
SOURCE_DIR: "dist" |