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

Various CI improvements #38

Merged
merged 4 commits into from
Mar 15, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/ci-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ jobs:
name: ${{ env.artifact }}
path: result/bin/caligula

- name: e2e test
- name: Run checks
if: inputs.do_e2e_tests
run: nix run ${{ env.nix_target }} -- --help
run: nix flake check --keep-going

e2e-test-fresh:
name: e2e test on fresh ${{ inputs.e2e_test_runner }}
Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: "CI"

on:
push:
pull_request:

jobs:
lint:
Expand All @@ -18,10 +17,10 @@ jobs:
extra-platforms = ${{ inputs.target_triple }}

- name: Prefetch lint script dependencies
run: nix build .#scripts.lint
run: nix build .#lint-script

- name: Run lint script
run: nix run .#scripts.lint
run: nix run .#lint-script

ci-x86_64-linux:
uses: ./.github/workflows/ci-unix.yml
Expand Down Expand Up @@ -69,3 +68,27 @@ jobs:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Build dev shell
run: nix build .#devShells.${{ matrix.platform }}.default --show-trace --log-lines 10000 --fallback

make-release-group:
runs-on: ubuntu-latest
needs:
- ci-aarch64-linux
- ci-x86_64-darwin
- ci-x86_64-linux
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3

- name: Assemble release directory
run: |
mkdir release
for i in caligula-*; do
cp "$i/caligula" "release/$i"
done

tree

- uses: actions/upload-artifact@v3
with:
name: release
path: release
3 changes: 3 additions & 0 deletions checks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Integration tests

This directory contains integration tests and other checks (Nix-based). Unit tests are embedded in `/src`.
10 changes: 10 additions & 0 deletions checks/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ self, nixpkgs, ... }:
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in {
smoke-test-simple = pkgs.callPackage ./smoke-test-simple { };
}
7 changes: 7 additions & 0 deletions checks/smoke-test-simple/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ lib, caligula, runCommand }:
runCommand "caligula-smoke-test-simple" {
buildInputs = [ caligula ];
meta.timeout = 10;
} ''
caligula -h > $out
''
11 changes: 8 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
outputs = { self, nixpkgs, flake-utils, naersk, rust-overlay }@inputs:
{
lib = import ./nix inputs;
overlays.default = final: prev: {
caligula = self.packages.${prev.system}.caligula;
};
} //

(let
Expand All @@ -25,15 +28,17 @@

crossHelpers = self.lib.crossHelpers system;
in {
checks = import ./checks inputs system;

packages = {
default = self.packages."${system}".caligula;
scripts = {
lint = let path = lib.makeBinPath [ crossHelpers.baseToolchain ];

lint-script =
let path = lib.makeBinPath [ crossHelpers.baseToolchain ];
in pkgs.writeScriptBin "lint" ''
export PATH=${path}
${./scripts/lint.sh}
'';
};

caligula = self.packages."${system}"."caligula-${system}";
} // crossHelpers.caligulaPackages;
Expand Down