Skip to content

Build Binary

Build Binary #11049

Workflow file for this run

name: Build Binary
permissions:
contents: read
actions: write
on:
workflow_dispatch:
inputs:
features:
description: "List of features to enable"
required: false
default: ""
push:
branches:
- "main"
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "tests/fixtures/**"
- "static/**"
- ".sqlx/**"
env:
RETENTION_DAYS: 90
CACHE_SHARED_KEY: stable-release
CACHE_PATH: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
jobs:
build_binaries:
name: Build and upload
runs-on: ubuntu-22.04
timeout-minutes: 45
concurrency:
group: ${{ github.workflow }}-{{ github.run_id }}
cancel-in-progress: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.88
- name: Install libsasl2-dev libssl-dev
run: sudo apt-get update && sudo apt install -y build-essential pkg-config libssl-dev libsasl2-dev
- name: Build Release binaries
run: |
cargo build --release \
--bin stratus \
--features "$FEATURES"
env:
CARGO_PROFILE_RELEASE_DEBUG: 1
TRACING_LOG_FORMAT: json
NO_COLOR: 1
FEATURES: "${{ github.event.inputs.features || 'default' }}"
- name: Generate checksums
run: |
cd target/release
sha256sum stratus > ../../checksums.txt
- name: Upload stratus
uses: actions/upload-artifact@v4
id: upload-str
with:
name: stratus-${{ github.sha }}
path: target/release/stratus
if-no-files-found: error
retention-days: ${{ env.RETENTION_DAYS }}
- name: Upload checksums
uses: actions/upload-artifact@v4
with:
name: checksums-${{ github.sha }}
path: checksums.txt
if-no-files-found: error
retention-days: ${{ env.RETENTION_DAYS }}
- name: Print outputs
run: |
echo "Artifact ID: ${{ steps.upload-str.outputs.artifact-id }} (stratus)"
echo "Artifact URL: ${{ steps.upload-str.outputs.artifact-url }} (stratus)"