Skip to content

chore: integration test setup #235

chore: integration test setup

chore: integration test setup #235

Workflow file for this run

name: Node.js CI
on: pull_request
jobs:
setup:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Use dependencies cache
id: cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
lookup-only: true
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts --no-audit --no-fund
lint-code:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: setup
env:
DATOCMS_READONLY_API_TOKEN: ${{ secrets.DATOCMS_READONLY_API_TOKEN }}
DATOCMS_API_TOKEN: '' # required but unused in this workflow
HEAD_START_PREVIEW_SECRET: '' # required but unused in this workflow
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Use dependencies cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Prepare setup
run: npm run prep
# eslint is fast, run it first to fail fast
- name: Lint all code files
run: npm run lint:eslint -- --max-warnings 0
# astro check finds more errors, but is slower, so run it last
- name: Lint Astro files
run: npm run lint:astro -- --minimumSeverity warning
validate-html:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: setup
env:
DATOCMS_READONLY_API_TOKEN: ${{ secrets.DATOCMS_READONLY_API_TOKEN }}
DATOCMS_API_TOKEN: '' # required but unused in this workflow
HEAD_START_PREVIEW_SECRET: '' # required but unused in this workflow
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Use dependencies cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Create production build
run: npm run build
- name: Validate HTML
run: npm run lint:html
unit-test:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: setup
env:
DATOCMS_READONLY_API_TOKEN: ${{ secrets.DATOCMS_READONLY_API_TOKEN }}
DATOCMS_API_TOKEN: '' # required but unused in this workflow
HEAD_START_PREVIEW_SECRET: '' # required but unused in this workflow
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Use dependencies cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Prepare setup
run: npm run prep
- name: Run unit tests
run: npm run test:unit