fix lint-test-build workflow

This commit is contained in:
Amruth Pillai
2024-05-07 12:31:01 +02:00
parent 52e062c0b5
commit e2e2551db4
3 changed files with 47 additions and 32 deletions

View File

@ -50,6 +50,9 @@ STORAGE_USE_SSL=false
# SERVER_SENTRY_DSN=
# VITE_CLIENT_SENTRY_DSN=
# Nx Cloud (Optional)
# NX_CLOUD_ACCESS_TOKEN=
# Crowdin (Optional)
# CROWDIN_PROJECT_ID=
# CROWDIN_PERSONAL_TOKEN=

View File

@ -1,4 +1,8 @@
name: Lint, Test and Build
name: Lint, Test & Build
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
on:
workflow_dispatch:
@ -9,35 +13,42 @@ on:
branches:
- main
permissions:
actions: read
contents: read
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
NX_BRANCH: "${{ github.event.number || github.ref_name }}"
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
jobs:
main:
name: Nx Cloud - Main Job
uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.14.0
with:
main-branch-name: main
number-of-agents: 1
init-commands: |
pnpm exec prisma generate
pnpm exec nx-cloud start-ci-run --stop-agents-after="build" --agent-count=1
parallel-commands-on-agents: |
pnpm exec nx-cloud record -- pnpm exec nx affected --target=lint
pnpm exec nx-cloud record -- pnpm exec nx affected --target=test
pnpm exec nx-cloud record -- pnpm exec nx affected --target=build
runs-on: ubuntu-latest
agents:
name: Nx Cloud - Agents
uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.14.0
with:
number-of-agents: 1
steps:
- name: Checkout Repository
uses: actions/checkout@v4.1.1
with:
fetch-depth: 2
- name: Setup pnpm
uses: pnpm/action-setup@v3.0.0
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
cache: "pnpm"
node-version: 20
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Format
run: pnpm format:check
- name: Test
run: pnpm test
- name: Build
run: pnpm build
env:
NODE_ENV: production
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

View File

@ -20,8 +20,9 @@
"build": "nx run-many -t build",
"prestart": "pnpm prisma:migrate",
"start": "node dist/apps/server/main",
"lint": "nx run-many -t lint --fix",
"format": "pnpm exec prettier -w .",
"lint": "nx run-many -t lint",
"format:check": "pnpm exec prettier -c --log-level error .",
"format:write": "pnpm exec prettier -w --log-level error .",
"crowdin:sync": "crowdin push && crowdin pull",
"prisma:generate": "pnpm exec prisma generate",
"prisma:migrate": "pnpm exec prisma migrate deploy",