Automatically package Debian packages on release (#235)

* Add debian package generation

* Install cargo-deb on `make deb`

* Reload systemd daemon on postinst

* Add auto upload for Debian packages

* Consider using runner.os for simplicity
next
Sayan 3 years ago committed by GitHub
parent 88a8095f42
commit 2cdabfc43e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -72,12 +72,25 @@ jobs:
TARGET: ${{ matrix.rust }}
ARTIFACT: ${{ matrix.artifact }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Upload assets
- name: Build Linux packages
run: |
make deb
mv *.deb skytable-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.deb
if: runner.os == 'Linux'
- name: Upload assets (bundles)
uses: actions/upload-artifact@v2
with:
name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
- name: Upload assets (Linux packages)
uses: actions/upload-artifact@v2
with:
name: skytable-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.deb
if: runner.os == 'Linux'
build_32bit:
name: Build artifacts (32-bit)
runs-on: ${{ matrix.os }}
@ -142,12 +155,25 @@ jobs:
TARGET: ${{ matrix.rust }}
ARTIFACT: ${{ matrix.artifact }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Upload assets
- name: Build Linux packages
run: |
make deb
mv *.deb skytable-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.deb
if: runner.os == 'Linux'
- name: Upload assets (binaries)
uses: actions/upload-artifact@v2
with:
name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.zip
- name: Upload assets (Linux packages)
uses: actions/upload-artifact@v2
with:
name: skytable-${{ steps.get_version.outputs.VERSION }}-${{ matrix.artifact }}.deb
if: runner.os == 'Linux'
build_musl:
name: Build Linux x86_64-musl (Tier 2)
runs-on: ubuntu-latest
@ -191,8 +217,11 @@ jobs:
- name: Install Rust
run: rustup target add x86_64-unknown-linux-musl
- name: Make bundle
run: make bundle
- name: Make bundle and packages
run: |
make bundle
make deb
mv *.deb skytable-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.deb
env:
RUST_BACKTRACE: 1
TARGET: x86_64-unknown-linux-musl
@ -203,6 +232,12 @@ jobs:
with:
name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.zip
path: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.zip
- name: Upload assets (Linux packages)
uses: actions/upload-artifact@v2
with:
name: skytable-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.deb
build-arm64:
name: Build artifacts (self-hosted-arm64-native)
runs-on: self-hosted
@ -227,15 +262,19 @@ jobs:
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
- name: Make bundle
- name: Make bundle and packages
env:
TARGET: aarch64-unknown-linux-gnu
VERSION: ${{ steps.get_version.outputs.VERSION }}
ARTIFACT: aarch64-linux-gnu
run: make bundle
- name: Upload bundle
run: |
make bundle
make deb
mv *.deb skytable-${{ steps.get_version.outputs.VERSION }}-aarch64-linux-gnu.deb
- name: Upload bundle and packages
run: |
aws --endpoint-url ${{ secrets.STORAGE_ACCESS_URL }} s3 cp sky-bundle-${{ steps.get_version.outputs.VERSION }}-aarch64-linux-gnu.zip s3://releases/${{ steps.get_version.outputs.VERSION }}/
aws --endpoint-url ${{ secrets.STORAGE_ACCESS_URL }} s3 cp skytable-${{ steps.get_version.outputs.VERSION }}-aarch64-linux-gnu.deb s3://releases/${{ steps.get_version.outputs.VERSION }}/
release:
name: Release
@ -260,9 +299,12 @@ jobs:
- name: Download ARM64 bundle
run: |
wget https://releases.skytable.io/release/${{ steps.get_version.outputs.VERSION }}/sky-bundle-${{ steps.get_version.outputs.VERSION }}-aarch64-linux-gnu.zip
wget https://releases.skytable.io/release/${{ steps.get_version.outputs.VERSION }}/skytable-${{ steps.get_version.outputs.VERSION }}-aarch64-linux-gnu.deb
working-directory: artifacts
- name: Upload release binaries
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ steps.get_version.outputs.VERSION }}
run: hub release edit $(find . -type f -name "*.zip" -printf "-a %p ") -m "" "$TAG_NAME"
run: |
hub release edit $(find . -type f -name "*.zip" -printf "-a %p ") -m "" "$TAG_NAME"
hub release edit $(find . -type f -name "*.deb" -printf "-a %p ") -m "" "$TAG_NAME"

2
.gitignore vendored

@ -10,3 +10,5 @@ snapstore.partmap
.DS_Store
.sky_history
.sky_pid
.devcontainer
*.deb

@ -101,6 +101,12 @@ endif
@echo "Installing any additional dependencies"
@echo "===================================================================="
@$(ADDITIONAL_SOFTWARE)
deb: release
@echo "===================================================================="
@echo "Building Debian package (optimized)"
@echo "===================================================================="
@cargo $(TARGET_ARG) install cargo-deb
@cargo deb $(TARGET_ARG) --manifest-path=server/Cargo.toml --output .
build: .pre
@echo "===================================================================="
@echo "Building all binaries in debug mode (unoptimized)"

@ -0,0 +1 @@
This directory contains files used for packaging Skytable for Linux distributions.

@ -0,0 +1,15 @@
[Unit]
Description=Skytable database server daemon
After=Network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=skytable
ExecStart=/usr/bin/skyd --noart
WorkingDirectory=/var/lib/skytable
[Install]
WantedBy=multi-user.target

@ -0,0 +1,5 @@
Skytable is a free and open-source NoSQL database that aims
to provide flexibility in data modeling at scale.
The `skytable` package contains the database server (`skyd`),
an interactive command-line client (`skysh`), a benchmarking
tool (`sky-bench`) and a migration tool (`sky-migrate`).

@ -0,0 +1,15 @@
#!/bin/sh -e
systemctl daemon-reload
if [ $1 = "install" ]; then
systemctl enable skyd
fi
if [ $1 = "upgrade" ]; then
systemctl stop skyd
fi
systemctl start skyd
#DEBHELPER#

@ -0,0 +1,20 @@
#!/bin/sh -e
SKY_DIR=/var/lib/skytable
# create the data directory
if [ ! -e $SKY_DIR ]; then
mkdir $SKY_DIR
elif [ ! -d $SKY_DIR ]; then
echo "ERROR: /var/lib/skytable exists but it is not a directory" 1>&2
return 1
fi
if [ $1 = "install" ]; then
# add the `skytable` user
adduser --system --group skytable
# change ownership
chown skytable:skytable /var/lib/skytable
fi
#DEBHELPER#

@ -55,3 +55,36 @@ libc = "0.2.112"
[features]
nightly = []
[package.metadata.deb]
name = "skytable"
maintainer = "Sayan Nandan <nandansayan@outlook.com>"
copyright = "2020, Sayan Nandan <nandansayan@outlook.com>"
license-file = ["../LICENSE", "0"]
maintainer-scripts = "../pkg/debian/"
extended-description-file = "pkg/debian/description.txt"
depends = "$auto"
section = "database"
priority = "optional"
assets = [
[
"target/release/skyd",
"usr/bin/",
"755",
],
[
"target/release/skysh",
"usr/bin/",
"755",
],
[
"target/release/sky-bench",
"usr/bin/",
"755",
],
[
"../pkg/common/skyd.service",
"/etc/systemd/system/skyd.service",
"644",
],
]

Loading…
Cancel
Save