From e26c98e499bf93b9fd1046f64ab2d0cf82af95e1 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 23 Oct 2021 22:52:07 +0200 Subject: [PATCH] build el7 and el8 --- .drone.jsonnet | 150 +++++++++++++++++++++++++++++++++++++++++++++++++ .drone.yml | 58 ++++++++++++++++--- 2 files changed, 201 insertions(+), 7 deletions(-) create mode 100644 .drone.jsonnet diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..0cf43b4 --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,150 @@ +local PipelineTest = { + kind: 'pipeline', + name: 'test', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'markdownlint', + image: 'thegeeklab/markdownlint-cli', + commands: [ + "markdownlint 'README.md'", + ], + }, + ], + trigger: { + ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], + }, +}; + +local DistVersion(version='7') = { + name: 'build-el' + version, + image: 'thegeeklab/rpmbuild:' + version, + commands: [ + 'source /drone/src/.drone.env', + 'rm -rf /etc/xinetd.d/ && rpmbuild -ba --without libusb1 --define "version_ $${CUPS_VERSION##v}" cups.spec', + 'ls -l /drone/src/dist/RPMS/x86_64/', + ], + depends_on: [ + 'clone', + ], +}; + + +local PipelineBuildPackage = { + kind: 'pipeline', + name: 'build-packages', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + DistVersion(version='7'), + DistVersion(version='8'), + { + name: 'checksum', + image: 'alpine', + commands: [ + 'cd /drone/src/dist/RPMS/x86_64/ && sha256sum * > /drone/src/dist/sha256sum.txt', + ], + depends_on: [ + 'build-el7', + 'build-el8', + ], + }, + { + name: 'changelog-generate', + image: 'thegeeklab/git-chglog', + commands: [ + 'git fetch -tq', + 'git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}', + ], + depends_on: [ + 'checksum', + ], + }, + { + name: 'changelog-format', + image: 'thegeeklab/alpine-tools', + commands: [ + 'prettier CHANGELOG.md', + 'prettier -w CHANGELOG.md', + ], + depends_on: [ + 'changelog-generate', + ], + }, + { + name: 'publish-gitea', + image: 'plugins/gitea-release', + settings: { + api_key: { + from_secret: 'gitea_token', + }, + base_url: 'https://gitea.rknet.org', + files: [ + '/drone/src/dist/RPMS/x86_64/*', + '/drone/src/dist/sha256sum.txt', + ], + note: 'CHANGELOG.md', + overwrite: true, + title: '${DRONE_TAG}', + }, + when: { + ref: [ + 'refs/tags/**', + ], + }, + depends_on: [ + 'changelog-format', + ], + }, + ], + depends_on: [ + 'test', + ], + trigger: { + ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], + }, +}; + +local PipelineNotifications = { + kind: 'pipeline', + name: 'notifications', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'matrix', + image: 'thegeeklab/drone-matrix', + settings: { + homeserver: { from_secret: 'matrix_homeserver' }, + roomid: { from_secret: 'matrix_roomid' }, + template: 'Status: **{{ build.Status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}
Message: {{ commit.Message.Title }}', + username: { from_secret: 'matrix_username' }, + password: { from_secret: 'matrix_password' }, + }, + when: { + status: ['success', 'failure'], + }, + }, + ], + depends_on: [ + 'build-package-el7', + 'build-package-el8', + ], + trigger: { + ref: ['refs/heads/master', 'refs/tags/**'], + status: ['success', 'failure'], + }, +}; + +[ + PipelineTest, + PipelineBuildPackage, + PipelineNotifications, +] diff --git a/.drone.yml b/.drone.yml index b5b642c..0a3fdfa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,35 +1,73 @@ --- kind: pipeline -name: build +name: test platform: os: linux arch: amd64 steps: - - name: build + - name: markdownlint + image: thegeeklab/markdownlint-cli + commands: + - markdownlint 'README.md' + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +--- +kind: pipeline +name: build-packages + +platform: + os: linux + arch: amd64 + +steps: + - name: build-el7 image: thegeeklab/rpmbuild:7 commands: - source /drone/src/.drone.env - rm -rf /etc/xinetd.d/ && rpmbuild -ba --without libusb1 --define "version_ $${CUPS_VERSION##v}" cups.spec - ls -l /drone/src/dist/RPMS/x86_64/ + depends_on: + - clone + + - name: build-el8 + image: thegeeklab/rpmbuild:8 + commands: + - source /drone/src/.drone.env + - rm -rf /etc/xinetd.d/ && rpmbuild -ba --without libusb1 --define "version_ $${CUPS_VERSION##v}" cups.spec + - ls -l /drone/src/dist/RPMS/x86_64/ + depends_on: + - clone - name: checksum image: alpine commands: - cd /drone/src/dist/RPMS/x86_64/ && sha256sum * > /drone/src/dist/sha256sum.txt + depends_on: + - build-el7 + - build-el8 - name: changelog-generate image: thegeeklab/git-chglog commands: - git fetch -tq - git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased} + depends_on: + - checksum - name: changelog-format image: thegeeklab/alpine-tools commands: - prettier CHANGELOG.md - prettier -w CHANGELOG.md + depends_on: + - changelog-generate - name: publish-gitea image: plugins/gitea-release @@ -46,16 +84,21 @@ steps: when: ref: - refs/tags/** + depends_on: + - changelog-format trigger: ref: - - refs/heads/main - - refs/pull/** + - refs/heads/master - refs/tags/** + - refs/pull/** + +depends_on: + - test --- kind: pipeline -name: notification +name: notifications platform: os: linux @@ -88,10 +131,11 @@ trigger: - failure depends_on: - - build + - build-package-el7 + - build-package-el8 --- kind: signature -hmac: 2f198a2cd406784b1901571b23734c06c5324a1ff36491eee93f1b729df7e598 +hmac: b143143461a0b81a3b401c00e28733d145280200c467c5f4168785db8b0c3ff8 ...