Skip to content

Commit

Permalink
Add debian build matrix and rpm package
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Sep 22, 2021
1 parent 76d3063 commit f04ae2d
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 36 deletions.
125 changes: 90 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,72 @@ jobs:
run: cargo build --release --no-default-features

- name: Tar
id: tar
shell: bash
run: |
VERSION=$(basename ${{ github.ref }})
target=$(gcc -dumpmachine)
cd target/release
strip t_rex
tar czf ../../t-rex-$VERSION-$target.tar.gz t_rex
echo "##[set-output name=tgz;]t-rex-$VERSION-$target.tar.gz"
- name: Upload Release Asset
id: upload-release-asset
uses: softprops/action-gh-release@v1
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
files: ${{ steps.tar.outputs.tgz }}
body: |
See [CHANGELOG](https://github.com/t-rex-tileserver/t-rex/blob/master/CHANGELOG.md)
draft: true
prerelease: true
name: ${{ github.run_id }}
path: t-rex-*.tar.gz
retention-days: 1

deb:
name: Build deb package
outputs:
asset_download_url: ${{ steps.upload_asset.outputs.upload_url }}
runs-on: ${{ matrix.os }}
runs-on: ubuntu-20.04
container: ${{ matrix.container }}
strategy:
matrix:
os: ['ubuntu-20.04']
include:
- variant: focal
container: null
sudo: sudo
- variant: bullseye
container: rust:bullseye
sudo: null
- variant: buster
container: rust:buster
sudo: null
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install cargo-deb
run: cargo install cargo-deb

- name: Install build-dependencies
run: |
${{ matrix.sudo }} apt update
${{ matrix.sudo }} apt install -y libgdal-dev
- name: Build & package
run: |
cargo deb --variant=${{ matrix.variant }}
dpkg -I target/debian/t-rex*.deb
dpkg -c target/debian/t-rex*.deb
- name: Install package
run: ${{ matrix.sudo }} dpkg -i target/debian/*.deb

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.run_id }}
path: target/debian/*.deb
retention-days: 1

rpm:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
matrix:
container: ['centos:8']
steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

- name: Install toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -65,27 +100,28 @@ jobs:
toolchain: stable
override: true

- name: Install libgdal-dev
run: sudo apt update && sudo apt install -y libgdal-dev

- run: cargo install cargo-deb
- name: Install cargo-rpm
run: |
yum install gcc rpm-build -y
cargo install cargo-rpm
- name: cargo deb
- name: Install build-dependencies
run: |
cargo deb --variant focal
dpkg -I target/debian/t-rex*.deb
dpkg -c target/debian/t-rex*.deb
# yum install epel-release -y
yum install openssl-devel -y
# yum install gdal-devel -y
cargo deb --variant buster
cargo deb --variant bullseye
- name: Build & package
run: |
ln -s packaging/rpm .rpm
cargo rpm build --output target/rpm/
- name: Upload Release Asset
id: upload_asset
uses: softprops/action-gh-release@v1
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
files: target/debian/*deb
draft: true
prerelease: true
name: ${{ github.run_id }}
path: target/rpm/*.rpm
retention-days: 1

msi:
name: Build MSI
Expand Down Expand Up @@ -130,10 +166,29 @@ jobs:
"$WIX/bin/candle" -nologo t-rex.wxs
"$WIX/bin/light" -nologo -dBuildDir=$RELEASE_DIR -dGdalSrcDir=$GDAL_HOME/bin -sice:ICE80 -o t-rex-$VERSION.msi t-rex.wixobj gdal.wixobj
- name: Upload Release Asset
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.run_id }}
path: packaging/windows/t-rex-*.msi
retention-days: 1

release:
needs: [tgz, deb, rpm, msi]
runs-on: ubuntu-latest
steps:
- name: Retrieve saved artefacts
uses: actions/download-artifact@v2
with:
name: ${{ github.run_id }}
path: packages

- name: Release
uses: softprops/action-gh-release@v1
with:
files: packaging/windows/t-rex-*.msi
body: |
See [CHANGELOG](https://github.com/t-rex-tileserver/t-rex/blob/master/CHANGELOG.md)
files: packages/*
draft: true
prerelease: true

Expand Down
12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "t-rex"
version = "0.14.1-pre5"
version = "0.14.1-pre6"
description = "t-rex vector tile server"
repository = "https://github.com/t-rex-tileserver/t-rex"
readme = "README.md"
Expand Down Expand Up @@ -58,3 +58,13 @@ revision = "1~buster"
[package.metadata.deb.variants.bullseye]
depends = "libssl1.1, libgdal28"
revision = "1~bullseye"

[package.metadata.rpm]
package = "t-rex"
config = "packaging/rpm/t-rex.spec"

[package.metadata.rpm.cargo]
buildflags = ["--release", "--no-default-features"]

[package.metadata.rpm.targets]
t_rex = { path = "/usr/bin/t_rex" }
31 changes: 31 additions & 0 deletions packaging/rpm/t-rex.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
%define __spec_install_post %{nil}
%define __os_install_post %{_dbpath}/brp-compress
%define debug_package %{nil}

Name: t-rex
Summary: t-rex vector tile server
Version: @@VERSION@@
Release: @@RELEASE@@%{?dist}
License: MIT
Group: Applications/System
Source0: %{name}-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
%{summary}

%prep
%setup -q

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
cp -a * %{buildroot}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{_bindir}/*

1 comment on commit f04ae2d

@tobwen
Copy link
Contributor

@tobwen tobwen commented on f04ae2d Sep 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #259

Please sign in to comment.