Refactor: Elegant-ify function def #114
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: build-and-test | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'liberica' | |
java-version: '17.0' | |
java-package: jdk+fx | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
- name: Git Init | |
run: git submodule update --init --recursive | |
- name: Build and Test | |
run: | | |
sbt -v update compile | |
sbt -v scalastyle coffeelint test | |
- uses: actions/cache@v3 | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build-and-test | |
if: ${{ github.ref == 'refs/heads/scrape-test' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/production' }} | |
environment: Deployments | |
env: | |
AWS_REGION: 'us-east-1' | |
AWS_ROLE_TO_ASSUME: 'arn:aws:iam::922513866616:role/Galapagos-AWS-Deploy' | |
steps: | |
- uses: actions/cache@v3 | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'liberica' | |
java-version: '17.0' | |
java-package: jdk+fx | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
- name: Configure AWS Credentials | |
id: creds | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ${{ env.AWS_REGION }} | |
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }} | |
role-session-name: 'GitHub-Actions-Galapagos-AWS-Deploy' | |
output-credentials: true | |
- name: Verify AWS Credentials | |
run: | | |
aws sts get-caller-identity | |
- name: Scrape | |
run: | | |
sbt scrapePlay | |
cp -Rv public/modelslib/ target/play-scrape/assets/ | |
cp -Rv public/nt-modelslib/ target/play-scrape/assets/ | |
- name: Upload | |
env: | |
CREDENTIALS_FROM_ENVIRONMENT: 'true' | |
BUILD_SERVER: 'true' | |
BUILD_BRANCH: ${{ github.ref_name }} | |
AWS_ACCESS_KEY_ID: ${{ steps.creds.outputs.aws-access-key-id }} | |
AWS_SECRET_KEY: ${{ steps.creds.outputs.aws-secret-access-key }} | |
AWS_SESSION_TOKEN: ${{ steps.creds.outputs.aws-session-token }} | |
run: | | |
sbt scrapeUpload |