Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
[DEVOPS-779] simplify CI setup with buildkite hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
disassembler committed Jul 4, 2018
1 parent 65b3453 commit 02a5f43
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
22 changes: 22 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
set -x

case $(uname -s | tr '[:upper:]' '[:lower:]') in
linux ) NIX_PROFILE_BINPATH=/run/current-system/sw/bin/;;
darwin ) NIX_PROFILE_BINPATH=/nix/var/nix/profiles/default/bin;;
* ) echo "Unsupported OS: $OS_NAME" >&2; exit 1;;
esac

# Bootstrap on OS X/NixOS:

NIX_BUILD="$(type -P nix-build)"
NIX_BUILD="${NIX_BUILD:-$NIX_PROFILE_BINPATH/nix-build}"
NIX_SHELL="$(type -P nix-shell)"
NIX_SHELL="${NIX_SHELL:-$NIX_PROFILE_BINPATH/nix-shell}"
NIX_BUILD_SHELL="$(type -P bash)"
NIX_BUILD_SHELL="${NIX_BUILD_SHELL:-$NIX_PROFILE_BINPATH/bash}"

export NIX_REMOTE=daemon
NIX_PATH="nixpkgs=$(${NIX_BUILD} fetch-nixpkgs.nix -o nixpkgs)"
export PATH=$NIX_PROFILE_BINPATH:$PATH
export NIX_PATH
export NIX_BUILD_SHELL
12 changes: 6 additions & 6 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
steps:
- label: 'hlint'
command: 'scripts/ci/nix-shell.sh -p hlint moreutils --run scripts/haskell/lint.sh'
command: 'nix-shell -p hlint moreutils --run scripts/haskell/lint.sh'
agents:
system: x86_64-linux

- label: 'stack2nix'
command: 'scripts/ci/nix-shell.sh -p cabal2nix stack cabal-install ghc moreutils expect -Q -j 4 --run scripts/check-stack2nix.sh'
command: 'nix-shell -Q -j 4 --run scripts/check-stack2nix.sh'
agents:
system: x86_64-linux

- label: 'cardano-x86_64-linux'
command: 'scripts/ci/nix-shell.sh --run scripts/ci/ci.sh'
command: 'nix-shell --run scripts/ci/ci.sh'
agents:
system: x86_64-linux

- label: 'cardano-x86_64-darwin'
command: 'scripts/ci/nix-shell.sh --run scripts/ci/ci.sh'
command: 'nix-shell --run scripts/ci/ci.sh'
agents:
system: x86_64-darwin

- label: 'release.nix'
command: 'scripts/ci/nix-shell.sh --run scripts/ci/check-hydra.sh'
command: 'nix-shell --run scripts/ci/check-hydra.sh'
agents:
system: x86_64-linux

- label: 'explorer frontend: checking generated dependencies'
command: 'scripts/ci/nix-shell.sh --run "cd explorer/frontend && ./nix/generate-frontend-deps.hs --test"'
command: "cd explorer/frontend && ./nix/generate-frontend-deps.hs --test"
agents:
system: x86_64-linux
2 changes: 1 addition & 1 deletion pkgs/generate.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash
#!nix-shell -i bash -p bash cabal2nix stack cabal-install ghc

# regenerate the `pkgs/default.nix` file based on the current contents of cardano-sl.cabal and stack.yaml

Expand Down
3 changes: 2 additions & 1 deletion scripts/check-stack2nix.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p git bash

# check and warn if `pkgs/default.nix` is out of date

Expand Down

0 comments on commit 02a5f43

Please sign in to comment.