-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
ci: init #1251
ci: init #1251
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"jobs":{"black":{"runs-on":"ubuntu-latest","steps":[{"name":"Checkout","uses":"actions/checkout@v2"},{"name":"Nix","uses":"cachix/install-nix-action@v7"},{"name":"Black","run":"nix-shell --run \"black . --check --diff\""}]},"build":{"runs-on":"ubuntu-latest","steps":[{"name":"Checkout","uses":"actions/checkout@v2"},{"name":"Nix","uses":"cachix/install-nix-action@v7"},{"name":"Build","run":"nix-build --quiet release.nix -A build.x86_64-linux -I nixpkgs=channel:19.09"}]},"ciCheck":{"runs-on":"ubuntu-latest","steps":[{"name":"Checkout","uses":"actions/checkout@v2"},{"name":"Nix","uses":"cachix/install-nix-action@v7"},{"name":"Check CI","run":"cp ./.github/workflows/ci.yml /tmp/ci.reference.yml\nnix-build ci.nix --no-out-link | bash\ndiff ./.github/workflows/ci.yml /tmp/ci.reference.yml || exit 1\n"}]},"coverage":{"runs-on":"ubuntu-latest","steps":[{"name":"Checkout","uses":"actions/checkout@v2"},{"name":"Nix","uses":"cachix/install-nix-action@v7"},{"name":"Coverage","run":"nix-shell --exclude tarball --run \"./coverage-tests.py -a '!libvirtd,!gce,!ec2,!azure' -v\""}]},"mypy":{"runs-on":"ubuntu-latest","steps":[{"name":"Checkout","uses":"actions/checkout@v2"},{"name":"Nix","uses":"cachix/install-nix-action@v7"},{"name":"MyPy","run":"nix-shell --run \"mypy nixops\""}]},"parsing":{"runs-on":"ubuntu-latest","steps":[{"name":"Checkout","uses":"actions/checkout@v2"},{"name":"Nix","uses":"cachix/install-nix-action@v7"},{"name":"Parsing","run":"find . -name \"*.nix\" -exec nix-instantiate --parse --quiet {} >/dev/null +"}]}},"name":"CI","on":{"push":{"branches":["*"]}}} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ lib ? import <nixpkgs/lib> | ||
, pkgs ? import <nixpkgs> {} | ||
}: | ||
with builtins; with lib; | ||
let | ||
ciPath = "./.github/workflows/ci.yml"; | ||
checkout = { | ||
name = "Checkout"; | ||
uses = "actions/checkout@v2"; | ||
}; | ||
nix = { | ||
name = "Nix"; | ||
uses = "cachix/install-nix-action@v7"; | ||
}; | ||
mkJob = extraSteps: { | ||
runs-on = "ubuntu-latest"; | ||
steps = [ checkout nix ] ++ extraSteps; | ||
}; | ||
ci = { | ||
on.push.branches = [ "*" ]; | ||
name = "CI"; | ||
jobs = { | ||
parsing = mkJob [{ | ||
name = "Parsing"; | ||
run = "find . -name \"*.nix\" -exec nix-instantiate --parse --quiet {} >/dev/null +"; | ||
}]; | ||
mypy = mkJob [{ | ||
name = "MyPy"; | ||
run = "nix-shell --run \"mypy nixops\""; | ||
}]; | ||
black = mkJob [{ | ||
name = "Black"; | ||
run = "nix-shell --run \"black . --check --diff\""; | ||
}]; | ||
coverage = mkJob [{ | ||
name = "Coverage"; | ||
run = "nix-shell --exclude tarball --run \"./coverage-tests.py -a '!libvirtd,!gce,!ec2,!azure' -v\""; | ||
}]; | ||
build = mkJob [{ | ||
name = "Build"; | ||
run = "nix-build --quiet release.nix -A build.x86_64-linux -I nixpkgs=channel:19.09"; | ||
}]; | ||
ciCheck = mkJob [{ | ||
name = "Check CI"; | ||
run = '' | ||
cp ${ciPath} /tmp/ci.reference.yml | ||
nix-build ci.nix --no-out-link | bash | ||
diff ${ciPath} /tmp/ci.reference.yml || exit 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The generated yml/json file is one long line. Perhaps prettifying it with jq makes it more readable and results in easier to read diffs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deferring to @grahamc, I'd be fine with that |
||
''; | ||
}]; | ||
}; | ||
}; | ||
generated = pkgs.writeText "ci.yml" (builtins.toJSON ci); | ||
in | ||
pkgs.writeShellScript "gen_ci" '' | ||
mkdir -p "$(dirname ${ciPath})" | ||
cat ${generated} > ${ciPath} | ||
'' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since release.nix already has a default nixpkgs, isn't adding -I nixpkgs=... asking for trouble?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was copied over from
.travis.yml