Skip to content

Commit

Permalink
Add CI and cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nbdd0121 committed Jan 8, 2024
1 parent 1c699c5 commit 6b3a12c
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 25 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

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

- name: Nix Format Check
run: nix fmt -- . --check

- name: Nix Syntax Check
run: nix flake check

build-plan:
# Save some computation. If the checks fail, don't build.
needs: checks
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: checkout
uses: actions/checkout@v4

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

- name: Generate Build Matrix
id: set-matrix
run: |
matrix="$(nix eval --json .#githubActions.matrix)"
echo "matrix=$matrix" >> $GITHUB_OUTPUT
build:
needs: build-plan
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.build-plan.outputs.matrix)}}
steps:
- name: checkout
uses: actions/checkout@v4

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

- name: Setup Cache
uses: ryanccn/attic-action@f75ac4b827cc5ce58fbf5d56a958db7aee78879c
with:
endpoint: https://hercules.servers.lowrisc.org/nix-cache/
cache: public
token: ${{ secrets.NIX_CACHE_TOKEN }}

- name: Build ${{ matrix.attr }}
run: nix build ".#{{ matrix.attr }}"
23 changes: 0 additions & 23 deletions .github/workflows/quality.yml

This file was deleted.

37 changes: 35 additions & 2 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
nix-github-actions.url = "github:nix-community/nix-github-actions";

poetry2nix = {
url = "github:nix-community/poetry2nix";
Expand All @@ -20,6 +21,7 @@
} @ inputs: let
no_system_outputs = {
lib.poetryOverrides = import ./lib/poetryOverrides.nix;
githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {checks = nixpkgs.lib.getAttrs ["x86_64-linux"] self.packages;};
};

all_system_outputs = flake-utils.lib.eachDefaultSystem (system: let
Expand Down

0 comments on commit 6b3a12c

Please sign in to comment.