Skip to content

Crate updates

Crate updates #392

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: [v*]
pull_request:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
workflow_dispatch:
jobs:
build:
name: Build ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
# Raspberry Pi 3 or later: rustup target add aarch64-unknown-linux-gnu
# Raspberry Pi 2: rustup target add armv7-unknown-linux-gnueabihf
# Raspberry Pi Zero: rustup target add arm-unknown-linux-gnueabihf
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
target_rustflags: ''
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc'
# - target: armv7-unknown-linux-gnueabihf
# os: ubuntu-latest
# target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc'
- target: x86_64-pc-windows-msvc
os: windows-latest
target_rustflags: ''
- target: x86_64-apple-darwin
os: macOS-latest
# compile without debug symbols
target_rustflags: '-C link-arg=-s'
- target: aarch64-apple-darwin
os: macOS-latest
target_rustflags: ''
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: rustup
shell: bash
run: |
rustup toolchain install stable --profile minimal
rustup target add ${{ matrix.target }}
# Target specific tools
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" ]]; then
rustup component add clippy
elif [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
sudo apt-get install gcc-aarch64-linux-gnu
elif [[ "${{ matrix.target }}" == "armv7-unknown-linux-gnueabihf" ]]; then
sudo apt-get install gcc-arm-linux-gnueabihf
fi
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
- name: Run build
shell: bash
run: |
if [[ "${{ matrix.target }}" == "x86_64-pc-windows-msvc" ]]; then
# Skip bbox-map-server on Windows (uses Unix sockets)
RUSTFLAGS="${{ matrix.target_rustflags }}" cargo build --release --target ${{ matrix.target }} --package bbox-server --no-default-features --features=feature-server,asset-server,processes-server,tile-server,frontend
RUSTFLAGS="${{ matrix.target_rustflags }}" cargo build --release --target ${{ matrix.target }} --package bbox-tile-server --no-default-features
else
RUSTFLAGS="${{ matrix.target_rustflags }}" cargo build --release --target ${{ matrix.target }} --package bbox-server
RUSTFLAGS="${{ matrix.target_rustflags }}" cargo build --release --target ${{ matrix.target }} --package bbox-tile-server
fi
mkdir target_releases
if [[ "${{ runner.os }}" == "Windows" ]]; then
mv target/${{ matrix.target }}/release/bbox-*.exe target_releases
else
mv target/${{ matrix.target }}/release/bbox*server target_releases
fi
- name: Build (.deb)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
set -x
cargo install cargo-deb --locked
cd bbox-tile-server
cargo deb -v --deb-revision $(lsb_release -c -s)
mv ../target/debian/*.deb ../target_releases/
cargo deb -v --variant bookworm
mv ../target/debian/*.deb ../target_releases/
cargo deb -v --variant bullseye
mv ../target/debian/*.deb ../target_releases/
- name: Save build artifact build-${{ matrix.target }}
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.target }}
path: target_releases/*
test:
name: Test
needs: [build]
runs-on: ubuntu-latest
services:
postgres:
image: sourcepole/mvtbenchdb:v1.2
ports:
- 5439:5432
steps:
- name: Checkout sources
uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Unit Tests (Linux)
run: |
cargo test --all
- name: DB Tests (Linux)
run: |
cargo test --all -- --ignored
package:
name: Package
runs-on: ubuntu-latest
needs: [test]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download built artifact build-x86_64-unknown-linux-gnu
uses: actions/download-artifact@v4
with:
name: build-x86_64-unknown-linux-gnu
path: target/x86_64-unknown-linux-gnu
- name: Download built artifact build-aarch64-unknown-linux-gnu
uses: actions/download-artifact@v4
with:
name: build-aarch64-unknown-linux-gnu
path: target/aarch64-unknown-linux-gnu
- name: Download built artifact build-x86_64-pc-windows-msvc
uses: actions/download-artifact@v4
with:
name: build-x86_64-pc-windows-msvc
path: target/x86_64-pc-windows-msvc
- name: Download built artifact build-x86_64-apple-darwin
uses: actions/download-artifact@v4
with:
name: build-x86_64-apple-darwin
path: target/x86_64-apple-darwin
- name: Download built artifact build-aarch64-apple-darwin
uses: actions/download-artifact@v4
with:
name: build-aarch64-apple-darwin
path: target/aarch64-apple-darwin
- name: Package
run: |
set -x
cd target
mkdir files
mv x86_64-unknown-linux-gnu/*.deb files/
for dist in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu x86_64-apple-darwin aarch64-apple-darwin; do
cd $dist
chmod +x *
tar czvf ../files/bbox-server-$dist.tar.gz bbox-server
tar czvf ../files/bbox-tile-server-$dist.tar.gz bbox-tile-server
cd ..
done
cd x86_64-pc-windows-msvc
7z a ../files/bbox-server-x86_64-pc-windows-msvc.zip bbox-server.exe
7z a ../files/bbox-tile-server-x86_64-pc-windows-msvc.zip bbox-tile-server.exe
cd ..
- name: Generate Changelog
run: echo "See [CHANGELOG](https://github.com/bbox-services/bbox/blob/main/CHANGELOG.md#xzy-betax-$(date +'%Y-%m-%d'))" > ${{ github.workspace }}-CHANGELOG.txt
- name: Publish
uses: softprops/action-gh-release@v2
with:
draft: true
files: 'target/files/*'
body_path: ${{ github.workspace }}-CHANGELOG.txt