mirror of
https://codeberg.org/spire/dispenser.git
synced 2026-06-03 10:04:07 +02:00
nix ci
This commit is contained in:
parent
3f26d17187
commit
11513bde8c
4 changed files with 112 additions and 74 deletions
26
.github/workflows/release.yml
vendored
26
.github/workflows/release.yml
vendored
|
|
@ -8,28 +8,20 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
release-binaries:
|
release-binaries:
|
||||||
name: Build release binaries
|
name: Build release binaries
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: musl-tools
|
- uses: actions/checkout@v3
|
||||||
run: |
|
- uses: cachix/install-nix-action@v20
|
||||||
sudo apt-get install musl-tools
|
- uses: icewind1991/attic-action@v1
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
name: ci
|
||||||
toolchain: stable
|
instance: https://cache.icewind.me
|
||||||
override: true
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
target: x86_64-unknown-linux-musl
|
- run: nix build .#x86_64-unknown-linux-musl
|
||||||
- uses: Swatinem/rust-cache@v1
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: build
|
|
||||||
args: --release --target x86_64-unknown-linux-musl
|
|
||||||
- name: Upload binary to release
|
- name: Upload binary to release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: target/x86_64-unknown-linux-musl/release/dispenser
|
file: result/bin/dispenser
|
||||||
asset_name: dispenser
|
asset_name: dispenser
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
|
|
|
||||||
53
.github/workflows/rust.yml
vendored
53
.github/workflows/rust.yml
vendored
|
|
@ -7,38 +7,35 @@ jobs:
|
||||||
name: Check
|
name: Check
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
name: ci
|
||||||
toolchain: stable
|
instance: https://cache.icewind.me
|
||||||
override: true
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
- uses: Swatinem/rust-cache@v1
|
- uses: lriesebos/nix-develop-command@6f5f4830884d1957767e920c51d6118c9b0ac828
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
with:
|
||||||
command: check
|
command: "cargo check"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
runs-on: ubuntu-latest
|
||||||
runs-on: ubuntu-20.04
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- x86_64-unknown-linux-gnu
|
||||||
|
- x86_64-unknown-linux-musl
|
||||||
steps:
|
steps:
|
||||||
- name: musl-tools
|
- uses: actions/checkout@v3
|
||||||
run: |
|
- uses: cachix/install-nix-action@v20
|
||||||
sudo apt-get install musl-tools
|
- uses: icewind1991/attic-action@v1
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
name: ci
|
||||||
toolchain: stable
|
instance: https://cache.icewind.me
|
||||||
override: true
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
target: x86_64-unknown-linux-musl
|
- run: nix build .#${{ matrix.target }}
|
||||||
- uses: Swatinem/rust-cache@v1
|
- uses: actions/upload-artifact@v3
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
with:
|
||||||
command: build
|
name: palantir-${{ matrix.target }}
|
||||||
args: --release --target x86_64-unknown-linux-musl
|
path: result/bin/*
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: dispenser
|
|
||||||
path: target/x86_64-unknown-linux-musl/release/dispenser
|
|
||||||
|
|
|
||||||
81
flake.lock
generated
81
flake.lock
generated
|
|
@ -2,14 +2,16 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"naersk": {
|
"naersk": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1671096816,
|
"lastModified": 1679567394,
|
||||||
"narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=",
|
"narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "naersk",
|
"repo": "naersk",
|
||||||
"rev": "d998160d6a076cfe8f9741e56aeec7e267e3e114",
|
"rev": "88cd22380154a2c36799fe8098888f0f59861a15",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -20,24 +22,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1674407282,
|
"lastModified": 1685302412,
|
||||||
"narHash": "sha256-2qwc8mrPINSFdWffPK+ji6nQ9aGnnZyHSItVcYDZDlk=",
|
"narHash": "sha256-W3sb5igzAgg9WxYFGyosdxPGiwm06JQQClt0BoaYoRU=",
|
||||||
"path": "/nix/store/47v7isgz6w8zgb1224d46lwvwkdd69bm-source",
|
|
||||||
"rev": "ab1254087f4cdf4af74b552d7fc95175d9bdbb49",
|
|
||||||
"type": "path"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "nixpkgs",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1674902473,
|
|
||||||
"narHash": "sha256-MdKJeeDTjCtmoVPWLEDg10jgknt6rqTO3c1WeNQtho4=",
|
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "548896f4d9f7db2f7205d82727d6c03c86d2f896",
|
"rev": "d5c0c34d8377ee85c197d65b2dd3322d57d90c71",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -49,17 +38,59 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"naersk": "naersk",
|
"naersk": "naersk",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay",
|
||||||
"utils": "utils"
|
"utils": "utils"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"utils": {
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": [
|
||||||
|
"utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1667395993,
|
"lastModified": 1685240871,
|
||||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
"narHash": "sha256-bOCbP0lWTjhmrPcdyuFD/yx/38CKkzC2TNXmBzZSLJA=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "aa1b08de9ca770534ad750dccc70cebd95c15e26",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681202837,
|
||||||
|
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
28
flake.nix
28
flake.nix
|
|
@ -2,7 +2,11 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
utils.url = "github:numtide/flake-utils";
|
utils.url = "github:numtide/flake-utils";
|
||||||
naersk.url = "github:nix-community/naersk";
|
naersk.url = "github:nix-community/naersk";
|
||||||
|
naersk.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
nixpkgs.url = "nixpkgs/release-22.11";
|
nixpkgs.url = "nixpkgs/release-22.11";
|
||||||
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
|
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
rust-overlay.inputs.flake-utils.follows = "utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
|
|
@ -10,24 +14,38 @@
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
utils,
|
utils,
|
||||||
naersk,
|
naersk,
|
||||||
|
rust-overlay,
|
||||||
}:
|
}:
|
||||||
utils.lib.eachDefaultSystem (system: let
|
utils.lib.eachDefaultSystem (system: let
|
||||||
|
overlays = [ (import rust-overlay) ];
|
||||||
pkgs = (import nixpkgs) {
|
pkgs = (import nixpkgs) {
|
||||||
inherit system;
|
inherit system overlays;
|
||||||
|
};
|
||||||
|
hostTarget = pkgs.hostPlatform.config;
|
||||||
|
targets = ["x86_64-unknown-linux-musl" hostTarget];
|
||||||
|
naerskForTarget = target: let
|
||||||
|
toolchain = pkgs.rust-bin.stable.latest.default.override { targets = [target]; };
|
||||||
|
in pkgs.callPackage naersk {
|
||||||
|
cargo = toolchain;
|
||||||
|
rustc = toolchain;
|
||||||
};
|
};
|
||||||
naersk' = pkgs.callPackage naersk {};
|
|
||||||
in rec {
|
in rec {
|
||||||
# `nix build`
|
packages = (nixpkgs.lib.attrsets.genAttrs targets (target: (naerskForTarget target).buildPackage {
|
||||||
packages.dispenser = naersk'.buildPackage {
|
|
||||||
pname = "dispenser";
|
pname = "dispenser";
|
||||||
root = ./.;
|
root = ./.;
|
||||||
|
})) // {
|
||||||
|
dispenser = (naerskForTarget hostTarget).buildPackage {
|
||||||
|
pname = "dispenser";
|
||||||
|
root = ./.;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
defaultPackage = packages.dispenser;
|
defaultPackage = packages.dispenser;
|
||||||
|
|
||||||
# `nix develop`
|
# `nix develop`
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
nativeBuildInputs = with pkgs; [rustc cargo bacon];
|
nativeBuildInputs = with pkgs; [pkgs.rust-bin.stable.latest.default bacon];
|
||||||
};
|
};
|
||||||
|
devShells.default = devShell;
|
||||||
})
|
})
|
||||||
// {
|
// {
|
||||||
nixosModule = {
|
nixosModule = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue