Skip to content

fix: Migrate fs to fsPromises in snapwp command (#44) #175

fix: Migrate fs to fsPromises in snapwp command (#44)

fix: Migrate fs to fsPromises in snapwp command (#44) #175

Workflow file for this run

name: CI - PR
on:
pull_request:
branches:
- main
- develop
paths-ignore:
- .github/workflows/pull_request_examples.yml
- examples/**
push:
branches:
- main
- develop
paths-ignore:
- .github/workflows/pull_request_examples.yml
- examples/**
# TODO: Remove and replace with real matrix.
workflow_dispatch:
inputs:
NODE_VERSIONS:
description: 'Node versions to test against. Need a JSON array of versions.'
required: true
default: '[20]'
type: string
jobs:
generate_schema:
uses: './.github/workflows/generate-schema.yml'
name: Generate WPGraphQL schema
with:
# TODO: Get from PR description.
ref: 'develop'
secrets: inherit
eslint:
name: ESLint
runs-on: ubuntu-latest
env:
GRAPHQL_SCHEMA_FILE: '${{ github.workspace }}/schema.graphql'
needs: generate_schema
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Get generated schema
uses: actions/download-artifact@v4
with:
name: schema
path: /tmp/schema
- name: Move schema to workspace
run: |
cp /tmp/schema/schema.graphql ${{ github.workspace }}/schema.graphql
- name: Install dependencies
run: |
npm ci --workspaces --include-workspace-root
ls -al node_modules
ls -al node_modules/@snapwp
npm run --if-present build
- name: Run ESLint
run: npm run --if-present lint
typecheck:
name: TS Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci --workspaces --include-workspace-root
- name: Run TypeScript type check
run: npm run --if-present typecheck
test-build:
name: Test Build (Node v${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ${{ fromJSON('[20]') }}
fail-fast: true
env:
GRAPHQL_SCHEMA_FILE: '${{ github.workspace }}/schema.graphql'
needs: generate_schema
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Get generated schema
uses: actions/download-artifact@v4
with:
name: schema
path: /tmp/schema
- name: Move schema to workspace
run: |
cp /tmp/schema/schema.graphql ${{ github.workspace }}/schema.graphql
- name: Install dependencies
run: npm ci --workspaces --include-workspace-root
- name: Build assets
run: npm run --if-present build
unit:
name: Unit Tests (Node v${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ${{ fromJSON('[20]') }}
fail-fast: true
env:
GRAPHQL_SCHEMA_FILE: '${{ github.workspace }}/schema.graphql'
needs: generate_schema
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Get generated schema
uses: actions/download-artifact@v4
with:
name: schema
path: /tmp/schema
- name: Move schema to workspace
run: |
cp /tmp/schema/schema.graphql ${{ github.workspace }}/schema.graphql
- name: Install dependencies
run: npm ci --workspaces --include-workspace-root
- name: Run unit tests
run: npm run --if-present test:unit
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage/*.json
# flags: unittests
# name: codecov-umbrella
# Reenable when we have playwright tests
# playwright:
# name: E2E Tests (Node v${{ matrix.node-version }})
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: ${{ fromJSON('[20]') }}
# fail-fast: true
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
# - name: Install dependencies
# run: npm ci --workspaces --include-workspace-root
# - name: Install and setup playwright
# run: |
# npm install playwright
# npx playwright install --with-deps
# - name: Run E2E tests
# run: npm run --if-present test:e2e
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: playwright-results
# path: playwright-report/
# retention-days: 3 # TODO: Figure this number out
security:
name: Dependencies Audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci --workspaces --include-workspace-root
- name: Run npm audit
run: |
npm audit --audit-level=high
prettier:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci --workspaces --include-workspace-root
- name: Run Prettier
run: npm run --if-present format:check