Skip to content

Tests

Tests #5

Workflow file for this run

# This workflow will do an install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Tests
on:
workflow_run:
workflows: [Update Sets]
types: [completed]
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [24.x]
steps:
- uses: actions/checkout@v4
- name: Enable corepack
run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# this fork is pnpm-only (see packageManager + engines). there's no workspace wiring calc/
# into the root install, and typescript is a devDependency of the calc subpackage -- so we
# install both, with --ignore-scripts to skip lifecycle hooks that don't apply in CI (the
# root postinstall & calc's prepare/bundle, the latter a babel pass unrelated to the calc).
- run: pnpm install --ignore-scripts
- run: pnpm --dir calc install --ignore-scripts
# compiling the patched calc is the meaningful smoke test that the fork is intact. we don't
# run `pnpm test` -- upstream's jest suite asserts vanilla @smogon/calc behavior that the
# Showdex damage mods deliberately diverge from, so it can't pass on this fork.
- name: Compile calc
run: pnpm --dir calc exec tsc --build --force .
env:
CI: true
publish:
if: ${{ github.repository == 'smogon/damage-calc' && (github.event_name == 'push' || github.event.workflow_run.conclusion == 'success') }}
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- run: npm install
- name: Build
run: node build
- name: Upload artifact for GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'dist'
- uses: actions/configure-pages@v5
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5