From 67646b1f920eda49b6508ad7a53bf84aa1e97472 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 8 Aug 2021 20:01:11 +0200 Subject: [PATCH 1/8] ci: use exec runner --- .drone.yml | 88 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/.drone.yml b/.drone.yml index 48e7a96..048745d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,48 +1,52 @@ +--- kind: pipeline +type: exec name: deploy CV steps: - - name: build - image: aergus/latex - pull: always - commands: - - make +- name: build + commands: + - nix develop -c make - - name: deploy - image: appleboy/drone-scp - settings: - source: /drone/src/*.pdf - strip_components: 2 # Make sure the tarball doesn't contain leading path - rm: true # Make sure only the newly generated files are left - host: - from_secret: ssh_host - target: - from_secret: ssh_target - username: - from_secret: ssh_user - key: - from_secret: ssh_key - port: - from_secret: ssh_port - when: - branch: - - main - event: - exclude: - - pull_request +- name: deploy + commands: + - nix run 'github:ambroisie/nix-config#drone-scp' + environment: + SCP_SOURCE: /drone/src/*.pdf + SCP_STRIP_COMPONENTS: 2 # Make sure the tarball doesn't contain leading path + SCP_RM: true # Make sure only the newly generated files are left + SCP_HOST: + from_secret: ssh_host + SCP_TARGET: + from_secret: ssh_target + SCP_USERNAME: + from_secret: ssh_user + SCP_KEY: + from_secret: ssh_key + SCP_PORT: + from_secret: ssh_port + when: + branch: + - main + event: + exclude: + - pull_request - - name: notify - image: plugins/matrix - settings: - homeserver: - from_secret: matrix_homeserver - roomid: - from_secret: matrix_roomid - username: - from_secret: matrix_username - password: - from_secret: matrix_password - trigger: - status: - - failure - - success + +- name: notifiy + commands: + - nix run .#matrix-notifier + environment: + ADDRESS: + from_secret: matrix_homeserver + ROOM: + from_secret: matrix_roomid + USER: + from_secret: matrix_username + PASS: + from_secret: matrix_password + when: + status: + - failure + - success +... From 0ed5b0fb6457db8e467471b385e4467429e95f18 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 8 Aug 2021 20:03:44 +0200 Subject: [PATCH 2/8] nix: use `eachDefaultSystem` Due to the pre-commit check not having every system available... --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index fab424b..233f242 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ }; outputs = { self, nixpkgs, futils } @ inputs: - futils.lib.eachSystem futils.lib.allSystems (system: + futils.lib.eachDefaultSystem (system: let inherit (nixpkgs) lib; pkgs = nixpkgs.legacyPackages.${system}; From 454d2b969e2727070e8a9a2865b1f9dd4c2a8f69 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 8 Aug 2021 20:04:13 +0200 Subject: [PATCH 3/8] ci: add check step --- .drone.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.drone.yml b/.drone.yml index 048745d..68202e5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,6 +8,10 @@ steps: commands: - nix develop -c make +- name: check + commands: + - nix flake check + - name: deploy commands: - nix run 'github:ambroisie/nix-config#drone-scp' From 267f5c8598bcc4f8eb4bd20c5d419413ff6a488d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 8 Aug 2021 20:05:11 +0200 Subject: [PATCH 4/8] ci: fix path to build output --- .drone.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 68202e5..6d6e58c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,8 +16,7 @@ steps: commands: - nix run 'github:ambroisie/nix-config#drone-scp' environment: - SCP_SOURCE: /drone/src/*.pdf - SCP_STRIP_COMPONENTS: 2 # Make sure the tarball doesn't contain leading path + SCP_SOURCE: *.pdf SCP_RM: true # Make sure only the newly generated files are left SCP_HOST: from_secret: ssh_host From 46d05fe4ae78e94a6be2ff4ba184e7b545e09e61 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 8 Aug 2021 20:01:11 +0200 Subject: [PATCH 5/8] ci: use exec runner --- .drone.yml | 86 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/.drone.yml b/.drone.yml index 48e7a96..880228d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,48 +1,50 @@ kind: pipeline +type: exec name: deploy CV steps: - - name: build - image: aergus/latex - pull: always - commands: - - make +- name: build + commands: + - nix develop -c make - - name: deploy - image: appleboy/drone-scp - settings: - source: /drone/src/*.pdf - strip_components: 2 # Make sure the tarball doesn't contain leading path - rm: true # Make sure only the newly generated files are left - host: - from_secret: ssh_host - target: - from_secret: ssh_target - username: - from_secret: ssh_user - key: - from_secret: ssh_key - port: - from_secret: ssh_port - when: - branch: - - main - event: - exclude: - - pull_request +- name: deploy + commands: + - nix run github:ambroisie/nix-config#drone-scp + environment: + SCP_SOURCE: /drone/src/*.pdf + SCP_STRIP_COMPONENTS: 2 # Make sure the tarball doesn't contain leading path + SCP_RM: true # Make sure only the newly generated files are left + SCP_HOST: + from_secret: ssh_host + SCP_TARGET: + from_secret: ssh_target + SCP_USERNAME: + from_secret: ssh_user + SCP_KEY: + from_secret: ssh_key + SCP_PORT: + from_secret: ssh_port + when: + branch: + - main + event: + exclude: + - pull_request - - name: notify - image: plugins/matrix - settings: - homeserver: - from_secret: matrix_homeserver - roomid: - from_secret: matrix_roomid - username: - from_secret: matrix_username - password: - from_secret: matrix_password - trigger: - status: - - failure - - success + +- name: notifiy + commands: + - nix run .#matrix-notifier + environment: + ADDRESS: + from_secret: matrix_homeserver + ROOM: + from_secret: matrix_roomid + USER: + from_secret: matrix_username + PASS: + from_secret: matrix_password + when: + status: + - failure + - success From 75630df80d10d371c5d1fc6f746b6698e98b979f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 8 Aug 2021 20:03:44 +0200 Subject: [PATCH 6/8] nix: use `eachDefaultSystem` Due to the pre-commit check not having every system available... --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index fab424b..233f242 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ }; outputs = { self, nixpkgs, futils } @ inputs: - futils.lib.eachSystem futils.lib.allSystems (system: + futils.lib.eachDefaultSystem (system: let inherit (nixpkgs) lib; pkgs = nixpkgs.legacyPackages.${system}; From 25ae1ab53e1adb5cfd5562ab552313dc3fad1e28 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 8 Aug 2021 20:04:13 +0200 Subject: [PATCH 7/8] ci: add check step --- .drone.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.drone.yml b/.drone.yml index 880228d..ea339c3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,6 +7,10 @@ steps: commands: - nix develop -c make +- name: check + commands: + - nix flake check + - name: deploy commands: - nix run github:ambroisie/nix-config#drone-scp From 2a5037469187d2f906321ce52b0ea714cbfe0051 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 8 Aug 2021 20:05:11 +0200 Subject: [PATCH 8/8] ci: fix path to build output --- .drone.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index ea339c3..8e8324a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,8 +15,7 @@ steps: commands: - nix run github:ambroisie/nix-config#drone-scp environment: - SCP_SOURCE: /drone/src/*.pdf - SCP_STRIP_COMPONENTS: 2 # Make sure the tarball doesn't contain leading path + SCP_SOURCE: '*.pdf' SCP_RM: true # Make sure only the newly generated files are left SCP_HOST: from_secret: ssh_host