rf-testing/.drone.yml
surtur 014af52f32
Some checks failed
continuous-integration/drone/push Build is failing
fix: was not printing the url
2020-05-10 07:46:11 +02:00

178 lines
4.7 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
- name: results
path: /results
- name: archives
path: /archives
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
- name: results
path: /results
- name: archives
path: /archives
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: results
path: /results
- name: archives
path: /archives
- 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}.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_ACCOUNT:
from_secret: b2_account
B2_BUCKET_ID:
from_secret: b2_bucketId
B2_TOKEN:
from_secret: b2_token
B2_KEY_ID:
from_secret: b2_keyId
B2_KEY:
from_secret: b2_key
commands:
- ls -la /run/cache
- export FILE_TO_UPLOAD=/run/cache/archives/$(ls /run/cache/archives | head -1)
- export MIME_TYPE=text/plain
- export SHA1_OF_FILE=$(openssl dgst -sha1 $FILE_TO_UPLOAD | awk '{print $2;}')
- export apiUrl=$(curl -s 'https://api.backblazeb2.com/b2api/v2/b2_authorize_account' -u "$B2_KEY_ID:$B2_KEY" | python -c "import sys, json; print (json.load(sys.stdin)['apiUrl'])")
- export UPLOAD_URL=$(curl -s -H "Authorization:$B2_TOKEN" -d '"bucketId":"$B2_BUCKET_ID"' $apiUrl/b2api/v2/b2_get_upload_url | python -c "import sys, json; print (json.load(sys.stdin)['uploadUrl'])")
- curl -H "Authorization:$B2_TOKEN" -H "X-Bz-File-Name:$FILE_TO_UPLOAD" -H "Content-Type:$MIME_TYPE" -H "X-Bz-Content-Sha1:$SHA1_OF_FILE" -H "X-Bz-Info-Author:${DRONE_COMMIT_AUTHOR}" --data-binary "@$FILE_TO_UPLOAD" $UPLOAD_URL
- export FILE_TO_UPLOAD=/run/cache/archives/$(ls /run/cache/archives | tail -1)
- export MIME_TYPE=application/zstd
- export SHA1_OF_FILE=$(openssl dgst -sha1 $FILE_TO_UPLOAD | awk '{print $2;}')
- curl -H "Authorization:$B2_TOKEN" -H "X-Bz-File-Name:$FILE_TO_UPLOAD" -H "Content-Type:$MIME_TYPE" -H "X-Bz-Content-Sha1:$SHA1_OF_FILE" -H "X-Bz-Info-Author:${DRONE_COMMIT_AUTHOR}" --data-binary "@$FILE_TO_UPLOAD" $UPLOAD_URL
- cd
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