Build the docker image to ensure image builds correctly, partially replacing local install + build (though still running tests + lint outside docker)
62 lines
1.8 KiB
YAML
62 lines
1.8 KiB
YAML
name: Frontend Build Check
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'frontend/src/**'
|
|
- 'frontend/*.json'
|
|
- 'frontend/*.js'
|
|
- 'frontend/*.ts'
|
|
- '.github/workflows/frontend-build-check.yaml'
|
|
jobs:
|
|
setup-and-build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
cache: 'yarn'
|
|
cache-dependency-path: frontend/yarn.lock
|
|
- name: Restore cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: frontend/dist
|
|
key: ${{ runner.os }}-btrix-frontend-build-${{ hashFiles('frontend/dist') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-btrix-frontend-build-
|
|
- name: Install dependencies
|
|
working-directory: frontend
|
|
env:
|
|
HUSKY: 0
|
|
run: yarn install --frozen-lockfile
|
|
- name: Lint
|
|
working-directory: frontend
|
|
run: yarn lint:check
|
|
- name: Format
|
|
working-directory: frontend
|
|
# TODO Reenable when https://github.com/webrecorder/browsertrix-cloud/issues/1618 is addressed
|
|
# run: yarn format:check
|
|
run: echo "yarn format:check disabled"
|
|
- name: Unit tests
|
|
working-directory: frontend
|
|
run: yarn test
|
|
- name: Localization build
|
|
working-directory: frontend
|
|
run: yarn localize:prepare
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
with:
|
|
driver-opts: network=host
|
|
|
|
- name: Build Frontend
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: frontend
|
|
load: true
|
|
tags: webrecorder/browsertrix-frontend:latest
|
|
cache-from: type=gha,scope=frontend
|
|
cache-to: type=gha,scope=frontend,mode=max
|