ci: Add workflow to seed cachix (#2615)

Fixes #2609.
This commit is contained in:
Robert
2023-01-16 16:56:48 +01:00
committed by GitHub
parent f353711ed2
commit 5fd6b3956e
5 changed files with 91 additions and 20 deletions
+77
View File
@@ -0,0 +1,77 @@
name: Cachix
# This workflow serves to
# - keep cachix up to date with the main branch
# - incrementally update cachix for large dependency
# updates, e.g. after running postgrest-nixpkgs-upgrade,
# which can cause the main CI workflow to time out
on:
workflow_dispatch:
push:
branches:
- main
- rel-*
tags:
- v*
jobs:
Seed-Cachix:
strategy:
matrix:
include:
- os: Linux
runs-on: ubuntu-latest
- os: MacOS
runs-on: macos-latest
name: Seed ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- name: Setup Nix Environment
uses: ./.github/actions/setup-nix
with:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Install cachix tooling
run: |
nix-env -f default.nix -iA devTools.pushCachix.bin
postgrest-push-cachix
- name: Seed dynamic postgrest build
run: |
nix-build -A postgrestPackage
postgrest-push-cachix
- name: Seed style tools
run: |
nix-build -A style
postgrest-push-cachix
- name: Seed test tools
run: |
nix-build -A tests
postgrest-push-cachix
- name: Seed static toolchain
if: matrix.os == 'Linux'
run: |
nix-build -A packagesStatic.haskellPackages.hello
postgrest-push-cachix
- name: Seed static postgresql build (for libpq)
if: matrix.os == 'Linux'
run: |
nix-build -A packagesStatic.pkgs.postgresql
postgrest-push-cachix
- name: Seed static postgrest build
if: matrix.os == 'Linux'
run: |
nix-build -A postgrestStatic
postgrest-push-cachix
- name: Build and push everything to Cachix
run: |
nix-build
postgrest-push-cachix
-16
View File
@@ -108,7 +108,6 @@ jobs:
- name: Setup Nix Environment - name: Setup Nix Environment
uses: ./.github/actions/setup-nix uses: ./.github/actions/setup-nix
with: with:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
tools: tests tools: tests
- name: Build static executable - name: Build static executable
@@ -131,13 +130,6 @@ jobs:
path: postgrest-docker.tar.gz path: postgrest-docker.tar.gz
if-no-files-found: error if-no-files-found: error
- name: Build and push everything to Cachix (main branch only)
if: ${{ github.ref == 'refs/heads/main' }}
run: |
nix-build
nix-env -f default.nix -iA devTools
postgrest-push-cachix
Build-Macos-Nix: Build-Macos-Nix:
name: Build MacOS (Nix) name: Build MacOS (Nix)
@@ -146,18 +138,10 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Setup Nix Environment - name: Setup Nix Environment
uses: ./.github/actions/setup-nix uses: ./.github/actions/setup-nix
with:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build everything - name: Build everything
run: | run: |
nix-build nix-build
nix-env -f default.nix -iA devTools
- name: Push to Cachix (main branch only)
if: ${{ github.ref == 'refs/heads/main' }}
run: |
postgrest-push-cachix
Build-Stack: Build-Stack:
+9 -3
View File
@@ -65,11 +65,17 @@ let
postgrest = postgrest =
pkgs.haskell.packages."${compiler}".callCabal2nix name src { }; pkgs.haskell.packages."${compiler}".callCabal2nix name src { };
# Function that derives a fully static Haskell package based on # Functionality that derives a fully static Haskell package based on
# nh2/static-haskell-nix # nh2/static-haskell-nix
staticHaskellPackage = staticHaskellPackage =
import nix/static-haskell-package.nix { inherit nixpkgs system compiler patches allOverlays; }; import nix/static-haskell-package.nix { inherit nixpkgs system compiler patches allOverlays; };
# Static executable.
postgrestStatic =
lib.justStaticExecutables (lib.dontCheck (staticHaskellPackage name src).package);
packagesStatic = (staticHaskellPackage name src).survey;
# Options passed to cabal in dev tools and tests # Options passed to cabal in dev tools and tests
devCabalOptions = devCabalOptions =
"-f dev --test-show-detail=direct"; "-f dev --test-show-detail=direct";
@@ -152,8 +158,8 @@ rec {
pkgs.callPackage nix/tools/withTools.nix { inherit devCabalOptions postgresqlVersions postgrest; }; pkgs.callPackage nix/tools/withTools.nix { inherit devCabalOptions postgresqlVersions postgrest; };
} // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux rec { } // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux rec {
# Static executable. # Static executable.
postgrestStatic = inherit postgrestStatic;
lib.justStaticExecutables (lib.dontCheck (staticHaskellPackage name src)); inherit packagesStatic;
# Docker images and loading script. # Docker images and loading script.
docker = docker =
+4 -1
View File
@@ -59,4 +59,7 @@ let
survey = survey =
import "${patched-static-haskell-nix}/survey" { inherit normalPkgs compiler defaultCabalPackageVersionComingWithGhc; }; import "${patched-static-haskell-nix}/survey" { inherit normalPkgs compiler defaultCabalPackageVersionComingWithGhc; };
in in
survey.haskellPackages."${name}" {
inherit survey;
package = survey.haskellPackages."${name}";
}
+1
View File
@@ -303,4 +303,5 @@ buildToolbox
hsieGraphModules hsieGraphModules
hsieGraphSymbols hsieGraphSymbols
]; ];
extra = { inherit pushCachix; };
} }