refactor: upload laboratory artifacts to deduplicate building on CI #7277
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: Checks | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: | |
- main | |
permissions: | |
pull-requests: write | |
concurrency: | |
# Support push/pr as event types with different behaviors each: | |
# 1. push: queue up builds | |
# 2. pr: only allow one run per PR | |
group: ${{ github.workflow }}-${{ github.event.type }}${{ github.event.pull_request.number }} | |
# If there is already a workflow running for the same pull request, cancel it | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
build_laboratory: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build laboratory | |
run: pnpm build:laboratory | |
env: | |
NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }} | |
NEXTAUTH_SECRET: ${{ secrets.TESTS_NEXTAUTH_SECRET }} | |
MAILSAC_API_KEY: ${{ secrets.TESTS_MAILSAC_API_KEY }} | |
NEXT_PUBLIC_SECURE_SITE_SDK_URL: ${{ secrets.NEXT_PUBLIC_SECURE_SITE_SDK_URL }} | |
SOCIAL_TEST_EMAIL: ${{ secrets.TESTS_SOCIAL_EMAIL }} | |
SOCIAL_TEST_PASSWORD: ${{ secrets.TESTS_SOCIAL_PASSWORD }} | |
- name: Package laboratory | |
run: tar -czf laboratory.tar.gz -C apps/laboratory . | |
- name: Upload laboratory artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: laboratory-package | |
path: laboratory.tar.gz | |
retention-days: 1 | |
code_style: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
strategy: | |
matrix: | |
style-command: | |
- lint | |
- prettier | |
- typecheck | |
- build:sample-apps | |
- danger | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
- name: setup-node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: 'pnpm' | |
- name: install | |
run: pnpm install | |
- name: build | |
run: pnpm build | |
env: | |
NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }} | |
- name: check | |
run: pnpm ${{ matrix.style-command }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }} | |
test: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
- name: setup-node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: 'pnpm' | |
- name: install | |
run: pnpm install | |
- name: build | |
run: pnpm build | |
env: | |
NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }} | |
- name: Test | |
run: pnpm test | |
- name: Merge Coverage Reports | |
if: always() | |
run: pnpm coverage:merge | |
- name: Report | |
if: always() | |
uses: davelosert/vitest-coverage-report-action@v2 | |
with: | |
name: Coverage | |
json-final-path: ./coverage/coverage-merged-final.json | |
json-summary-path: ./coverage/coverage-merged-summary.json | |
ui-test: | |
needs: build_laboratory | |
if: github.event.pull_request.draft == false | |
uses: ./.github/workflows/ui_tests.yml | |
secrets: inherit | |
permissions: | |
contents: write | |
pull-requests: write | |
with: | |
branch: ${{ github.ref }} |