fix(lint): narrow down targeted files for lint #522
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
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, reopened, synchronize] | |
name: CI | |
jobs: | |
cache-npm: | |
name: Cache NPM libraries | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Restore NPM cache | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-i | |
- name: Install locked dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Cache NPM | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-i | |
lint: | |
name: ESLint | |
runs-on: ubuntu-latest | |
needs: cache-npm | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Restore NPM cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-i | |
- name: Install locked dependencies | |
run: npm ci | |
- name: Build CSS assets from Tailwind CSS | |
run: npm run build:css | |
- name: Lint files | |
run: npm run lint | |
env: | |
CI: true | |
type-check: | |
name: Type check | |
runs-on: ubuntu-latest | |
needs: cache-npm | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Restore NPM cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-i | |
- name: Install locked dependencies | |
run: npm ci | |
- name: Type check | |
run: npm run type-check | |
env: | |
CI: true | |
unit-test: | |
name: Unit and integration test | |
if: github.repository == 'zainfathoni/kelas.rumahberbagi.com' | |
runs-on: ubuntu-latest | |
needs: cache-npm | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Restore NPM cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-i | |
- name: Install locked dependencies | |
run: npm ci | |
- name: Run unit and integration tests | |
run: npm t | |
env: | |
CI: true | |
- name: Upload code coverage reports to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
test: | |
name: End-to-end test | |
if: github.repository == 'zainfathoni/kelas.rumahberbagi.com' | |
runs-on: ubuntu-latest | |
needs: cache-npm | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Restore NPM cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: | |
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ | |
hashFiles('**/playwright.config.ts') }} | |
restore-keys: | | |
${{ runner.os }}-node-i | |
- name: Install locked dependencies | |
run: npm ci | |
- name: Install operating system dependencies | |
run: npx playwright install-deps | |
- name: Restore cached Playwright dependencies | |
id: cache-playwright | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/ms-playwright | |
key: | |
${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') | |
}}-${{ hashFiles('**/playwright.config.ts') }} | |
restore-keys: | | |
${{ runner.os }}-playwright-i | |
- name: Install Playwright browsers | |
if: steps.cache-playwright.outputs.cache-hit != 'true' | |
run: npx playwright install | |
- name: Cache Playwright dependencies | |
if: steps.cache-playwright.outputs.cache-hit != 'true' | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/ms-playwright | |
key: | |
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ | |
hashFiles('**/playwright.config.ts') }} | |
restore-keys: | | |
${{ runner.os }}-playwright-i | |
- name: Run end-to-end tests | |
run: npm run test:e2e:run | |
env: | |
CI: true | |
SESSION_SECRET: ${{ secrets.SESSION_SECRET }} | |
MAGIC_LINK_SECRET: ${{ secrets.MAGIC_LINK_SECRET }} | |
MAILGUN_SENDING_KEY: nothing # Unnecessary for testing | |
MAILGUN_DOMAIN: nothing # Unnecessary for testing |