Skip to content

Improve web app pull request workflow #9

Improve web app pull request workflow

Improve web app pull request workflow #9

name: Web App Pull Request
on:
pull_request:
paths: [".github/workflows/web-app-pull-request.yml", ".eslintrc.js", "jest.config.ts", "pnpm-lock.yaml", "web-app.Dockerfile", "web-app/**"]
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Lint
run: pnpm lint
- name: Tests
run: pnpm test:web
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-web-app-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-web-app-
- name: Build Docker image
uses: docker/build-push-action@v5
with:
file: ./web-app.Dockerfile
context: .
push: false
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache