Skip to content

Commit

Permalink
WIP: test nix on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhantk232 committed Feb 3, 2024
1 parent ca77c55 commit 2645f38
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 2 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/test-ci-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Test nix on

on:
push:
branches: [ feat/nix ]
jobs:
release-ubuntu:
name: Build for Linux
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v9
- name: build linux-musl
run: nix build -L .#fastn
- name: test the output binary
run: |
ldd result/bin/fastn
./result/bin/fastn --version
# - name: Build-musl
# run: |
# echo "Building static binaries using ekidd/rust-musl-builder"
# docker build -t fastn-build-image -f .github/Dockerfile .
# docker run --name fastn-build fastn-build-image
# mkdir -p out
# docker cp fastn-build:/home/rust/src/target/x86_64-unknown-linux-musl/release/fastn out/
# - name: run fastn
# run: out/fastn --version
# - uses: actions/upload-artifact@v4
# with:
# name: linux_musl_x86_64
# path: out/fastn
release-windows:
name: Build for win 64
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v9
- name: build mingwW64
run: nix build -L .#fastn-win
- name: test the output binary
# wine?
# run: ldd result/bin/fastn.exe
# run: ./result/bin/fastn.exe --version
run: |
ls result/bin/
file result/bin/fastn.exe
ldd result/bin/fastn.exe
release-macos:
name: Build for MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v9
- name: build mac
run: nix build -L .#fastn
- name: test the output binary on mac
run: |
ldd result/bin/fastn
./result/bin/fastn --version
# - name: run fastn
# run: ./target/release/fastn --version
# - uses: actions/upload-artifact@v4
# with:
# name: macos_x64_latest
# path: |
# target/release/fastn
9 changes: 7 additions & 2 deletions fastn.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{ rustPlatform, stdenv, pkg-config, lib, windows, openssl }:
let
fastnCargo = builtins.fromTOML (builtins.readFile ./fastn/Cargo.toml);
version = fastnCargo.package.version;
in
rustPlatform.buildRustPackage {
name = "fastn";
version = "0.4.47";
inherit version;
src = lib.cleanSource ./.;
doCheck = false;

doCheck = false; # set this to true to run cargo test

nativeBuildInputs = [ pkg-config ];

Expand Down
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
inputs = {
flake-utils.url = "github:numtide/flake-utils";

# TODO: use nixpkgs/unstable when this is merged:
# https://github.com/NixOS/nixpkgs/pull/282798
nixpkgs.url = "github:junjihashimoto/nixpkgs/feature/rust-dup";
};

Expand Down

0 comments on commit 2645f38

Please sign in to comment.