mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 07:17:27 +00:00
chore(ci): format
This commit is contained in:
parent
102e48914b
commit
7985fb2613
6 changed files with 42 additions and 31 deletions
8
.github/.act-event.json
vendored
8
.github/.act-event.json
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"act": true,
|
||||
"repository": {
|
||||
"default_branch": "main"
|
||||
}
|
||||
"act": true,
|
||||
"repository": {
|
||||
"default_branch": "main"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
6
.github/workflows/audit.yml
vendored
6
.github/workflows/audit.yml
vendored
|
|
@ -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 }}
|
||||
|
|
|
|||
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
2
.github/workflows/labeler.yml
vendored
2
.github/workflows/labeler.yml
vendored
|
|
@ -1,6 +1,6 @@
|
|||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request_target
|
||||
- pull_request_target
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
|
|
|
|||
2
.github/workflows/node-badge.yml
vendored
2
.github/workflows/node-badge.yml
vendored
|
|
@ -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:
|
||||
|
|
|
|||
37
.github/workflows/scripts/node-badge.mjs
vendored
37
.github/workflows/scripts/node-badge.mjs
vendored
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue