diff --git a/.github/.act-event.json b/.github/.act-event.json index 8925958..22e66fc 100644 --- a/.github/.act-event.json +++ b/.github/.act-event.json @@ -1,6 +1,6 @@ { - "act": true, - "repository": { - "default_branch": "main" - } + "act": true, + "repository": { + "default_branch": "main" + } } diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 6098f9f..37d88ba 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -3,8 +3,8 @@ name: Security audit on: push: paths: - - '**/Cargo.toml' - - '**/Cargo.lock' + - "**/Cargo.toml" + - "**/Cargo.lock" jobs: security_audit: runs-on: ubuntu-latest @@ -15,6 +15,6 @@ jobs: run: cargo generate-lockfile - name: Audit Check - - uses: rustsec/audit-check@v2.0.0 + uses: rustsec/audit-check@v2.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f21a932..ff2e282 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,14 +3,14 @@ name: CI on: push: - branches: [ "main" ] + branches: ["main"] paths: - "**.rs" # Any rust file - "**/Cargo.toml" # Any Cargo.toml - ".rustfmt.toml" - ".github/workflows/ci.yml" # This action pull_request: - branches: [ "main" ] + branches: ["main"] paths: - "**.rs" # Any rust file - "**/Cargo.toml" # Any Cargo.toml @@ -51,7 +51,7 @@ jobs: # If we were able to build then test different feature combinations compile with the library build_lib: runs-on: ubuntu-latest - needs: [ "build_first" ] + needs: ["build_first"] # Only run if library files were modified if: ${{ needs.build_first.outputs.lib == 'true' }} strategy: @@ -69,7 +69,7 @@ jobs: - build_type: "--no-default-features --features game_defs" build_name: "Just Game definitions" - build_type: "--no-default-features --features serde" - build_name: "Just serde" + build_name: "Just serde" name: "Build library ${{ matrix.build_name }}" steps: - uses: actions/checkout@v4 @@ -84,7 +84,7 @@ jobs: # If we were able to build then test different feature combinations compile with the CLI build_cli: runs-on: ubuntu-latest - needs: [ "build_first" ] + needs: ["build_first"] # Only run if CLI files were modified if: ${{ needs.build_first.outputs.cli == 'true' }} strategy: @@ -104,13 +104,13 @@ jobs: cache-targets: false save-if: false - name: Run Build - run: cargo check -p gamedig-cli --verbose --bins --examples --tests ${{ matrix.build_type }} + run: cargo check -p gamedig_cli --verbose --bins --examples --tests ${{ matrix.build_type }} # If we were able to build then test the MSRV compiles (for the libary as not enforced for CLI) build_msrv: name: "Build using MSRV (lib only)" runs-on: ubuntu-latest - needs: [ "build_first" ] + needs: ["build_first"] # Only run if library files were modified if: ${{ needs.build_first.outputs.lib == 'true' }} # Unfortunate hard-coding of rustup directory so that rust-cache caches it @@ -161,7 +161,7 @@ jobs: clippy: name: "Run clippy tests" runs-on: ubuntu-latest - needs: [ "build_first" ] + needs: ["build_first"] steps: - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 @@ -185,7 +185,7 @@ jobs: doc: name: "Check rustdoc" runs-on: ubuntu-latest - needs: [ "build_first" ] + needs: ["build_first"] steps: - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 0dda4ce..bb4c9fb 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,6 +1,6 @@ name: "Pull Request Labeler" on: -- pull_request_target + - pull_request_target jobs: triage: diff --git a/.github/workflows/node-badge.yml b/.github/workflows/node-badge.yml index ef984b4..724fec2 100644 --- a/.github/workflows/node-badge.yml +++ b/.github/workflows/node-badge.yml @@ -10,7 +10,7 @@ on: branches: - "main" # Limit badge commits to only happen on the main branch schedule: # This runs on the default branch only, it could still trigger on PRs but only if they develop on default branch and enable actions. - - cron: '34 3 * * 2' # Update once a week in case node-gamedig has changed + - cron: "34 3 * * 2" # Update once a week in case node-gamedig has changed workflow_dispatch: jobs: diff --git a/.github/workflows/scripts/node-badge.mjs b/.github/workflows/scripts/node-badge.mjs index 8114ae2..0e6aa46 100644 --- a/.github/workflows/scripts/node-badge.mjs +++ b/.github/workflows/scripts/node-badge.mjs @@ -9,10 +9,10 @@ import { closeSync, openSync, writeSync } from "node:fs"; import { spawnSync } from "node:child_process"; const setOutput = (key, value) => { - const file = openSync(process.env.GITHUB_OUTPUT, "a"); - writeSync(file, `${key}=${value}\n`); - closeSync(file); -} + const file = openSync(process.env.GITHUB_OUTPUT, "a"); + writeSync(file, `${key}=${value}\n`); + closeSync(file); +}; // Get node IDs // NOTE: Here we directly import from games to avoid loading @@ -25,28 +25,39 @@ const node_total = node_ids.size; // Get rust IDs -const command = spawnSync("cargo", ["run", "-p", "gamedig", "--example", "generic"]); +const command = spawnSync("cargo", [ + "run", + "-p", + "gamedig", + "--example", + "generic", +]); if (command.status !== 0) { - console.error(command.stderr.toString("utf8")); - process.exit(1); + console.error(command.stderr.toString("utf8")); + process.exit(1); } const rust_ids_pretty = command.stdout.toString("utf8"); -const rust_ids = new Set(rust_ids_pretty.split("\n").map(line => line.split("\t")[0]).filter(id => id.length > 0)); +const rust_ids = new Set( + rust_ids_pretty + .split("\n") + .map((line) => line.split("\t")[0]) + .filter((id) => id.length > 0) +); // Detect missing node IDs for (const id of rust_ids) { - if (node_ids.delete(id)) { - rust_ids.delete(id); - } + if (node_ids.delete(id)) { + rust_ids.delete(id); + } } console.log("Node remains", node_ids); console.log("Rust remains", rust_ids); -const percent = 1 - (node_ids.size / node_total); +const percent = 1 - node_ids.size / node_total; // Output percent to 2 decimal places -setOutput("percent", Math.round(percent*10000)/100); +setOutput("percent", Math.round(percent * 10000) / 100);