rf-testing/.drone.yml
surtur 0760c22b35
All checks were successful
continuous-integration/drone/push Build is passing
introducing the proper way to use B2
2020-05-11 02:16:41 +02:00

158 lines
3.9 KiB
YAML

---
kind: pipeline
name: test-set-default
platform:
arch: amd64
steps:
- name: reveal-env
pull: always
image: immawanderer/archlinux-rf:latest
volumes:
- name: shm
path: /dev/shm
commands:
- uname -r
- python --version
- robot --version || echo "rf loves to exit with code $(robot --version 2>&1 >/dev/null; echo $?)"
- mkdir -pv archives
- mkdir -pv results/${DRONE_STAGE_NAME}
- name: test000
pull: if-not-exists
image: immawanderer/archlinux-rf:latest
volumes:
- name: shm
path: /dev/shm
commands:
- mkdir -pv results/${DRONE_STAGE_NAME}/${DRONE_STEP_NAME}
- robot -T -d results/${DRONE_STAGE_NAME}/${DRONE_STEP_NAME} test000.robot
when:
status:
- success
- failure
depends_on:
- reveal-env
- name: archives
pull: if-not-exists
image: immawanderer/archlinux-rf:latest
volumes:
- name: shm
path: /dev/shm
- name: cache
path: /run/cache
commands:
- ls -la .
- tar cfv archives/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd results --zstd
- curl -sS https://dotya.ml/store/0x28bd2388.asc | gpg --quiet --import -
- gpg -eR 28bd2388 --trust-model always archives/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd
- sha512sum archives/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd.gpg > archives/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd.gpg-SHA512SUM
- rm archives/*zstd
- ls -la archives
- mkdir -pv /run/cache
- cp -vR archives /run/cache
when:
status:
- success
- failure
depends_on:
- test000
volumes:
- name: cache
host:
path: /run/cache
---
kind: pipeline
name: upload
platform:
os: linux
arch: amd64
clone:
disable: true
trigger:
branch:
- master
- dev
event:
- push
- tag
status:
- success
- failure
depends_on:
- test-set-default
steps:
- name: backblaze-b2
pull: always
image: immawanderer/archlinux-rf:latest
volumes:
- name: cache
path: /run/cache
environment:
B2_BUCKET_NAME:
from_secret: B2_BUCKET_NAME
B2_KEY_ID:
from_secret: B2_KEY_ID
B2_KEY:
from_secret: B2_KEY
commands:
- pip install b2
- b2 authorize-account $B2_KEY_ID $B2_KEY
- b2 upload-file "$B2_BUCKET_NAME" "/run/cache/archives/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd.gpg-SHA512SUM" "results/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd.gpg-SHA512SUM" > /dev/null 2>&1
- b2 upload-file "$B2_BUCKET_NAME" "/run/cache/archives/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd.gpg" "results/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd.gpg" > /dev/null 2>&1
# - curl -sO https://git.dotya.ml/wanderer/dotfiles/raw/branch/master/bin/b2-ul_me
# - chmod +x b2-ul_me
# - ./b2-ul_me "/run/cache/archives/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd.gpg-SHA512SUM" 'text/plain' "$B2_KEY_ID" "$B2_KEY"
# - ./b2-ul_me "/run/cache/archives/results-${DRONE_COMMIT_SHA:0:7}.tar.zstd.gpg" 'application/zstd' "$B2_KEY_ID" "$B2_KEY"
volumes:
- name: cache
host:
path: /run/cache
---
kind: pipeline
name: notifications
platform:
os: linux
arch: amd64
clone:
disable: true
trigger:
branch:
- master
- dev
event:
- push
- tag
status:
- success
- failure
depends_on:
- test-set-default
steps:
- name: discord
pull: always
image: appleboy/drone-discord:1.2.4
settings:
message: "{{#success build.status}} ✅ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` succeeded.\nevent: **`{{build.event}}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`\n```{{commit.message}}``` {{else}} ❌ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed.\nevent: **`${DRONE_BUILD_EVENT}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`\n```{{commit.message}}``` {{/success}}\n"
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token