Skip to content

Use nix-env in ci #81

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
36 changes: 18 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ jobs:
env:
CGO_ENABLED: 0
steps:
- name: Setup Dynamic Env
run: |
echo "MAKEFLAGS=-j$(nproc)" | tee $GITHUB_ENV

- name: Checkout code
uses: actions/checkout@v2

Expand All @@ -21,20 +17,24 @@ jobs:
with:
nix_path: nixpkgs=channel:nixpkgs-unstable

- name: Fetch Nix Derivations
run: nix-shell --command true

- name: Install Go tools
run: nix-shell --run 'make tools'

- name: Linters and Go Formatting
run: nix-shell --run 'make verify'
- name: Install Nix Packages
run: |
nix-shell --run true

- name: Non Go Formatters
run: ./.github/workflows/formatters.sh
- name: Check Nix Packages without direnv
run: |
set -x
echo PYTHONPATH=$PYTHONPATH
which prettier || :

- name: Install ZFS
run: sudo apt-get -y update && sudo apt-get -y install zfsutils-linux
- name: Install Nix Packages & Export Using direnv
run: |
nix-shell --run true
./direnv allow
./direnv export gha >> "$GITHUB_ENV"

- name: Tests
run: nix-shell --run 'sudo make test'
- name: Check Nix Packages with direnv
run: |
set -x
echo PYTHONPATH=$PYTHONPATH
which prettier
8 changes: 5 additions & 3 deletions .github/workflows/formatters.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash ../../shell.nix
#shellcheck shell=bash
#!/usr/bin/env bash

set -eux

Expand All @@ -18,6 +16,10 @@ if ! nixfmt shell.nix; then
failed=1
fi

if ! rufo Vagrantfile; then
failed=1
fi

if ! git diff | (! grep .); then
failed=1
fi
Expand Down
10 changes: 4 additions & 6 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.ssh.forward_agent = true
config.vm.box = "ubuntu/trusty64"
config.ssh.forward_agent = true

config.vm.synced_folder ".", "/home/vagrant/go/src/github.com/mistifyio/go-zfs", create: true
config.vm.synced_folder ".", "/home/vagrant/go/src/github.com/mistifyio/go-zfs", create: true

config.vm.provision "shell", inline: <<EOF
config.vm.provision "shell", inline: <<EOF
cat << END > /etc/profile.d/go.sh
export GOPATH=\\$HOME/go
export PATH=\\$GOPATH/bin:/usr/local/go/bin:\\$PATH
Expand All @@ -30,5 +29,4 @@ Defaults env_keep += "GOPATH"
END

EOF

end
Binary file added direnv
Binary file not shown.
5 changes: 3 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ in { pkgs ? import (_pkgs.fetchFromGitHub {

with pkgs;

mkShell {
buildInputs = [
mkShellNoCC {
packages = [
git
gnumake
gnused
Expand All @@ -19,6 +19,7 @@ mkShell {
nodePackages.prettier
python3Packages.pip
python3Packages.setuptools
rufo
shfmt
vagrant
];
Expand Down