Skip to content

Commit

Permalink
ci: build package set
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed Nov 26, 2024
1 parent dde8e2e commit e7f9411
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 11 deletions.
52 changes: 42 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,49 @@ name: CI

on:
push:
branches: [main]
branches: [ main ]
paths:
- '**.lock'
- '**.nix'
- 'flake.lock'
pull_request:
paths:
- '**.lock'
- '**.nix'
- 'flake.lock'
workflow_dispatch:

jobs:
test:
packages:
name: Build Packages

strategy:
fail-fast: false
matrix:
os: [ macos-latest, macos-13, ubuntu-latest ]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@V27

- name: Setup cache
uses: DeterminateSystems/magic-nix-cache-action@v8

- name: Run build
run: |
nix run .#build-outputs -- 'packages'
modules:
name: Test Modules
needs: packages

strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
os: [ macos-latest, ubuntu-latest ]

runs-on: ${{ matrix.os }}

Expand All @@ -35,8 +60,15 @@ jobs:

- name: Run tests
run: |
nix run \
--inputs-from . \
github:Mic92/nix-fast-build -- \
--no-nom \
--flake ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)"
nix run .#build-outputs -- 'modules'
release-gate:
name: Release Gate
needs: [ modules, packages ]

runs-on: ubuntu-latest

steps:
- name: Exit with error
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
result
result-*
repl-result-*

gcroot/
29 changes: 29 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,35 @@
in
{
apps = {
build-outputs = {
type = "app";
program = lib.getExe (
pkgs.writeShellApplication {
name = "build-outputs";

runtimeInputs = [ pkgs.nix-fast-build ];

text = ''
usage="Usage: $0 <flake_attribute>"
attribute="''${1:-}"
if [ -z "$attribute" ]; then
echo -n "$usage"
exit 1
fi
args=(
"--no-nom"
"--skip-cached"
"--flake" "${self.outPath}#$attribute.${system}"
)
nix-fast-build "''${args[@]}"
'';
}
);
};

serve = {
type = "app";
program = lib.getExe self.packages.${system}.site.serve;
Expand Down

0 comments on commit e7f9411

Please sign in to comment.