ref: Overhaul console integration #953
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
env: | |
BUILD_CACHE_KEY: ${{ github.event.inputs.commit || github.sha }} | |
CACHED_BUILD_PATHS: | | |
${{ github.workspace }}/packages/*/dist | |
${{ github.workspace }}/packages/*/bin | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
cache: 'pnpm' | |
- name: Setup dependencies | |
run: pnpm install | |
- name: Build packages | |
run: pnpm build | |
- name: Update build cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CACHED_BUILD_PATHS }} | |
key: ${{ env.BUILD_CACHE_KEY }} | |
test-docker: | |
name: Docker Test | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed-files-yaml | |
uses: tj-actions/changed-files@v41 | |
with: | |
files_yaml: | | |
docker: | |
- Dockerfile | |
- name: Configure Docker Context | |
if: ${{ inputs.force || steps.changed-files-yaml.outputs.docker_any_changed == 'true' }} | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker Image | |
if: ${{ inputs.force || steps.changed-files-yaml.outputs.docker_any_changed == 'true' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
cache-from: type=gha,scope=prod | |
cache-to: type=gha,mode=max,scope=prod | |
no-cache: ${{ inputs.nocache == 'true' }} | |
test-unit: | |
name: Unit Tests | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node_version: [18, 20, 22] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.version }} | |
cache: 'pnpm' | |
- name: Setup dependencies | |
run: pnpm install | |
- name: Restore build cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CACHED_BUILD_PATHS }} | |
key: ${{ env.BUILD_CACHE_KEY }} | |
- name: Run tests | |
run: pnpm test:ci | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v4 | |
if: success() || failure() | |
with: | |
report_paths: '**/junit.xml' | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
test-e2e: | |
name: E2E Tests | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
cache: 'pnpm' | |
- name: Setup dependencies | |
run: pnpm install | |
- name: Restore build cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CACHED_BUILD_PATHS }} | |
key: ${{ env.BUILD_CACHE_KEY }} | |
- name: Run tests | |
run: pnpm test:e2e:ci |