Skip to content

migrate to rr7

migrate to rr7 #1320

Workflow file for this run

name: 🏗️ Build
on:
push:
branches:
- main
- dev
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: write
contents: read
packages: write
jobs:
lint:
name: ⬣ ESLint
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./package.json
node-version: 20
- name: 📥 Install deps
run: npm install
- name: 🔬 Lint
run: npm run lint
typecheck:
name: ʦ TypeScript
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./package.json
node-version: 20
- name: 📥 Install deps
run: npm install
- name: 🔎 Type check
run: npm run typecheck --if-present
vitest:
name: ⚡ Vitest
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./package.json
node-version: 20
- name: 📥 Install deps
run: npm install
- name: ⚡ Run vitest
run: npm run test -- --coverage
playwright:
name: 🎭 Playwright
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: 🏄 Copy test env vars
run: cp .env.example .env
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./package.json
node-version: 20
- name: 📥 Install deps
run: npm install
- name: 🐳 Docker compose
# the sleep is just there to give time for postgres to get started
run: docker compose -f docker-compose.ci.yml up -d && sleep 60
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres"
- name: 🛠 Setup Database
uses: nick-fields/[email protected]
with:
timeout_minutes: 10
max_attempts: 5
retry_wait_seconds: 45
retry_on: error
command: npm run drizzle:migrate
- name: ⚙️ Build
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
build:
name: 🐳 Build
# only build/deploy main branch on pushes
# if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.9.1
# Setup cache
- name: ⚡️ Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: 📋 Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/opensensemap/frontend
- name: 🔑 GitHub Registry Auth
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🐳 Docker build
uses: docker/build-push-action@v6
with:
context: .
file: ./other/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMMIT_SHA=${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
# This ugly bit is necessary if you don't want your cache to grow forever
# till it hits GitHub's limit of 5GB.
# 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