Skip to content

Update stack resolver to lts-22.20 #56

Update stack resolver to lts-22.20

Update stack resolver to lts-22.20 #56

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
types:
- opened
# "synchronize" means new commits pushed to the HEAD of the pull request branch
- synchronize
permissions:
packages: write
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@v5
id: stack
with:
working-directory: backend
test: true
cache-prefix: lts-22.20
stack-build-arguments: --pedantic --copy-bins --local-bin-path target
- 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
working-directory: backend
run: ./target/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 }}/haskell-to-elm/servant-to-elm-example-backend
tags: ${{ env.TAGS }}
- name: Build and push Docker image (backend)
uses: docker/build-push-action@v4
with:
context: backend/target
file: backend/Dockerfile
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 }}/haskell-to-elm/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