chore(ci): format

This commit is contained in:
Cain 2024-11-26 12:38:32 +00:00
parent 102e48914b
commit 7985fb2613
6 changed files with 42 additions and 31 deletions

View file

@ -3,8 +3,8 @@ name: Security audit
on: on:
push: push:
paths: paths:
- '**/Cargo.toml' - "**/Cargo.toml"
- '**/Cargo.lock' - "**/Cargo.lock"
jobs: jobs:
security_audit: security_audit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -15,6 +15,6 @@ jobs:
run: cargo generate-lockfile run: cargo generate-lockfile
- name: Audit Check - name: Audit Check
- uses: rustsec/audit-check@v2.0.0 uses: rustsec/audit-check@v2.0.0
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View file

@ -104,7 +104,7 @@ jobs:
cache-targets: false cache-targets: false
save-if: false save-if: false
- name: Run Build - 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) # If we were able to build then test the MSRV compiles (for the libary as not enforced for CLI)
build_msrv: build_msrv:

View file

@ -10,7 +10,7 @@ on:
branches: branches:
- "main" # Limit badge commits to only happen on the main branch - "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. 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: workflow_dispatch:
jobs: jobs:

View file

@ -12,7 +12,7 @@ const setOutput = (key, value) => {
const file = openSync(process.env.GITHUB_OUTPUT, "a"); const file = openSync(process.env.GITHUB_OUTPUT, "a");
writeSync(file, `${key}=${value}\n`); writeSync(file, `${key}=${value}\n`);
closeSync(file); closeSync(file);
} };
// Get node IDs // Get node IDs
// NOTE: Here we directly import from games to avoid loading // NOTE: Here we directly import from games to avoid loading
@ -25,7 +25,13 @@ const node_total = node_ids.size;
// Get rust IDs // 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) { if (command.status !== 0) {
console.error(command.stderr.toString("utf8")); console.error(command.stderr.toString("utf8"));
@ -33,7 +39,12 @@ if (command.status !== 0) {
} }
const rust_ids_pretty = command.stdout.toString("utf8"); 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 // Detect missing node IDs
@ -46,7 +57,7 @@ for (const id of rust_ids) {
console.log("Node remains", node_ids); console.log("Node remains", node_ids);
console.log("Rust remains", rust_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 // Output percent to 2 decimal places
setOutput("percent", Math.round(percent * 10000) / 100); setOutput("percent", Math.round(percent * 10000) / 100);