Skip to content

Commit 7c5d80c

Browse files
committed
build packages in parallel
1 parent 3c22e61 commit 7c5d80c

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

.github/workflows/nix.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,34 @@ on:
77
pull_request:
88

99
jobs:
10-
build-server:
11-
name: Build with Nix
10+
decision:
11+
name: Decide what we need to build
1212
runs-on: ubuntu-latest
13+
14+
outputs:
15+
packages: ${{ steps.packages.outputs.packages }}
16+
17+
steps:
18+
- name: Packages
19+
id: packages
20+
run: |
21+
packages=$(nix eval .#packages.x86_64-linux --apply builtins.attrNames --json)
22+
echo "PACKAGES -> $packages"
23+
echo "::set-output name=packages::$packages"
24+
25+
build:
26+
name: Build ${{ matrix.packages }}
27+
needs:
28+
- decision
29+
runs-on: ubuntu-latest
30+
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
package: ${{ fromJSON(needs.decision.outputs.packages) }}
35+
exclude:
36+
- package: default
37+
1338
steps:
1439

1540
- name: Checkout
@@ -20,11 +45,17 @@ jobs:
2045
with:
2146
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
2247

23-
- name: Flake check
24-
run: nix flake check
25-
26-
- name: Build catalyst-toolbox
27-
run: nix build -L .#catalyst-toolbox
28-
29-
- name: Build snapshot-lib
30-
run: nix build -L .#snapshot-lib
48+
- name: Build ${{ matrix.package }} package
49+
run: |
50+
path=$(nix eval --raw .#packages.x86_64-linux.${{ matrix.package }})
51+
hash=${path:11:32}
52+
url="https://iog.cachix.org/$hash.narinfo";
53+
if curl --output /dev/null --silent --head --fail "$url"; then
54+
echo "Nothing to build!!!"
55+
echo ""
56+
echo "See build log with:"
57+
echo " nix log $path"
58+
echo ""
59+
else
60+
nix build .#packages.x86_64-linux.${{ matrix.package }} --show-trace -L
61+
fi

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
packages =
138138
workspace
139139
// {
140+
inherit pre-commit;
140141
default = workspace.catalyst-toolbox;
141142
};
142143

0 commit comments

Comments
 (0)