Organize imports & fix lint issues #89
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: CI | |
'on': | |
push: | |
branches: | |
- master | |
jobs: | |
setup: | |
name: Setup Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Cache NPM dependencies | |
uses: actions/cache@v3 | |
id: cache-npm | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
env: | |
NODE_ENV: production | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Restore cache | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
- name: Build | |
run: npm run build | |
- name: Cache build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
packages/*/dist | |
apps/*/dist | |
key: '${{ runner.os }}-build-${{ github.sha }}' | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Restore cache | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
- name: Lint | |
run: npm run lint | |
test: | |
name: Unit Test API | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Set up Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Restore NPM cache | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
- name: Restore build cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
packages/*/dist | |
apps/*/dist | |
key: '${{ runner.os }}-build-${{ github.sha }}' | |
- name: Test | |
run: npm run test:cov --workspace=api | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
codeql: | |
name: Perform CodeQL Analysis | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: javascript | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
with: | |
category: '/language:javascript' |