name: Rust
on:
push:
branches: ["main", "v2"]
paths:
- "**/*.rs"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- ".cargo/**"
- "Makefile"
- ".github/workflows/rust.yml"
pull_request:
branches: ["main", "v2"]
paths:
- "**/*.rs"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- ".cargo/**"
- "Makefile"
- ".github/workflows/rust.yml"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
TZF_REF: embedded
TZF_DIST_REF: v2-artifacts
TBB_VERSION: 2026c
permissions:
contents: write
deployments: write
concurrency:
group: publish-${{ github.ref_name }}
cancel-in-progress: false
defaults:
run:
working-directory: tzf-rs
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Collect Workflow Telemetry
uses: runforesight/workflow-telemetry-action@v2
with:
comment_on_pr: false
- uses: actions/checkout@v7
with:
path: tzf-rs
- name: Does this manifest still need the sibling tzf-dist bootstrap?
id: data
run: |
if grep -Eq '^[[:space:]]*tzf-dist[[:space:]]*=.*path[[:space:]]*=' Cargo.toml; then
echo "bootstrap=true" >> "$GITHUB_OUTPUT"
else
echo "bootstrap=false" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v7
if: steps.data.outputs.bootstrap == 'true'
with:
repository: ringsaturn/tzf
ref: ${{ env.TZF_REF }}
path: tzf
- uses: actions/checkout@v7
if: steps.data.outputs.bootstrap == 'true'
with:
repository: ringsaturn/tzf-dist
ref: ${{ env.TZF_DIST_REF }}
path: tzf-dist
- uses: actions/setup-go@v5
if: steps.data.outputs.bootstrap == 'true'
with:
go-version-file: tzf/go.mod
cache-dependency-path: tzf/go.sum
- name: Cache tzf-dist artifact build
if: steps.data.outputs.bootstrap == 'true'
uses: actions/cache@v4
with:
path: tzf/tmp/tzf-dist-dev
key: tzf-dist-dev-${{ env.TBB_VERSION }}-${{ hashFiles('tzf/scripts/build-tzf-dist-dev.sh', 'tzf/internal/**', 'tzf/cmd/**') }}
- name: Build and install tzf-dist artifacts
if: steps.data.outputs.bootstrap == 'true'
working-directory: tzf
run: ./scripts/build-tzf-dist-dev.sh
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
workspaces: tzf-rs
- run: make ci
- name: Publish benchmark summary to job summary
if: always()
run: |
if [ -f benchmark_summary.md ]; then
cat benchmark_summary.md >> "$GITHUB_STEP_SUMMARY"
else
echo "benchmark_summary.md not found." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload benchmark summary artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: benchmark_summary
path: |
tzf-rs/benchmark_summary.md
tzf-rs/benchmark_result.txt
tzf-rs/benchmark_full_result.txt
- name: Upload criterion results artifact
uses: actions/upload-artifact@v7
with:
name: criterion_result
path: tzf-rs/target/criterion