From 37310e16ab0db56b878b96639c81ef26f0898d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Sat, 21 May 2022 18:37:36 +0200 Subject: [PATCH] Replace sr.ht builds by internal drone CI --- .build.yml | 37 ------------------------------------- .drone.yml | 37 +++++++++++++++++++++++++++++++++++++ run-ci.sh | 17 ----------------- 3 files changed, 37 insertions(+), 54 deletions(-) delete mode 100644 .build.yml create mode 100644 .drone.yml delete mode 100755 run-ci.sh diff --git a/.build.yml b/.build.yml deleted file mode 100644 index 81366f8..0000000 --- a/.build.yml +++ /dev/null @@ -1,37 +0,0 @@ -image: alpine/edge -packages: -- elixir -- postgresql -- postgresql-contrib -- docker -artifacts: -- meta/_build/prod/rel/meta.tar.gz -sources: -- https://code.recycled.cloud/RecycledCloud/met.git -tasks: -- setup: | - sudo service postgresql setup - sudo service postgresql start - sudo service docker start - cd meta - mix local.hex --force - mix local.rebar --force - mix deps.get -- build: | - cd meta - MIX_ENV=test mix deps.compile - MIX_ENV=test mix compile -- test: | - cd meta - sudo docker pull code.ungleich.ch:5050/fnux/e-durable-oci-images/openldap-playground:latest - CALL_CONTAINER_RUNTIME_AS_ROOT=1 LDAP_WAIT_LOOPS=100 MIX_ENV=test mix test -- lint: | - cd meta - MIX_ENV=test mix credo -- release: | - cd meta - MIX_ENV=prod mix compile - MIX_ENV=prod mix phx.digest - MIX_ENV=prod mix release - cd _build/prod/rel - tar cvzf meta.tar.gz met/ diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..16a054b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,37 @@ +--- +kind: pipeline +name: default + +steps: +- name: fetch-dependencies + image: edurable/apmbc-reporting-build-environment:latest + commands: + - cd web + - mix deps.get +- name: build-release + image: edurable/apmbc-reporting-build-environment:latest + environment: + MIX_ENV: prod + commands: + - cd web + - mix compile + - mix phx.digest + - mix release + - cd _build/prod/rel + - tar czf "meta-$(git describe --exact-match --tags $(git log -n1 --pretty='%h') || git rev-parse HEAD).tar.gz" meta/ +- name: publish-release-archive + image: edurable/apmbc-reporting-build-environment:latest + environment: + LFTP_PASSWORD: + from_secret: ssh_password + commands: + - cd web/_build/prod/rel + - apt-get install -y lftp + - mkdir ~/.ssh + - ssh-keyscan static.recycled.cloud > ~/.ssh/known_hosts + - lftp "sftp://artifacts:$LFTP_PASSWORD@static.recycled.cloud" -e "cd htdocs; put meta-$(git describe --exact-match --tags $(git log -n1 --pretty='%h') || git rev-parse HEAD).tar.gz; bye" + +--- +kind: secret +name: ssh_password +data: qdcw1yGdz1iDaGmovTD7Afj1piyjcZ/H4NXNKPpmUWgagBvA diff --git a/run-ci.sh b/run-ci.sh deleted file mode 100755 index 4b34112..0000000 --- a/run-ci.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -set -e - -BUILDS_INSTANCE=https://builds.sr.ht -MANIFEST=.build.yml - -if [ -z "$SRHT_ACCESS_TOKEN" ]; then - echo "Please set SRHT_ACCESS_TOKEN before calling this script." >&2 - exit 1 -fi - -curl \ - -H Authorization:"token $SRHT_ACCESS_TOKEN" \ - --data "manifest=$(jq -R -r --slurp < $MANIFEST)" \ - --data "note=recycledcloud-meta" \ - -X POST $BUILDS_INSTANCE/api/jobs | jq