Skip to content

fix(ci):changed npm start to npx next start #38

fix(ci):changed npm start to npx next start

fix(ci):changed npm start to npx next start #38

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
NODE_VERSION: "20.x"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Check Prettier formatting
run: npm run format:check
type-check:
name: Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run TypeScript type check
run: npm run type-check
build:
name: Build
runs-on: ubuntu-latest
needs: [lint, type-check]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
env:
NEXT_TELEMETRY_DISABLED: 1
GD_SERVICE_B64: ${{ secrets.GD_SERVICE_B64 }}
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
SITE_PASSWORD: ${{ secrets.SITE_PASSWORD }}
NEXT_PUBLIC_DOMAIN: ${{ secrets.NEXT_PUBLIC_DOMAIN }}
- name: List .next directory
run: ls -la .next
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: .next/**
retention-days: 7
test:
name: Test
runs-on: ubuntu-latest
needs: [lint, type-check]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm ci
# Uncomment when tests are added
# - name: Run unit tests
# run: npm test
# - name: Run integration tests
# run: npm run test:integration
# - name: Upload coverage reports
# uses: codecov/codecov-action@v4
# with:
# file: ./coverage/coverage-final.json
# flags: unittests
# name: codecov-umbrella
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run npm audit
run: npm audit --audit-level=high
continue-on-error: true
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
lighthouse:
name: Lighthouse CI
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: .next
- name: Start application server
run: npx next start
- name: Wait for server to be ready
run: sleep 10
- name: Run Lighthouse CI
uses: treosh/lighthouse-ci-action@v12
with:
urls: |
http://localhost:3000
uploadArtifacts: true
temporaryPublicStorage: true
continue-on-error: true