Skip to content

Validate

Validate #17

Workflow file for this run

name: Validate
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
validation:
name: Validation (${{ matrix.os }}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [18, 24]
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: ${{ matrix.node }}
- name: Require PowerShell
shell: pwsh
run: $PSVersionTable.PSVersion.ToString()
- name: Test
run: npm test
- name: Validate package
run: npm run validate
- name: Check JavaScript syntax
run: node --check bin/install.mjs
- name: Check shell wrapper syntax
shell: bash
run: bash -n plugins/fable5-codex/scripts/fable5-codex.sh
- name: npm pack dry run
run: npm pack --dry-run
- name: Whitespace check
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
run: |
if [[ "$EVENT_NAME" == "pull_request" ]]; then
git diff --check "$PR_BASE_SHA"...HEAD
elif [[ "$EVENT_NAME" == "push" && ! "$PUSH_BEFORE_SHA" =~ ^0+$ ]]; then
git diff --check "$PUSH_BEFORE_SHA" HEAD
else
git show --check --format= HEAD
fi
artifact:
name: Packed artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Setup Node
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: 24
- name: Require PowerShell
shell: pwsh
run: $PSVersionTable.PSVersion.ToString()
- name: Validate installed tarball
run: npm run validate:artifact
release-gate:
name: Release gate
if: ${{ always() }}
needs: [validation, artifact]
runs-on: ubuntu-latest
steps:
- name: Require every validation job
shell: bash
run: |
if [[ "${{ needs.validation.result }}" != "success" || "${{ needs.artifact.result }}" != "success" ]]; then
exit 1
fi