Build/archive package for both Postgres and SQLite (#540)

This commit is contained in:
Julien Catalano 2024-10-17 16:39:49 +02:00 committed by GitHub
parent 6621a23652
commit d69f18edad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 9 deletions

View File

@ -54,6 +54,13 @@ jobs:
needs: tests needs: tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
database:
- postgres
- sqlite
env:
DATABASE: ${{ matrix.database }}
steps: steps:
- -
name: Checkout name: Checkout

View File

@ -238,6 +238,17 @@
maintainer-scripts = "debian/" maintainer-scripts = "debian/"
systemd-units = { enable = true } systemd-units = { enable = true }
[package.metadata.deb.variants.postgres]
name = "chirpstack"
suggests = "postgresql, mosquitto, redis"
conflicts = "chirpstack-sqlite"
[package.metadata.deb.variants.sqlite]
default-features = false
features = ["sqlite"]
suggests = "mosquitto, redis"
conflicts = "chirpstack"
[package.metadata.generate-rpm] [package.metadata.generate-rpm]
auto-req = "no" auto-req = "no"
@ -259,3 +270,13 @@ chmod 640 /etc/chirpstack/*.toml
{ source = "configuration/*", dest = "/etc/chirpstack" }, { source = "configuration/*", dest = "/etc/chirpstack" },
{ source = "rpm/chirpstack.service", dest = "/lib/systemd/system/chirpstack.service" }, { source = "rpm/chirpstack.service", dest = "/lib/systemd/system/chirpstack.service" },
] ]
[package.metadata.generate-rpm.variants.postgres]
name = "chirpstack"
[package.metadata.generate-rpm.variants.postgres.conflicts]
chirpstack-sqlite = "*"
[package.metadata.generate-rpm.variants.sqlite]
name = "chirpstack-sqlite"
[package.metadata.generate-rpm.variants.sqlite.conflicts]
chirpstack = "*"

View File

@ -17,13 +17,13 @@ dist:
cross build --target x86_64-unknown-linux-musl --release --no-default-features --features="$(DATABASE)" cross build --target x86_64-unknown-linux-musl --release --no-default-features --features="$(DATABASE)"
cross build --target armv7-unknown-linux-musleabihf --release --no-default-features --features="$(DATABASE)" cross build --target armv7-unknown-linux-musleabihf --release --no-default-features --features="$(DATABASE)"
cargo deb --target x86_64-unknown-linux-musl --no-build --no-strip cargo deb --target x86_64-unknown-linux-musl --no-build --no-strip --variant="$(DATABASE)"
cargo deb --target armv7-unknown-linux-musleabihf --no-build --no-strip cargo deb --target armv7-unknown-linux-musleabihf --no-build --no-strip --variant="$(DATABASE)"
cargo deb --target aarch64-unknown-linux-musl --no-build --no-strip cargo deb --target aarch64-unknown-linux-musl --no-build --no-strip --variant="$(DATABASE)"
cargo generate-rpm --target x86_64-unknown-linux-musl --target-dir ../target cargo generate-rpm --target x86_64-unknown-linux-musl --target-dir ../target --variant="$(DATABASE)"
cargo generate-rpm --target armv7-unknown-linux-musleabihf --target-dir ../target cargo generate-rpm --target armv7-unknown-linux-musleabihf --target-dir ../target --variant="$(DATABASE)"
cargo generate-rpm --target aarch64-unknown-linux-musl --target-dir ../target cargo generate-rpm --target aarch64-unknown-linux-musl --target-dir ../target --variant="$(DATABASE)"
mkdir -p ../dist mkdir -p ../dist
@ -35,9 +35,9 @@ dist:
cp ../target/armv7-unknown-linux-musleabihf/generate-rpm/*.rpm ../dist cp ../target/armv7-unknown-linux-musleabihf/generate-rpm/*.rpm ../dist
cp ../target/aarch64-unknown-linux-musl/generate-rpm/*.rpm ../dist cp ../target/aarch64-unknown-linux-musl/generate-rpm/*.rpm ../dist
tar -czvf ../dist/chirpstack_$(PKG_VERSION)_amd64.tar.gz -C ../target/x86_64-unknown-linux-musl/release chirpstack tar -czvf ../dist/chirpstack_$(PKG_VERSION)_$(DATABASE)_amd64.tar.gz -C ../target/x86_64-unknown-linux-musl/release chirpstack
tar -czvf ../dist/chirpstack_$(PKG_VERSION)_armv7hf.tar.gz -C ../target/armv7-unknown-linux-musleabihf/release chirpstack tar -czvf ../dist/chirpstack_$(PKG_VERSION)_$(DATABASE)_armv7hf.tar.gz -C ../target/armv7-unknown-linux-musleabihf/release chirpstack
tar -czvf ../dist/chirpstack_$(PKG_VERSION)_arm64.tar.gz -C ../target/aarch64-unknown-linux-musl/release chirpstack tar -czvf ../dist/chirpstack_$(PKG_VERSION)_$(DATABASE)_arm64.tar.gz -C ../target/aarch64-unknown-linux-musl/release chirpstack
test: test:
cargo fmt --check cargo fmt --check