diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4580d90d..9f28a970 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} @@ -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 -- 'checks' + + 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 diff --git a/.gitignore b/.gitignore index b272df7c..591b2ba3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ result result-* repl-result-* - +gcroot/ diff --git a/flake.nix b/flake.nix index 57ab41e0..749086db 100644 --- a/flake.nix +++ b/flake.nix @@ -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 " + + 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;