diff --git a/.github/REUSE.toml b/.github/REUSE.toml index 81fe35d2396..9f6ace7bc53 100644 --- a/.github/REUSE.toml +++ b/.github/REUSE.toml @@ -9,6 +9,7 @@ version = 1 [[annotations]] path = [ "workflows/**/*.yml", + "actions/**/*.yml", "ISSUE_TEMPLATE/**/*.yml", "FUNDING.yml", "CODEOWNERS", diff --git a/.github/actions/setup-deps/action.yml b/.github/actions/setup-deps/action.yml new file mode 100644 index 00000000000..50f48ec2205 --- /dev/null +++ b/.github/actions/setup-deps/action.yml @@ -0,0 +1,17 @@ +name: "Setup pnpm and Node.js" +description: "Setup pnpm and Node.js environment for workflows. Requires the repo to be cloned to at least have .nvmrc and package.json" +runs: + using: "composite" + steps: + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version-file: ".nvmrc" + cache: "pnpm" + + - name: Install dependencies + run: pnpm i + shell: bash diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index fea857355a0..5b1b776e760 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -45,7 +45,7 @@ jobs: private-key: ${{ secrets.PAGEFAULT_APP_PRIVATE_KEY }} - name: Check out code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: submodules: "recursive" # Always base off of beta branch, regardless of the branch the workflow was triggered from. diff --git a/.github/workflows/deploy-beta.yml b/.github/workflows/deploy-beta.yml index 85ec8119eaa..36e9afd45cf 100644 --- a/.github/workflows/deploy-beta.yml +++ b/.github/workflows/deploy-beta.yml @@ -15,20 +15,12 @@ jobs: timeout-minutes: 10 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: submodules: "recursive" ref: ${{ vars.BETA_DEPLOY_BRANCH || 'beta'}} - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Install dependencies - run: pnpm i + - uses: ./.github/actions/setup-deps - name: Build run: pnpm build:beta diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1f2c1259dd1..a218e2f8e7a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,19 +14,11 @@ jobs: timeout-minutes: 10 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: submodules: 'recursive' - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - - name: Install dependencies - run: pnpm i + - uses: ./.github/actions/setup-deps - name: Build run: pnpm build diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index 0e9f6bba0cd..9f84e675fb3 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -29,7 +29,7 @@ jobs: steps: - name: Checkout repository for Typedoc - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: pokerogue_docs @@ -42,7 +42,7 @@ jobs: rm -rf assets - name: Checkout asset submodule - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: 'pagefaultgames/pokerogue-assets' ref: ${{ steps.asset-submodule-ref.asset_ref }} @@ -59,13 +59,13 @@ jobs: version: 10 - name: Setup Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version-file: "pokerogue_docs/.nvmrc" - name: Checkout repository for Github Pages if: github.event_name == 'push' - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: pokerogue_gh ref: gh-pages diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 9f896a11f2a..cdbf5070043 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -25,21 +25,12 @@ jobs: steps: - name: Check out Git repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: submodules: "recursive" - - name: Install pnpm - uses: pnpm/action-setup@v4 - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - cache: "pnpm" - - - name: Install Node modules - run: pnpm i + - uses: ./.github/actions/setup-deps # Lint files with Biome-Lint - https://biomejs.dev/linter/ - name: Lint with Biome @@ -64,13 +55,6 @@ jobs: id: typecheck-scripts if: ${{ !cancelled() }} - # NOTE: These steps *must* be ran last for the moment due to deleting files in `assets/`. - # Some asset files do not yet have full licensing information, and thus must be removed - # before checking for REUSE compliance - - name: Prepare for REUSE compliance - run: rm -rf assets/* LICENSES/LicenseRef-* - if: ${{ !cancelled() }} - - name: Check for REUSE compliance id: reuse-lint uses: fsfe/reuse-action@v5 diff --git a/.github/workflows/test-shard-template.yml b/.github/workflows/test-shard-template.yml index a69e92ae147..1c98521e5e5 100644 --- a/.github/workflows/test-shard-template.yml +++ b/.github/workflows/test-shard-template.yml @@ -18,22 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out Git repository - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v6 with: submodules: "recursive" - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - cache: "pnpm" - - - name: Install Node.js dependencies - run: pnpm i - + - uses: ./.github/actions/setup-deps + - name: Run tests run: > pnpm test:silent diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a94d3c5a504..c4d3a655e5f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: all: ${{ steps.filter.outputs.all }} steps: - name: Checkout GitHub repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: sparse-checkout: | .github/test-filters.yml @@ -60,28 +60,22 @@ jobs: if: ${{ needs.run-tests.result != 'skipped' && needs.run-tests.result != 'cancelled' }} steps: - name: Check out Git repository - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v6 with: - submodules: "recursive" + sparse-checkout: | + .github/actions/setup-deps/action.yml + test/setup + test/test-utils/reporters/custom-default-reporter.ts - - name: Install pnpm - uses: pnpm/action-setup@v4 - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - cache: "pnpm" - - - name: Install Packages - run: pnpm i + - uses: ./.github/actions/setup-deps - name: Download blob artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v6 with: pattern: shard-?-blob path: test-results merge-multiple: true - name: Merge blobs - run: pnpm test:silent --merge-reports=test-results + run: pnpm test:merge-reports diff --git a/package.json b/package.json index ab72d9f0538..b0fada52c2b 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "test:cov": "vitest run --coverage --no-isolate", "test:watch": "vitest watch --coverage --no-isolate", "test:silent": "vitest run --silent='passed-only' --no-isolate", + "test:merge-reports": "MERGE_REPORTS=1 vitest run --merge-reports=test-results --silent=passed-only --configLoader runner", "test:create": "node scripts/create-test/create-test.js", "eggMoves:parse": "node scripts/parse-egg-moves/main.js", "scrape-trainers": "node scripts/scrape-trainer-names/main.js", diff --git a/vite.config.ts b/vite.config.ts index 569c3786b79..51dce9b5054 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,11 +6,15 @@ import { defineConfig, loadEnv, type Rollup, type UserConfig } from "vite"; import tsconfigPaths from "vite-tsconfig-paths"; -import { LocaleNamespace } from "./src/plugins/vite/namespaces-i18n-plugin"; -import { minifyJsonPlugin } from "./src/plugins/vite/vite-minify-json-plugin"; export const defaultConfig: UserConfig = { - plugins: [tsconfigPaths(), minifyJsonPlugin(["images", "battle-anims"], true), LocaleNamespace()], + plugins: process.env.MERGE_REPORTS + ? [] + : [ + tsconfigPaths(), + require("./src/plugins/vite/vite-minify-json-plugin").minifyJsonPlugin(["images", "battle-anims"], true), + require("./src/plugins/vite/namespaces-i18n-plugin").LocaleNamespace(), + ], clearScreen: false, appType: "mpa", build: { @@ -41,7 +45,7 @@ export default defineConfig(({ mode, command }) => { keepNames: true, }, server: { - port: !Number.isNaN(envPort) ? envPort : 8000, + port: Number.isNaN(envPort) ? 8000 : envPort, }, }; });