-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debian & Arch release pipeline (#9)
- Loading branch information
Showing
8 changed files
with
191 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
name: Continuous integration | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- 1.69.0 # MSRV | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/release | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: System dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y sudo \ | ||
make | ||
mkdir -p ~/.cargo/release | ||
- name: Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
components: rustfmt, clippy | ||
|
||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
|
||
- name: Create Debian package | ||
env: | ||
DESTDIR: '~/kinesis-tailr-deb' | ||
run: | | ||
mkdir -p $DESTDIR | ||
RELEASE_VERSION=${{ github.event.release.tag_name }} DESTDIR=$DESTDIR make debian-pkg | ||
- name: Upload Debian release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: '${{ github.event.release.upload_url }}' | ||
asset_path: 'kinesis-tailr-${{ github.event.release.tag_name }}-x86_64.deb' | ||
asset_name: 'kinesis-tailr-${{ github.event.release.tag_name }}-x86_64.deb' | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Debian release checksum | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: '${{ github.event.release.upload_url }}' | ||
asset_path: 'kinesis-tailr-${{ github.event.release.tag_name }}-x86_64.deb.md5sum' | ||
asset_name: 'kinesis-tailr-${{ github.event.release.tag_name }}-x86_64.deb.md5sum' | ||
asset_content_type: text/plain | ||
|
||
arch: | ||
runs-on: ubuntu-latest | ||
needs: [ci] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Prepare arch package metadata | ||
run: | | ||
wget https://github.com/grumlimited/kinesis-tailr/releases/download/${{ github.event.release.tag_name }}/kinesis-tailr-${{ github.event.release.tag_name }}-x86_64.deb -O build-aux/arch/kinesis-tailr-bin/kinesis-tailr-${{ github.event.release.tag_name }}-x86_64.deb | ||
MD5_SUM=$(md5sum build-aux/arch/kinesis-tailr-bin/kinesis-tailr-${{ github.event.release.tag_name }}-x86_64.deb | awk '{print $1}') | ||
awk -v q="'" -v MD5_SUM=$MD5_SUM -i inplace 'BEGINFILE{print "md5sums=(" q MD5_SUM q ")"}{print}' build-aux/arch/kinesis-tailr-bin/PKGBUILD | ||
awk -i inplace 'BEGINFILE{print "pkgver=${{ github.event.release.tag_name }}"}{print}' build-aux/arch/kinesis-tailr-bin/PKGBUILD | ||
- name: Validate PKGBUILD | ||
id: validate-pkgbuild | ||
uses: grumlimited/arch-pkgbuild-builder@b0f22da174699e6795f4434f252e15e6c8265b9e | ||
with: | ||
debug: true | ||
target: pkgbuild | ||
pkgname: build-aux/arch/kinesis-tailr-bin/ | ||
|
||
- name: Create arch package checksum file | ||
run: | | ||
sudo chown -R $USER . | ||
md5sum build-aux/arch/kinesis-tailr-bin/*.zst >> build-aux/arch/kinesis-tailr-bin/kinesis-tailr-bin-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.zst.md5sum | ||
- name: Upload Arch Linux release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: '${{ github.event.release.upload_url }}' | ||
asset_path: 'build-aux/arch/kinesis-tailr-bin/kinesis-tailr-bin-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.zst' | ||
asset_name: 'kinesis-tailr-bin-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.zst' | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Arch Linux release checksum | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: '${{ github.event.release.upload_url }}' | ||
asset_path: 'build-aux/arch/kinesis-tailr-bin/kinesis-tailr-bin-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.zst.md5sum' | ||
asset_name: 'kinesis-tailr-bin-${{ github.event.release.tag_name }}-1-x86_64.pkg.tar.zst.md5sum' | ||
asset_content_type: text/plain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ | |
|
||
rpmbuild/RPMS | ||
rpmbuild/SRPMS | ||
*.deb | ||
*.md5sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,10 @@ | ||
FROM amd64/centos:7 | ||
FROM library/rust:1.69.0-slim-buster | ||
|
||
ARG USER=grumlimited | ||
ARG GROUP=grumlimited | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
RUN apt-get update && \ | ||
apt-get install -y make sudo | ||
|
||
ENV HOME=/home/$USER | ||
|
||
# https://stackoverflow.com/questions/74345206/centos-7-docker-yum-installation-gets-stuck | ||
RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' > /etc/nsswitch.conf | ||
WORKDIR /kinesis-tailr | ||
|
||
RUN groupadd -g $GID $USER && \ | ||
useradd $USER -d $HOME -g $GID -u $UID && \ | ||
chown -R $USER:$GROUP $HOME | ||
ENTRYPOINT ["make", "debian-pkg", "RELEASE_VERSION=0.1", "DESTDIR=build"] | ||
|
||
|
||
RUN ulimit -n 1024 && yum install -y epel-release | ||
RUN ulimit -n 1024 && yum install -y epel-release && \ | ||
yum update -y && \ | ||
yum install -y rpm-build rust make cargo | ||
|
||
USER $USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Maintainer: Romain Gallet <[email protected]> | ||
# Contributor: Romain Gallet <[email protected]> | ||
_packager="Romain Gallet <[email protected]>" | ||
_deb_pkgname=kinesis-tailr | ||
pkgname=kinesis-tailr-bin | ||
pkgrel=1 | ||
pkgdesc='Kinesis tail tool' | ||
arch=('x86_64') | ||
url="https://github.com/grumlimited/$_deb_pkgname" | ||
license=('GPLv3') | ||
groups=() | ||
depends=() | ||
makedepends=() | ||
checkdepends=() | ||
optdepends=() | ||
provides=() | ||
replaces=() | ||
backup=() | ||
options=() | ||
source=("$url/releases/download/$pkgver/$_deb_pkgname-$pkgver-$arch.deb") | ||
noextract=() | ||
|
||
build() { | ||
rm control.tar.zst | ||
tar xvf data.tar.zst | ||
} | ||
|
||
package() { | ||
cp -fr usr/ ${pkgdir} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Package: kinesis-tailr | ||
Section: development | ||
Priority: optional | ||
Architecture: all | ||
Maintainer: rgallet_at_grumlimited.co.uk | ||
Description: Kinesis tail tool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
chmod +x /usr/bin/kinesis-tailr | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: '3' | ||
services: | ||
rust: | ||
build: . | ||
# entrypoint: ['/bin/sleep', '60000'] | ||
volumes: | ||
- '.:/kinesis-tailr' | ||
- '~/.cargo:/root/.cargo' |