Update tapir-core, tapir-json-circe to 1.11.9 (#594) #1512
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 | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
types: [ opened, synchronize ] | |
workflow_dispatch: | |
# automatically cancel previous runs on the same PR | |
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre/67939898#67939898 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# https://github.com/actions/checkout/issues/626 | |
# This is correct, because we're using a merge queue (mergify) which only merges when built against the latest target branch. | |
# https://docs.mergify.com/actions/queue/ | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: coursier/cache-action@v6 | |
- uses: olafurpg/setup-scala@v14 | |
with: | |
java-version: [email protected] | |
# https://github.com/actions/cache/blob/master/examples.md#node---yarn | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache yarn | |
uses: actions/cache@v4 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Cache Scalablytyped transpilations | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.ivy2/local/org.scalablytyped | |
~/.cache/scalablytyped | |
key: ${{ runner.os }}-scalablytyped-${{ hashfiles('build.sbt') }}-${{ hashFiles('*/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-scalablytyped- | |
- name: load envrc | |
uses: HatsuneMiku3939/direnv-action@v1 | |
- name: Compile and Bundle | |
run: | | |
# Runner has 7G of RAM, so 4G for sbt is ok here: | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
ENABLE_FATAL_WARNINGS=true sbt --mem 4096 \ | |
compile Test/compile \ | |
test \ | |
scalafmtCheck scalafmtSbtCheck \ | |
{webapp,lambda}/fastOptJS/webpack | |
- uses: hashicorp/setup-terraform@v3 | |
- name: Validate Terraform | |
run: | | |
cd terraform | |
cat <<EOF > terraform.tf | |
provider "aws" { | |
region = "eu-central-1" | |
} | |
provider "aws" { | |
alias = "us-east-1" | |
region = "us-east-1" | |
} | |
EOF | |
terraform init | |
terraform validate | |
rm -r .terraform.lock.hcl terraform.tf | |
- name: Yarn install | |
run: yarn install --frozen-lockfile | |
- name: Prepare End-to-End Tests | |
run: | | |
# Start frontend dev-webserver | |
( | |
cd webapp/target/scala-2.13/scalajs-bundler/main | |
node node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.config.dev.js --port $FRONTEND_PORT || kill 0 | |
) & | |
# Start the lambda backend | |
(npx fun-local-env \ | |
--auth $AUTH_PORT \ | |
--ws $WS_PORT \ | |
--http $HTTP_PORT \ | |
--http-api lambda/target/scala-2.13/scalajs-bundler/main/lambda-fastopt.js httpApi \ | |
--http-rpc lambda/target/scala-2.13/scalajs-bundler/main/lambda-fastopt.js httpRpc \ | |
--ws-rpc lambda/target/scala-2.13/scalajs-bundler/main/lambda-fastopt.js wsRpc \ | |
--ws-event-authorizer lambda/target/scala-2.13/scalajs-bundler/main/lambda-fastopt.js wsEventAuth \ | |
> /tmp/local-env-logs 2>&1 || kill 0) & | |
# Test http api | |
until nc -z 127.0.0.1 $HTTP_PORT &>/dev/null; do sleep 0.5; done | |
[ "$(curl -v localhost:$HTTP_PORT/books/drama/2011?limit=10)" == '[{"title":"Programming in Scala"}]' ] | |
# Wait until the dev server is running | |
npx wait-on http://localhost:$FRONTEND_PORT | |
- name: Cypress run (UI tests) | |
uses: cypress-io/[email protected] | |
- name: On E2E test failure, print logs | |
if: failure() | |
run: if [[ -f /tmp/local-env-logs ]]; then cat /tmp/local-env-logs; fi | |
- name: Production build | |
run: | | |
# Runner has 7G of RAM, so 4G for sbt is ok here: | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
ENABLE_FATAL_WARNINGS=true sbt --mem 4096 \ | |
prod | |
- name: Check if working directory is clean | |
run: git diff --quiet --exit-code || (git status && false) | |
# - name: Debug over SSH (tmate) | |
# # if: ${{ failure() }} | |
# uses: mxschmitt/action-tmate@v3 | |
# with: | |
# limit-access-to-actor: true |