Skip to content

Commit

Permalink
ci: build hbmame in separate job when using qemu
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhys-T committed Nov 4, 2024
1 parent 4224537 commit e603f6d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@ jobs:
"nixos-24.05",
empty] as $nixpkgss |
[
"base",
"hbmame",
empty] as $subsets |
{include: [
$runners[] as $runner |
$nixpkgss[] as $nixpkgs |
($runner | split("/")) as [$displayRunner, $runner] |
select(($runner | startswith("ubuntu")) or ($nixpkgs | startswith("nixpkgs"))) |
($runner | split("+qemu-")) as [$runner, $qemuSystem] |
{$displayRunner, $runner, $qemuSystem, $nixpkgs, $nurRepo, $cachixName}
(if $qemuSystem then $subsets[] else "all" end) as $subset |
{$displayRunner, $runner, $qemuSystem, $nixpkgs, $subset, $nurRepo, $cachixName}
]} |
@json "matrix=\(.)"
Expand All @@ -55,7 +61,7 @@ jobs:
needs: define-matrix
strategy:
matrix: ${{ fromJson(needs.define-matrix.outputs.matrix) }}
name: ${{ matrix.displayRunner }} - ${{ matrix.nixpkgs }}
name: ${{ matrix.displayRunner }} - ${{ matrix.nixpkgs }} - ${{ matrix.subset }}
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout repository
Expand Down Expand Up @@ -92,7 +98,7 @@ jobs:
-I $PWD
- name: Build nix packages
# run: nix shell -f '<nixpkgs>' nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs
run: nix shell -f '.' nix-build-uncached-logging -c nix-build-uncached ci.nix --keep-going ${{ matrix.qemuSystem && format('--argstr platform {0}', matrix.qemuSystem)}} -A cacheOutputs
run: nix shell -f '.' nix-build-uncached-logging -c nix-build-uncached ci.nix --keep-going ${{ matrix.qemuSystem && format('--argstr platform {0}', matrix.qemuSystem)}} --argstr subsetName ${{ matrix.subset }} -A cacheOutputs
# - name: Upload debug info
# if: '!cancelled()'
# uses: actions/upload-artifact@v4
Expand Down
10 changes: 9 additions & 1 deletion ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

{
platform ? null,
subsetName ? "all",
pkgs ? import <nixpkgs> (if platform != null then {
localSystem = platform;
packageOverrides = pkgs: {
Expand All @@ -23,6 +24,12 @@
with builtins;
let
inherit (pkgs) lib;
subsets = {
all = p: true;
base = p: !(lib.any ({name, value}: name != "all" && name != "base" && value p) (lib.attrsToList subsets));
hbmame = p: lib.hasInfix "hbmame" (p.name or "");
};
subset = subsets.${subsetName};
isReserved = n: n == "lib" || n == "overlays" || n == "modules";
isDerivation = p: isAttrs p && p ? type && p.type == "derivation";
isBuildable = p: let
Expand Down Expand Up @@ -67,7 +74,8 @@ let
in
rec {
buildPkgs = filter isBuildable nurPkgs;
cachePkgs = filter isCacheable buildPkgs;
cachePkgs' = filter isCacheable buildPkgs;
cachePkgs = filter subset buildPkgs;

buildOutputs = concatMap outputsOf buildPkgs;
cacheOutputs = concatMap outputsOf cachePkgs;
Expand Down

0 comments on commit e603f6d

Please sign in to comment.