109 lines
3.4 KiB
YAML
109 lines
3.4 KiB
YAML
name: Dev CI
|
|
|
|
on:
|
|
push:
|
|
branches: [dev]
|
|
pull_request:
|
|
branches: [dev]
|
|
|
|
env:
|
|
NODE_VERSION: '22'
|
|
|
|
jobs:
|
|
security:
|
|
name: Security gate
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: ./.gitea/actions/security
|
|
|
|
backend-quality:
|
|
name: Backend — Lint
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: apps/backend
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- run: npm ci --legacy-peer-deps
|
|
- run: npm run lint -- --no-fix
|
|
|
|
frontend-quality:
|
|
name: Frontend — Lint & Type-check
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: apps/frontend
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- run: npm ci --legacy-peer-deps
|
|
- run: npm run lint
|
|
- run: npm run type-check
|
|
|
|
backend-tests:
|
|
name: Backend — Unit Tests
|
|
runs-on: ubuntu-latest
|
|
needs: backend-quality
|
|
defaults:
|
|
run:
|
|
working-directory: apps/backend
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- run: npm ci --legacy-peer-deps
|
|
- run: npm test -- --ci --runInBand
|
|
|
|
frontend-tests:
|
|
name: Frontend — Unit Tests
|
|
runs-on: ubuntu-latest
|
|
needs: frontend-quality
|
|
defaults:
|
|
run:
|
|
working-directory: apps/frontend
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- run: npm ci --legacy-peer-deps
|
|
- run: npm test -- --ci --runInBand
|
|
|
|
notify-failure:
|
|
name: Notify Failure
|
|
runs-on: ubuntu-latest
|
|
needs: [security, backend-quality, frontend-quality, backend-tests, frontend-tests]
|
|
if: failure()
|
|
steps:
|
|
- name: Discord
|
|
run: |
|
|
curl -s -H "Content-Type: application/json" -d '{
|
|
"embeds": [{
|
|
"title": "❌ Dev CI Failed",
|
|
"color": 15158332,
|
|
"fields": [
|
|
{"name": "Branch", "value": "`${{ github.ref_name }}`", "inline": true},
|
|
{"name": "Author", "value": "${{ github.actor }}", "inline": true},
|
|
{"name": "Workflow", "value": "[${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})", "inline": false}
|
|
],
|
|
"footer": {"text": "Xpeditis CI • Dev"}
|
|
}]
|
|
}' ${{ secrets.DISCORD_WEBHOOK_URL }}
|