Skip to content

Commit

Permalink
gha: attempt to minimize CI time
Browse files Browse the repository at this point in the history
  • Loading branch information
itslychee committed Jun 9, 2024
1 parent c7c7317 commit 8755bd8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup build environment for Nix
on:
workflow_call:
jobs:
bootstrap:
name: "Generate bootstrap environment"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install QEMU
run: |
sudo apt update -q -y
sudo apt install -q -y binfmt-support qemu-efi qemu-system-aarch64 qemu-user-static
- uses: DeterminateSystems/nix-installer-action@v4
name: Install Nix
with:
extra-conf: |
extra-platforms = aarch64-linux i686-linux
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@v14
name: Setup cachix
with:
name: lychee
authToken: ${{ secrets.CACHIX_KEY }}
42 changes: 13 additions & 29 deletions .github/workflows/closures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,35 @@ on:
pull_request:
push:
jobs:
bootstrap:
uses: ./.github/workflows/bootstrap.yml
secrets: inherit
generate_matrix:
name: "Generate hive list"
runs-on: ubuntu-latest
name: "Generate hive list"
needs: bootstrap
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: actions/checkout@v4
- id: matrix
name: "Run nix eval to generate node list"
run: |
JSON=$(nix eval .#colmena --apply 'with builtins; x: filter (f: !elem f [ "defaults" "meta" ]) (attrNames x)' --json)
JSON=$(nix eval .#colmena --no-substitute -apply 'with builtins; x: filter (f: !elem f [ "defaults" "meta" ]) (attrNames x)' --json)
echo "matrix=$JSON" >> $GITHUB_OUTPUT
bootstrap:
name: "Generate bootstrap environment"
needs: generate_matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install QEMU
run: |
sudo apt update -q -y
sudo apt install -q -y binfmt-support qemu-efi qemu-system-aarch64 qemu-user-static
- uses: DeterminateSystems/nix-installer-action@v4
name: Install Nix
with:
extra-conf: |
extra-platforms = aarch64-linux i686-linux
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@v14
name: Setup cachix
with:
name: lychee
authToken: '${{ secrets.CACHIX_KEY }}'
build:
runs-on: ubuntu-latest
name: "Build node"
needs: bootstrap
needs:
- generate_matrix
- bootstrap
strategy:
# each closure is independent from each other
fail-fast: false
matrix:
node: ${{ fromJSON(needs.bootstrap.needs.generate_matrix.outputs.matrix) }}
steps:
node: ${{ fromJSON(needs.generate_matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Build ${{ matrix.node }}
run: |
nix run nixpkgs#colmena -- build --no-build-on-target -v --on ${{ matrix.node }}

0 comments on commit 8755bd8

Please sign in to comment.