Skip to content

Commit

Permalink
ci: migrate to flake-gha
Browse files Browse the repository at this point in the history
  • Loading branch information
thecaralice committed Sep 30, 2024
1 parent f6c2a8c commit 3874a11
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 25 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/cachix-push.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/flake-gha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Flake-managed workflow"
on:
pull_request:
push:
jobs:
config:
runs-on: ubuntu-latest
outputs:
config: ${{ steps.config.outputs.config }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v29
- id: config
name: Get config from the flake
run: |
printf 'config=' >> "$GITHUB_OUTPUT"
nix eval --json .#githubActions.config >> "$GITHUB_OUTPUT"
check:
needs: config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v29
- run: nix flake check --all-systems --no-build
if: ${{ fromJSON(needs.config.outputs.config).checkAllSystems }}
- run: nix flake check --no-build
if: ${{ ! fromJSON(needs.config.outputs.config).checkAllSystems }}
build:
needs: config
strategy:
matrix:
include: ${{ fromJSON(needs.config.outputs.config).matrix }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v29
- uses: cachix/cachix-action@v15
if: ${{ matrix.enableCachix }}
with:
name: ${{ fromJSON(needs.config.outputs.config).cacheName }}
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
pathsToPush: ${{ matrix.pathsToPush }}
skipPush: ${{ matrix.skipPush }}
- run: |
nix-build --no-link --keep-going --expr '{ system }: (builtins.getFlake (toString ./.)).githubActions.target.${system}' --argstr system ${{ matrix.double }}
21 changes: 21 additions & 0 deletions flake.lock

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

9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
flake-gha.url = "github:thecaralice/flake-gha";
flake-gha.inputs.flake-parts.follows = "flake-parts";
};
outputs =
inputs@{
Expand All @@ -19,12 +21,14 @@
flake-parts,
ez-configs,
crane,
flake-gha,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.platforms.all;
imports = [
ez-configs.flakeModule
flake-gha.flakeModule
];
ezConfigs.root = ./.;
ezConfigs.earlyModuleArgs = {
Expand All @@ -43,6 +47,11 @@
packages.server = pkgs.callPackage ./packages/server { inherit craneLib; };
packages.frontends = pkgs.callPackage ./packages/frontends { };
};
githubActions = {
cachix.enable = true;
cachix.cacheName = "trieve";
checkAllSystems = false;
};
};
nixConfig = {
substituters = [ "https://trieve.cachix.org" ];
Expand Down

0 comments on commit 3874a11

Please sign in to comment.