Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix: init flake + CI #750

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on: [push,pull_request]
jobs:
build-ubuntu:

runs-on: [ubuntu-22.04]
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Run project tests
run: |
Expand All @@ -24,7 +24,6 @@ jobs:
set -e
set -x
cd _unittests
ln -s .. cmake
CMAKE_BIN="cmake"
$CMAKE_BIN --version
$CMAKE_BIN -P test_pkg-config.cmake
25 changes: 25 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "CI - Nix"

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
tests:
name: "Nix build on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}-latest"
strategy:
matrix:
os: [ubuntu, macos]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: cachix/cachix-action@v15
with:
name: gepetto
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build -L
19 changes: 19 additions & 0 deletions .github/workflows/update-flake-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: update-flake-lock

on:
workflow_dispatch:
schedule:
- cron: '0 19 3 * *'

jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@main
with:
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
1 change: 1 addition & 0 deletions _unittests/cmake
58 changes: 58 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
description = "CMake utility toolbox";

inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};

outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = inputs.nixpkgs.lib.systems.flakeExposed;
perSystem =
{ pkgs, self', ... }:
{
packages = {
default = self'.packages.jrl-cmakemodules;
jrl-cmakemodules = pkgs.jrl-cmakemodules.overrideAttrs (super: {
src = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.gitTracked ./.;
};

# TODO: remove all this once it is in nixpkgs
postPatch = ''
patchShebangs _unittests/run_unit_tests.sh
'';

outputs = [ "out" "doc" ];
nativeBuildInputs = super.nativeBuildInputs ++ [
pkgs.sphinxHook
];
sphinxRoot = "../.docs";

doCheck = true;
checkInputs = [
pkgs.python3
];
checkPhase = ''
runHook preCheck

pushd ../_unittests
./run_unit_tests.sh
cmake -P test_pkg-config.cmake

rm -rf build install
popd

runHook postCheck
'';
});
};
};
};
}