mirror of
https://codeberg.org/icewind/vbsp-to-gltf.git
synced 2026-06-03 18:24:07 +02:00
ci builds
This commit is contained in:
parent
3811389fdf
commit
f6f4577095
5 changed files with 146 additions and 27 deletions
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
|
|
@ -42,14 +42,6 @@ jobs:
|
||||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
- run: nix build .#test
|
- run: nix build .#test
|
||||||
|
|
||||||
semver:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: check
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Check semver
|
|
||||||
uses: obi1kenobi/cargo-semver-checks-action@v2
|
|
||||||
|
|
||||||
msrv:
|
msrv:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check
|
needs: check
|
||||||
|
|
@ -62,3 +54,33 @@ jobs:
|
||||||
instance: https://cache.icewind.me
|
instance: https://cache.icewind.me
|
||||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
- run: nix build .#msrv
|
- run: nix build .#msrv
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- id: set-matrix
|
||||||
|
run: echo "matrix=$(nix eval --json ".#matrix.x86_64-linux")" | tee $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [check, matrix]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
|
with:
|
||||||
|
name: ci
|
||||||
|
instance: https://cache.icewind.me
|
||||||
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
|
- run: nix build .#${{ matrix.target }}
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: vbsp-to-gltf-${{ matrix.target }}
|
||||||
|
path: result/bin/vbsp-to-gltf${{ matrix.artifactSuffix }}
|
||||||
39
.github/workflows/release.yml
vendored
Normal file
39
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- id: set-matrix
|
||||||
|
run: echo "matrix=$(nix eval --json ".#releaseMatrix.x86_64-linux")" | tee $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: matrix
|
||||||
|
strategy:
|
||||||
|
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
|
with:
|
||||||
|
name: ci
|
||||||
|
instance: https://cache.icewind.me
|
||||||
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
|
- run: nix build .#${{ matrix.target }}
|
||||||
|
- name: Upload binary to release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: result/bin/vbsp-to-gltf${{ matrix.artifactSuffix }}
|
||||||
|
asset_name: vbsp-to-gltf-${{ matrix.target }}
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
|
@ -8,6 +8,10 @@ Convert Valve BSP files to GLTF files
|
||||||
vbsp-to-gltf input.bsp output.glb
|
vbsp-to-gltf input.bsp output.glb
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that this requires TF2 to be installed to get the texture and props referenced in the map.
|
||||||
|
|
||||||
|
It should be able to automatically detect the tf2 path or you can overwrite it by setting the `TF_DIR` environment variable.
|
||||||
|
|
||||||
## Model optimization
|
## Model optimization
|
||||||
|
|
||||||
The output for the converter isn't particularly optimized, it's strongly recommended to run the output through [gltfpack](https://github.com/zeux/meshoptimizer) before usage.
|
The output for the converter isn't particularly optimized, it's strongly recommended to run the output through [gltfpack](https://github.com/zeux/meshoptimizer) before usage.
|
||||||
|
|
|
||||||
24
flake.lock
generated
24
flake.lock
generated
|
|
@ -1,5 +1,28 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"cross-naersk": {
|
||||||
|
"inputs": {
|
||||||
|
"naersk": [
|
||||||
|
"naersk"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1689107909,
|
||||||
|
"narHash": "sha256-fb+zxf7AWesECHx1foXOM3NcKHLrdeXzGb6s2AhT6pE=",
|
||||||
|
"owner": "icewind1991",
|
||||||
|
"repo": "cross-naersk",
|
||||||
|
"rev": "51de54599de569e6faa2ee33dd659c5c028d9911",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "icewind1991",
|
||||||
|
"repo": "cross-naersk",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"naersk": {
|
"naersk": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|
@ -37,6 +60,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"cross-naersk": "cross-naersk",
|
||||||
"naersk": "naersk",
|
"naersk": "naersk",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay",
|
"rust-overlay": "rust-overlay",
|
||||||
|
|
|
||||||
36
flake.nix
36
flake.nix
|
|
@ -7,6 +7,9 @@
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
rust-overlay.inputs.flake-utils.follows = "utils";
|
rust-overlay.inputs.flake-utils.follows = "utils";
|
||||||
|
cross-naersk.url = "github:icewind1991/cross-naersk";
|
||||||
|
cross-naersk.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
cross-naersk.inputs.naersk.follows = "naersk";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
|
|
@ -15,6 +18,7 @@
|
||||||
utils,
|
utils,
|
||||||
naersk,
|
naersk,
|
||||||
rust-overlay,
|
rust-overlay,
|
||||||
|
cross-naersk,
|
||||||
}:
|
}:
|
||||||
utils.lib.eachDefaultSystem (system: let
|
utils.lib.eachDefaultSystem (system: let
|
||||||
overlays = [(import rust-overlay)];
|
overlays = [(import rust-overlay)];
|
||||||
|
|
@ -29,6 +33,14 @@
|
||||||
toolchain = rust-bin.stable.latest.default;
|
toolchain = rust-bin.stable.latest.default;
|
||||||
msrvToolchain = rust-bin.stable."${msrv}".default;
|
msrvToolchain = rust-bin.stable."${msrv}".default;
|
||||||
|
|
||||||
|
hostTarget = pkgs.hostPlatform.config;
|
||||||
|
targets = [
|
||||||
|
"x86_64-unknown-linux-musl"
|
||||||
|
"x86_64-pc-windows-gnu"
|
||||||
|
hostTarget
|
||||||
|
];
|
||||||
|
releaseTargets = lib.lists.remove hostTarget targets;
|
||||||
|
|
||||||
naersk' = callPackage naersk {
|
naersk' = callPackage naersk {
|
||||||
rustc = toolchain;
|
rustc = toolchain;
|
||||||
cargo = toolchain;
|
cargo = toolchain;
|
||||||
|
|
@ -37,14 +49,28 @@
|
||||||
rustc = msrvToolchain;
|
rustc = msrvToolchain;
|
||||||
cargo = msrvToolchain;
|
cargo = msrvToolchain;
|
||||||
};
|
};
|
||||||
|
cross-naersk' = pkgs.callPackage cross-naersk {inherit naersk;};
|
||||||
|
|
||||||
src = sourceByRegex ./. ["Cargo.*" "(src|derive|benches|tests|examples|koth_bagel.*)(/.*)?"];
|
buildMatrix = targets: {
|
||||||
|
include =
|
||||||
|
builtins.map (target: {
|
||||||
|
inherit target;
|
||||||
|
artifactSuffix = cross-naersk'.execSufficForTarget target;
|
||||||
|
})
|
||||||
|
targets;
|
||||||
|
};
|
||||||
|
|
||||||
|
src = sourceByRegex ./. ["Cargo.*" "(src|derive|benches|tests|examples.*)(/.*)?"];
|
||||||
nearskOpt = {
|
nearskOpt = {
|
||||||
pname = "vbsp";
|
pname = "vbsp-to-gltf";
|
||||||
root = src;
|
root = src;
|
||||||
};
|
};
|
||||||
in rec {
|
in rec {
|
||||||
packages = {
|
packages =
|
||||||
|
lib.attrsets.genAttrs targets (target:
|
||||||
|
(cross-naersk'.buildPackage target) nearskOpt)
|
||||||
|
// rec {
|
||||||
|
vbsp-to-gltf = packages.${hostTarget};
|
||||||
check = naersk'.buildPackage (nearskOpt
|
check = naersk'.buildPackage (nearskOpt
|
||||||
// {
|
// {
|
||||||
mode = "check";
|
mode = "check";
|
||||||
|
|
@ -62,8 +88,12 @@
|
||||||
// {
|
// {
|
||||||
mode = "check";
|
mode = "check";
|
||||||
});
|
});
|
||||||
|
default = vbsp-to-gltf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
matrix = buildMatrix targets;
|
||||||
|
releaseMatrix = buildMatrix releaseTargets;
|
||||||
|
|
||||||
devShells = let
|
devShells = let
|
||||||
tools = with pkgs; [
|
tools = with pkgs; [
|
||||||
bacon
|
bacon
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue