Skip to content

Add T1C timestamps (#2946) #79

Add T1C timestamps (#2946)

Add T1C timestamps (#2946) #79

Workflow file for this run

name: Release
permissions: {}
on:
push:
branches:
- "rc/*"
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g., v0.1.0)"
required: true
type: string
profile:
description: "Build profile"
default: "profiling"
type: choice
options:
- "release"
- "profiling"
- "maxperf"
dry_run:
description: "Dry run (build binaries without creating release)"
default: false
type: boolean
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
RUSTC_WRAPPER: "sccache"
jobs:
get-version:
name: Get Version
runs-on: ubuntu-latest
permissions: {}
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version from tag or branch
id: get_version
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_TAG: ${{ inputs.tag }}
SHA: ${{ github.sha }}
run: |
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
echo "version=$INPUT_TAG" >> $GITHUB_OUTPUT
elif [[ "$GITHUB_REF" == refs/heads/rc/* ]]; then
echo "version=sha-${SHA::7}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
check-version:
name: check version
runs-on: ubuntu-latest
needs: get-version
if: ${{ !startsWith(github.ref, 'refs/heads/rc/') && github.event.inputs.dry_run != 'true' }}
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- name: Verify crate version matches tag
# Check that the Cargo version starts with the tag,
# so that Cargo version 1.4.8 can be matched against both v1.4.8 and v1.4.8-rc.1
run: |
tag="${{ needs.get-version.outputs.version }}"
tag=${tag#v}
cargo_ver=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
[[ "$tag" == "$cargo_ver"* ]] || { echo "Tag $tag doesn't match the Cargo version $cargo_ver"; exit 1; }
build-release:
name: Build Release Binaries
needs: get-version
environment: release
runs-on: ${{ matrix.platform.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
binary:
- name: tempo
features: "asm-keccak,jemalloc,otlp"
- name: tempo-bench
features: ""
- name: tempo-sidecar
features: ""
platform:
- os: depot-ubuntu-latest-16
target: x86_64-unknown-linux-gnu
- os: depot-ubuntu-latest-arm-16
target: aarch64-unknown-linux-gnu
- os: depot-macos-15
target: aarch64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}
- name: Setup mold linker
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
- name: Setup sccache
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
- name: Get build profile
id: profile
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "profile=${{ inputs.profile }}" >> $GITHUB_OUTPUT
else
echo "profile=maxperf" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Build binary
run: cargo build --bin ${{ matrix.binary.name }} --features "${{ matrix.binary.features }}" --profile ${{ steps.profile.outputs.profile }} --target ${{ matrix.platform.target }}
env:
CARGO_TARGET_DIR: target
- name: Prepare binary
id: prepare
shell: bash
run: |
PROFILE="${{ steps.profile.outputs.profile }}"
if [ "$PROFILE" = "dev" ]; then
PROFILE_DIR="debug"
else
PROFILE_DIR="$PROFILE"
fi
BINARY_PATH="target/${{ matrix.platform.target }}/${PROFILE_DIR}/${{ matrix.binary.name }}"
BINARY_NAME="${{ matrix.binary.name }}-${{ needs.get-version.outputs.version }}-${{ matrix.platform.target }}"
ARCHIVE_NAME="${{ matrix.binary.name }}-${{ needs.get-version.outputs.version }}-${{ matrix.platform.target }}.tar.gz"
cp "$BINARY_PATH" "$BINARY_NAME"
tar czf "$ARCHIVE_NAME" "$BINARY_NAME"
echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT
echo "archive_path=$ARCHIVE_NAME" >> $GITHUB_OUTPUT
- name: Generate checksums
shell: bash
run: |
shasum -a 256 "${{ steps.prepare.outputs.archive_path }}" > "${{ steps.prepare.outputs.archive_name }}.sha256"
- name: GPG sign archive
shell: bash
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
GNUPGHOME=$(mktemp -d)
export GNUPGHOME
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --batch --import
printf '%s' "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab "${{ steps.prepare.outputs.archive_path }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary.name }}-${{ matrix.platform.target }}
path: |
${{ steps.prepare.outputs.archive_path }}
${{ steps.prepare.outputs.archive_name }}.sha256
${{ steps.prepare.outputs.archive_name }}.asc
if-no-files-found: error
create-release:
name: Create Release
needs: [get-version, build-release]
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false) }}
runs-on: depot-ubuntu-latest
permissions:
contents: write
actions: read
steps:
# This is necessary for generating the changelog.
# It has to come before "Download Artifacts" or else it deletes the artifacts.
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.get-version.outputs.version }}
run: |
# Determine if this is a prerelease
PRERELEASE=""
if echo "$VERSION" | grep -qE '(alpha|beta|rc)'; then
PRERELEASE="--prerelease"
fi
# Create draft release with all artifacts
gh release create "$VERSION" \
--repo ${{ github.repository }} \
--title "Release $VERSION" \
--draft \
--notes "" \
$PRERELEASE \
artifacts/**/*
upload-cloudflare:
name: Upload to R2 bucket
needs: [get-version, build-release]
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false) }}
runs-on: depot-ubuntu-latest
permissions:
contents: read
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create binary directory
env:
VERSION: ${{ needs.get-version.outputs.version }}
run: |
mkdir $VERSION
mv artifacts/**/* $VERSION/
- uses: shallwefootball/s3-upload-action@4350529f410221787ccf424e50133cbc1b52704e # v1.3.3
with:
aws_key_id: ${{ secrets.R2_BINARIES_KEY_ID }}
aws_secret_access_key: ${{ secrets.R2_BINARIES_SECRET_KEY }}
aws_bucket: ${{ secrets.R2_BINARIES_BUCKET }}
endpoint: ${{ secrets.R2_BINARIES_ENDPOINT }}
source_dir: "${{ needs.get-version.outputs.version }}"
destination_dir: "binaries/${{ needs.get-version.outputs.version }}"