Files
ArtPlayer/.github/workflows/nodejs.yml
T

169 lines
6.5 KiB
YAML

name: Node CI
on:
pull_request:
push:
branches: [master, 'codex/**']
workflow_dispatch:
workflow_call:
inputs:
pages-artifact:
description: Prepare the checked docs directory for the separate Pages workflow
type: boolean
default: false
permissions:
contents: read
concurrency:
group: checks-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
jobs:
coverage:
name: TS coverage (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
defaults:
run:
shell: bash
env:
CI: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
package-manager-cache: false
- name: Install the pinned toolchain and dependencies
run: |
npm install --global --force yarn@1.22.22
yarn install --frozen-lockfile --non-interactive
yarn check:toolchain --strict
- name: Verify source maps and critical lifecycle coverage
run: yarn test:coverage
- name: Upload coverage and source-map evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-${{ matrix.os }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
refactor/.cache/coverage/latest.json
refactor/.cache/coverage/run-*/
include-hidden-files: true
retention-days: 14
if-no-files-found: warn
browser-smoke:
name: Browser playback smoke
runs-on: macos-latest
timeout-minutes: 30
env:
CI: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
package-manager-cache: false
- name: Install the pinned package manager and dependencies
run: |
npm install --global --force yarn@1.22.22
yarn install --frozen-lockfile --non-interactive
- name: Install test browsers
run: yarn test:browser:install
- name: Build and check installed tarballs
run: |
yarn test:package
node --input-type=module -e 'import fs from "node:fs"; const { output } = JSON.parse(fs.readFileSync("refactor/.cache/packages/latest.json")); fs.appendFileSync(process.env.GITHUB_ENV, `ARTPLAYER_BROWSER_ARTIFACTS=${output}/browser-artifacts.json\n`);'
- name: Run all three engines
run: yarn test:browser
- name: Verify iframe cached history and interrupted navigation
run: yarn test:iframe-history
- name: Compare installed performance and verify resource cleanup
run: yarn test:performance
- name: Upload browser evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: browser-${{ github.run_id }}-${{ github.run_attempt }}
path: |
refactor/.cache/browser/
refactor/.cache/iframe-history/
refactor/.cache/performance/
refactor/.cache/packages/latest.json
refactor/.cache/packages/run-*/*.json
refactor/.cache/packages/run-*/*.log
refactor/.cache/packages/run-*/*.tgz
refactor/.cache/packages/run-*/artifacts/
include-hidden-files: true
retention-days: 14
if-no-files-found: warn
checks:
name: Checks and build
runs-on: ubuntu-latest
timeout-minutes: 30
env:
CI: true
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
package-manager-cache: false
- name: Install the pinned package manager
run: npm install --global --force yarn@1.22.22
- name: Validate workflow syntax
run: |
curl --fail --silent --show-error --location https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz --output "$RUNNER_TEMP/actionlint.tar.gz"
printf '%s %s\n' '8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8' "$RUNNER_TEMP/actionlint.tar.gz" | sha256sum --check
tar -xzf "$RUNNER_TEMP/actionlint.tar.gz" -C "$RUNNER_TEMP" actionlint
"$RUNNER_TEMP/actionlint" -color
- name: Frozen install
run: |
mkdir -p refactor/.cache/ci
yarn install --frozen-lockfile --non-interactive 2>&1 | tee refactor/.cache/ci/install.log
- name: Read-only checks and tests
run: yarn ci:check 2>&1 | tee refactor/.cache/ci/check.log
- name: Build libraries and documentation
run: yarn ci:build 2>&1 | tee refactor/.cache/ci/build.log
- name: Record source and tool versions
if: always()
run: |
mkdir -p refactor/.cache/ci
git rev-parse HEAD > refactor/.cache/ci/source.txt
node --version > refactor/.cache/ci/node.txt
yarn --version > refactor/.cache/ci/yarn.txt
sha256sum yarn.lock > refactor/.cache/ci/lock.sha256
git diff --stat > refactor/.cache/ci/generated-diff.txt
- name: Upload available logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: checks-${{ github.run_id }}-${{ github.run_attempt }}
path: refactor/.cache/ci/
include-hidden-files: true
retention-days: 14
if-no-files-found: warn
- name: Prepare Pages artifact
if: inputs.pages-artifact && github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: docs
include-hidden-files: true