Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nix cache workflow #1247

Merged
merged 5 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and cache with Nix

on:
workflow_dispatch:
push:

jobs:
build-and-cache:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Nix with caching
uses: kadena-io/setup-nix-with-cache@v1
with:
cache_url: s3://nixcache.chainweb.com?region=us-east-1
signing_private_key: ${{ secrets.NIX_CACHE_PRIVATE_KEY }}

- name: Set up AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.NIX_CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.NIX_CACHE_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Build and cache artifacts
timeout-minutes: 740
run: |
echo Building the default package and its devShell
nix build .#check
24 changes: 13 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@
};
})
];
in flake // {
# This package depends on other packages at buildtime, but its output does not
# depend on them. This way, we don't have to download the entire closure to verify
# that those packages build.
mkCheck = name: package: pkgs.runCommand ("check-"+name) {} ''
echo ${name}: ${package}
echo works > $out
'';
in flake // rec {
packages.default = flake.packages."pact:exe:pact";

devShell = pkgs.haskellPackages.shellFor {
buildInputs = with pkgs.haskellPackages; [
cabal-install
haskell-language-server
# hlint
];

withHoogle = true;
};
packages.check = pkgs.runCommand "check" {} ''
echo ${mkCheck "pact" packages.default}
echo ${mkCheck "devShell" flake.devShell}
echo works > $out
'';
});
}