Skip to content

Add lint, format and type checks and basic tests. Update code style and fix CI. #851

Add lint, format and type checks and basic tests. Update code style and fix CI.

Add lint, format and type checks and basic tests. Update code style and fix CI. #851

Workflow file for this run

name: Build
on:
push:
branches: "main"
pull_request:
branches: "*"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Run build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install the npm dependencies
run: |
npm ci
- name: Run the build
run: |
npm run build
storybook-test:
name: Test Storybook Stories and Docs
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Dependencies
run: npm ci
- name: Build all packages
run: npm run build
- name: Install Playwright
run: npx playwright install chromium --with-deps
working-directory: storybook
- name: Build Storybook
run: npm run build:storybook
working-directory: storybook
- name: Serve Storybook and run all tests
run: |
npx serve -l 6006 storybook-static &
sleep 5
npm run test:all
working-directory: storybook
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: storybook-test-results
path: |
storybook/test-results/
storybook/html-report/
docker-dev:
# Don't run if the previous case fails
needs: build
name: Build on dev container
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ".devcontainer/Dockerfile"
target: "builder"
# For now never push
# push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}