mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +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,
|
"act": true,
|
||||||
"repository": {
|
"repository": {
|
||||||
"default_branch": "main"
|
"default_branch": "main"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
.github/workflows/audit.yml
vendored
6
.github/workflows/audit.yml
vendored
|
|
@ -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 }}
|
||||||
|
|
|
||||||
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
|
|
@ -3,14 +3,14 @@ name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: ["main"]
|
||||||
paths:
|
paths:
|
||||||
- "**.rs" # Any rust file
|
- "**.rs" # Any rust file
|
||||||
- "**/Cargo.toml" # Any Cargo.toml
|
- "**/Cargo.toml" # Any Cargo.toml
|
||||||
- ".rustfmt.toml"
|
- ".rustfmt.toml"
|
||||||
- ".github/workflows/ci.yml" # This action
|
- ".github/workflows/ci.yml" # This action
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: ["main"]
|
||||||
paths:
|
paths:
|
||||||
- "**.rs" # Any rust file
|
- "**.rs" # Any rust file
|
||||||
- "**/Cargo.toml" # Any Cargo.toml
|
- "**/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
|
# If we were able to build then test different feature combinations compile with the library
|
||||||
build_lib:
|
build_lib:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ "build_first" ]
|
needs: ["build_first"]
|
||||||
# Only run if library files were modified
|
# Only run if library files were modified
|
||||||
if: ${{ needs.build_first.outputs.lib == 'true' }}
|
if: ${{ needs.build_first.outputs.lib == 'true' }}
|
||||||
strategy:
|
strategy:
|
||||||
|
|
@ -84,7 +84,7 @@ jobs:
|
||||||
# If we were able to build then test different feature combinations compile with the CLI
|
# If we were able to build then test different feature combinations compile with the CLI
|
||||||
build_cli:
|
build_cli:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ "build_first" ]
|
needs: ["build_first"]
|
||||||
# Only run if CLI files were modified
|
# Only run if CLI files were modified
|
||||||
if: ${{ needs.build_first.outputs.cli == 'true' }}
|
if: ${{ needs.build_first.outputs.cli == 'true' }}
|
||||||
strategy:
|
strategy:
|
||||||
|
|
@ -104,13 +104,13 @@ 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:
|
||||||
name: "Build using MSRV (lib only)"
|
name: "Build using MSRV (lib only)"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ "build_first" ]
|
needs: ["build_first"]
|
||||||
# Only run if library files were modified
|
# Only run if library files were modified
|
||||||
if: ${{ needs.build_first.outputs.lib == 'true' }}
|
if: ${{ needs.build_first.outputs.lib == 'true' }}
|
||||||
# Unfortunate hard-coding of rustup directory so that rust-cache caches it
|
# Unfortunate hard-coding of rustup directory so that rust-cache caches it
|
||||||
|
|
@ -161,7 +161,7 @@ jobs:
|
||||||
clippy:
|
clippy:
|
||||||
name: "Run clippy tests"
|
name: "Run clippy tests"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ "build_first" ]
|
needs: ["build_first"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
@ -185,7 +185,7 @@ jobs:
|
||||||
doc:
|
doc:
|
||||||
name: "Check rustdoc"
|
name: "Check rustdoc"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ "build_first" ]
|
needs: ["build_first"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Swatinem/rust-cache@v2
|
- 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"
|
name: "Pull Request Labeler"
|
||||||
on:
|
on:
|
||||||
- pull_request_target
|
- pull_request_target
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
triage:
|
triage:
|
||||||
|
|
|
||||||
2
.github/workflows/node-badge.yml
vendored
2
.github/workflows/node-badge.yml
vendored
|
|
@ -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:
|
||||||
|
|
|
||||||
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";
|
import { spawnSync } from "node:child_process";
|
||||||
|
|
||||||
const setOutput = (key, value) => {
|
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,28 +25,39 @@ 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"));
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
for (const id of rust_ids) {
|
for (const id of rust_ids) {
|
||||||
if (node_ids.delete(id)) {
|
if (node_ids.delete(id)) {
|
||||||
rust_ids.delete(id);
|
rust_ids.delete(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue