Update vite #50
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: | |
- main | |
pull_request: | |
types: | |
- opened | |
# "synchronize" means new commits pushed to the HEAD of the pull request branch | |
- synchronize | |
env: | |
REGISTRY: ghcr.io | |
# What tags does: | |
# - always tag with sha | |
# - always tag with branch name | |
# - if a release tag is 'v1.0.0', then tag 'latest' and '1.0.0' | |
# More info: https://github.com/docker/metadata-action#tags-input | |
TAGS: | | |
type=sha | |
type=ref,event=branch | |
type=semver,pattern={{major}}.{{minor}}.{{patch}} | |
jobs: | |
cancel-previous: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.11.0 | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up NODE | |
uses: actions/setup-node@v3 | |
# Note: set up node early for caching elm-format | |
with: | |
node-version: 20.13 | |
cache: "npm" | |
cache-dependency-path: frontend/package-lock.json | |
- name: Backend Build and test | |
uses: freckle/stack-action@v4 | |
id: stack | |
with: | |
working-directory: backend | |
fast: false | |
# Temporarily disabled | |
pedantic: false | |
test: true | |
cache-prefix: lts-20.18 | |
stack-arguments: --copy-bins | |
- uses: freckle/weeder-action@v2 | |
with: | |
ghc-version: ${{ steps.stack.outputs.compiler-version }} | |
- uses: haskell/actions/hlint-setup@v2 | |
- uses: haskell/actions/hlint-run@v2 | |
- name: Install elm-format (for codegen) | |
run: npm install -g elm-format | |
- name: Codegen | |
run: ${{ steps.stack.outputs.local-bin-path }}/codegen | |
- name: Setup Elm | |
uses: jorelali/setup-elm@v5 | |
with: | |
elm-version: 0.19.1 | |
- name: Frontend Install dependencies | |
working-directory: frontend | |
run: npm ci | |
- name: Frontend Validate Formatting | |
working-directory: frontend | |
run: npm run format-validate | |
- name: Frontend Test | |
working-directory: frontend | |
run: npm test | |
- name: Frontend Review | |
working-directory: frontend | |
run: npm run review | |
- name: Frontend build | |
working-directory: frontend | |
run: npm run build | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Prepare tags and labels (backend) | |
id: meta-backend | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/VladimirLogachev/servant-to-elm-example-backend | |
tags: ${{ env.TAGS }} | |
- name: Build and push Docker image (backend) | |
uses: docker/build-push-action@v4 | |
with: | |
context: backend | |
file: backend/Dockerfile | |
build-contexts: bin_path_context=${{ steps.stack.outputs.local-bin-path }} | |
push: true | |
tags: ${{ steps.meta-backend.outputs.tags}} | |
labels: ${{ steps.meta-backend.outputs.labels}} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Prepare tags and labels (frontend) | |
id: meta-frontend | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/VladimirLogachev/servant-to-elm-example-frontend | |
tags: ${{ env.TAGS }} | |
- name: Build and push Docker image (frontend) | |
uses: docker/build-push-action@v4 | |
with: | |
context: frontend | |
file: frontend/Dockerfile | |
push: true | |
tags: ${{ steps.meta-frontend.outputs.tags }} | |
labels: ${{ steps.meta-frontend.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |