From ebdd2333dda58e2a9ca2b83676de610491765131 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Fri, 13 Mar 2020 09:35:30 -0700 Subject: [PATCH] ci: move back to hand-written yaml --- .github/workflows/ci.yml | 63 ++++++++++++++++++++++++++++++++++- ci.nix | 72 ---------------------------------------- 2 files changed, 62 insertions(+), 73 deletions(-) delete mode 100644 ci.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7954eaa5..12f74d08c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1 +1,62 @@ -{"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\""}]},"mypy-ratchet":{"runs-on":"ubuntu-latest","steps":[{"name":"Checkout","uses":"actions/checkout@v2"},{"name":"Nix","uses":"cachix/install-nix-action@v7"},{"name":"setup-shell","run":"nix-shell --run \"true\""},{"name":"mypy-ratchet","run":"./ci/mypy-ratchet.sh"}]},"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":{"pull_request":{"branches":["*"]},"push":{"branches":["*"]}}} \ No newline at end of file +name: CI +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "**" ] +jobs: + parsing: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Nix + uses: cachix/install-nix-action@v8 + - name: Parsing + run: 'find . -name "*.nix" -exec nix-instantiate --parse --quiet {} >/dev/null +' + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Nix + uses: cachix/install-nix-action@v8 + - name: Build + run: 'nix-build --quiet release.nix -A build.x86_64-linux -I nixpkgs=channel:19.09' + black: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Nix + uses: cachix/install-nix-action@v8 + - name: Black + run: 'nix-shell --run "black . --check --diff"' + mypy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Nix + uses: cachix/install-nix-action@v8 + - name: Mypy + run: 'nix-shell --run "mypy nixops"' + mypy-ratchet: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Nix + uses: cachix/install-nix-action@v8 + - name: Mypy Ratchet + run: './ci/mypy-ratchet.sh' + coverage: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Nix + uses: cachix/install-nix-action@v8 + - name: Coverage + run: | + nix-shell --exclude tarball --run "./coverage-tests.py -a '!libvirtd,!gce,!ec2,!azure' -v" diff --git a/ci.nix b/ci.nix deleted file mode 100644 index 44cd117f7..000000000 --- a/ci.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ lib ? import -, pkgs ? import {} -}: -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 = [ "*" ]; - on.pull_request.branches = [ "*" ]; - - name = "CI"; - jobs = { - - mypy-ratchet = mkJob [ - { - name = "setup-shell"; - run = ''nix-shell --run "true"''; - } - { - name = "mypy-ratchet"; - run = "./ci/mypy-ratchet.sh"; - } - ]; - - 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 - ''; - }]; - }; - }; - generated = pkgs.writeText "ci.yml" (builtins.toJSON ci); -in - pkgs.writeShellScript "gen_ci" '' - mkdir -p "$(dirname ${ciPath})" - cat ${generated} > ${ciPath} -''