mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-25 01:51:37 -04:00
DRY the actions
This commit is contained in:
26
.github/actions/setup/action.yml
vendored
Normal file
26
.github/actions/setup/action.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Setup
|
||||
description: Checkout, cache and install dependencies
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: node-modules-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: yarn install --frozen-lockfile
|
||||
shell: bash
|
||||
|
||||
- name: Post-install
|
||||
run: yarn postinstall
|
||||
shell: bash
|
||||
50
.github/workflows/ci-e2e.yml
vendored
50
.github/workflows/ci-e2e.yml
vendored
@@ -13,8 +13,8 @@ jobs:
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/setup
|
||||
|
||||
- name: Cache Firebase emulators
|
||||
uses: actions/cache@v4
|
||||
@@ -23,71 +23,25 @@ jobs:
|
||||
key: firebase-emulators-${{ hashFiles('firebase.json') }}
|
||||
restore-keys: firebase-emulators-
|
||||
|
||||
# - name: Cache Docker layers
|
||||
# uses: ScribeMD/docker-cache@0.5.0
|
||||
# with:
|
||||
# key: docker-${{ runner.os }}-${{ hashFiles('supabase/config.toml') }}
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: node-modules-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ hashFiles('package.json') }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install Java (for Firebase emulators)
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21' # Required for firebase-tools@15+
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
env:
|
||||
HUSKY: 0
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install chromium --with-deps
|
||||
|
||||
# Docker load from cache is actually slower than pulling the images every time with supabase start
|
||||
# - name: Cache Supabase Docker images
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: /tmp/supabase-docker
|
||||
# key: supabase-docker-${{ hashFiles('supabase/config.toml') }}
|
||||
#
|
||||
# - name: Load cached Docker images
|
||||
# run: |
|
||||
# if [ -d /tmp/supabase-docker ]; then
|
||||
# for tar in /tmp/supabase-docker/*.tar; do
|
||||
# [ -f "$tar" ] && docker load -i "$tar"
|
||||
# done
|
||||
# fi
|
||||
|
||||
- name: Start Supabase
|
||||
run: ./scripts/supabase_start.sh
|
||||
|
||||
# - name: Save Supabase Docker images
|
||||
# run: |
|
||||
# mkdir -p /tmp/supabase-docker
|
||||
# docker images --format '{{.Repository}}:{{.Tag}}' \
|
||||
# | grep -E 'supabase|postgrest|gotrue|realtime|storage' \
|
||||
# | grep -v '<none>' \
|
||||
# | xargs -I{} sh -c \
|
||||
# 'docker save {} -o /tmp/supabase-docker/$(echo {} | tr "/:" "--").tar'
|
||||
|
||||
- name: Run E2E tests
|
||||
env:
|
||||
SKIP_DB_CLEANUP: true # Don't try to stop Docker in CI
|
||||
|
||||
56
.github/workflows/ci.yml
vendored
56
.github/workflows/ci.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Jest Tests
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -7,59 +7,39 @@ on:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: Jest Tests
|
||||
lint:
|
||||
name: Lint & Typecheck
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
timeout-minutes: 5
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: node-modules-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
# In case yarn install (and thus post-install) is skipped
|
||||
- name: Post-install
|
||||
run: yarn postinstall
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/setup
|
||||
|
||||
- name: Lint
|
||||
run: yarn lint
|
||||
|
||||
- name: Type check
|
||||
- name: Typecheck
|
||||
run: yarn typecheck
|
||||
|
||||
test:
|
||||
name: Jest Tests
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/setup
|
||||
|
||||
- name: Run Jest tests
|
||||
env:
|
||||
NEXT_PUBLIC_FIREBASE_ENV: DEV
|
||||
run: |
|
||||
yarn test:coverage
|
||||
# npm install -g lcov-result-merger
|
||||
# mkdir coverage
|
||||
# lcov-result-merger \
|
||||
# "backend/api/coverage/lcov.info" \
|
||||
# "backend/shared/coverage/lcov.info" \
|
||||
# "backend/email/coverage/lcov.info" \
|
||||
# "common/coverage/lcov.info" \
|
||||
# "web/coverage/lcov.info" \
|
||||
# > coverage/lcov.info
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
if: success()
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: |
|
||||
@@ -71,5 +51,3 @@ jobs:
|
||||
flags: unit
|
||||
fail_ci_if_error: true
|
||||
slug: CompassConnections/Compass
|
||||
env:
|
||||
CI: true
|
||||
|
||||
Reference in New Issue
Block a user