Skip to content

Commit

Permalink
Add linting and type checking to the CI/CD pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrRip committed Aug 11, 2024
1 parent 3ab3cf9 commit 6bc20e4
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 61 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/build-deploy-admin.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/build-deploy-home.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build & Deploy / [all]
run-name: Build & Deploy (${{ github.ref_name }}/[all])
name: Check & Build & Deploy / [all]
run-name: Check & Build & Deploy (${{ github.ref_name }}/[all])

on:
push:
Expand All @@ -12,8 +12,8 @@ on:
- '.eslintrc.js'

jobs:
build-deploy:
name: Build & Deploy / ${{ matrix.package }}
check-build-deploy:
name: Check & Build & Deploy / ${{ matrix.package }}
strategy:
fail-fast: false
matrix:
Expand All @@ -22,7 +22,7 @@ jobs:
package_cap: HOME
- package: admin
package_cap: ADMIN
uses: ./.github/workflows/build-deploy.yml
uses: ./.github/workflows/check-build-deploy.yml
with:
package: ${{ matrix.package }}
package_cap: ${{ matrix.package_cap }}
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/check-build-deploy-admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Check & Build & Deploy / admin
run-name: Check & Build & Deploy (${{ github.ref_name }}/admin)

on:
push:
paths:
- 'packages/admin/**'

jobs:
check-build-deploy-admin:
name: Check & Build & Deploy
uses: ./.github/workflows/check-build-deploy.yml
with:
package: admin
package_cap: ADMIN
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/check-build-deploy-home.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Check & Build & Deploy / home
run-name: Check & Build & Deploy (${{ github.ref_name }}/home)

on:
push:
paths:
- 'packages/home/**'

jobs:
check-build-deploy-home:
name: Check & Build & Deploy
uses: ./.github/workflows/check-build-deploy.yml
with:
package: home
package_cap: HOME
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ on:
PROD_ADMIN_PM2_CONF_ENV:

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm -F ${{ inputs.package }} install
- name: Run ESLint
run: 'pnpm run lint:${{ inputs.package }}'
- name: Check types
# vue-tsc always runs at the workspace root
run: pnpm run typecheck

build:
name: Build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -87,7 +112,7 @@ jobs:
deploy-prod:
name: Deploy to production
if: github.repository == 'ThrRip/mzg.fan' && github.ref == 'refs/heads/main'
needs: build
needs: [check, build]
concurrency: deploy-prod-${{ github.ref }}-${{ inputs.package }}
runs-on: ubuntu-latest
env:
Expand Down
14 changes: 2 additions & 12 deletions .idea/dictionaries/thrrip.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
"build": "pnpm -r exec nuxt build",
"preview": "pnpm -r exec nuxt preview",
"lint": "eslint",
"postinstall": "nuxt prepare && pnpm -r exec nuxt prepare",
"typecheck": "nuxt typecheck",
"dev:home": "pnpm -F home exec nuxt dev",
"build:home": "pnpm -F home exec nuxt build",
"preview:home": "pnpm -F home exec nuxt preview",
"lint:home": "pnpm -F home exec eslint",
"dev:admin": "pnpm -F admin exec nuxt dev",
"build:admin": "pnpm -F admin exec nuxt build",
"preview:admin": "pnpm -F admin exec nuxt preview"
"preview:admin": "pnpm -F admin exec nuxt preview",
"lint:admin": "pnpm -F admin exec eslint",
"postinstall": "nuxt prepare && pnpm -r exec nuxt prepare"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.6.0",
Expand All @@ -39,6 +42,7 @@
"eslint": "^9.9.0",
"postcss": "^8.4.41",
"tailwind-scrollbar": "^3.0.5",
"tailwindcss": "^3.4.9"
"tailwindcss": "^3.4.9",
"vue-tsc": "^2.0.29"
}
}
Loading

0 comments on commit 6bc20e4

Please sign in to comment.