Release v0.3.12 #1201
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bencher | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main, devel] | |
tags: [v**] | |
pull_request: | |
branches: [main, devel] | |
env: | |
# General | |
CARGO_TERM_COLOR: always | |
GITHUB_REGISTRY: ghcr.io | |
FLY_REGISTRY: registry.fly.io | |
MOLD_VERSION: 2.0.0 | |
# API | |
API_BUILDER_DOCKER_IMAGE: bencher-api-builder | |
API_LOCAL_DOCKER_IMAGE: bencher-api-local | |
API_LITESTREAM_DOCKER_IMAGE: bencher-api-litestream | |
# CLI | |
CLI_BIN_NAME: bencher | |
CLI_BIN_ARCH: amd64 | |
CLI_DEB_DIR: deb | |
# Use minimum supported glibc version for Rust Tier 1 | |
# https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-1-with-host-tools | |
GLIBC_VERSION: 2.17 | |
# WASM | |
WASM_BENCHER_VALID: bencher-valid-pkg | |
# UI | |
UI_BUILDER_DOCKER_IMAGE: bencher-ui-builder | |
UI_DOCKER_IMAGE: bencher-ui | |
UI_BUILD_DIST: bencher-ui-dist | |
# Analytics | |
GOOGLE_ANALYTICS_ID: G-9Q5Q2QS45K | |
jobs: | |
first_time_interaction: | |
name: Bencher First Time Interaction | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/first-interaction@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
issue-message: |- | |
🐰 Congratulations on your first issue! 🎉 | |
If you haven't already, hop on over to our [Discord server](https://discord.gg/yGEsdUh7R4). | |
<br /> | |
<p align="center"><a href="https://discord.gg/yGEsdUh7R4"><img src="https://s3.amazonaws.com/public.bencher.dev/discord_invite.png" alt="Bencher Discord Server" /></a></p> | |
pr-message: |- | |
🐰 Congratulations on your first PR! 🎉 | |
If you haven't already, hop on over to our [Discord server](https://discord.gg/yGEsdUh7R4). | |
<br /> | |
<p align="center"><a href="https://discord.gg/yGEsdUh7R4"><img src="https://s3.amazonaws.com/public.bencher.dev/discord_invite.png" alt="Bencher Discord Server" /></a></p> | |
bencher_github_action: | |
name: Bencher CLI GitHub Action | |
runs-on: ubuntu-latest | |
# This will fail during releases builds | |
# because the version number requested is for the current, in progress release | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build next Bencher CLI GitHub Action | |
working-directory: ./services/action | |
run: | | |
npm install --include=dev | |
npm run build | |
- uses: bencherdev/bencher@main | |
- name: Run current Bencher CLI GitHub Action | |
run: bencher run --project bencher --dry-run "bencher mock" | |
# Pretty Rust | |
cargo_fmt: | |
name: Cargo Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add fmt | |
run: rustup component add rustfmt | |
- name: Run fmt | |
run: cargo fmt -- --check | |
cargo_clippy: | |
name: Cargo Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: Add clippy | |
run: rustup component add clippy | |
- name: Run clippy | |
run: cargo clippy --no-deps -- -Dwarnings | |
# Cargo Test | |
cargo_test: | |
name: Cargo Test | |
runs-on: ubuntu-latest | |
needs: | |
- cargo_fmt | |
- cargo_clippy | |
env: | |
TEST_BILLING_KEY: ${{ secrets.TEST_BILLING_KEY }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: cargo test | |
run: RUST_BACKTRACE=1 cargo test -- --nocapture | |
- name: Upload Perf JPEG | |
uses: actions/upload-artifact@v3 | |
with: | |
name: perf.jpeg | |
path: ./lib/bencher_plot/perf.jpeg | |
# API Smoke Test | |
api_smoke_test: | |
name: API Smoke Test | |
runs-on: ubuntu-latest | |
needs: | |
- cargo_fmt | |
- cargo_clippy | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: Install `bencher` CLI | |
run: cargo install --path services/cli --locked | |
- name: Run API Smoke Test | |
run: ./scripts/smoke_test.sh | |
api_smoke_test_compat: | |
name: API Smoke Test Compat | |
runs-on: ubuntu-latest | |
needs: | |
- cargo_fmt | |
- cargo_clippy | |
# This will fail whenever there is a breaking change in the API | |
# Pre-1.0 this is okay but good to be aware of | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- uses: bencherdev/bencher@main | |
- name: Run API Smoke Test | |
run: ./scripts/smoke_test.sh | |
# Cargo Check (Minus) | |
cargo_check_api_minus: | |
name: Cargo Check API (Minus) | |
runs-on: ubuntu-latest | |
needs: | |
- cargo_fmt | |
- cargo_clippy | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: cargo check | |
working-directory: ./services/api | |
run: cargo check --no-default-features | |
cargo_check_cli_minus: | |
name: Cargo Check CLI (Minus) | |
runs-on: ubuntu-latest | |
needs: | |
- cargo_fmt | |
- cargo_clippy | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: cargo check | |
working-directory: ./services/cli | |
run: cargo check --no-default-features | |
# Cargo Benchmark | |
cargo_bench: | |
name: Cargo Bench | |
runs-on: ubuntu-latest | |
# This will fail whenever Bencher Cloud is down | |
# or there are any breaking changes to the report format | |
continue-on-error: true | |
env: | |
BENCHER_PROJECT: bencher | |
BENCHER_TESTBED: ubuntu-latest | |
BENCHER_ADAPTER: rust | |
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: Install `bencher` CLI | |
run: cargo install --path services/cli --locked | |
- name: Dogfooding Benchmarks with Bencher | |
run: | | |
bencher run \ | |
--if-branch "$GITHUB_REF_NAME" \ | |
--else-if-branch "$GITHUB_BASE_REF" \ | |
--err \ | |
--github-actions ${{ secrets.GITHUB_TOKEN }} \ | |
"cargo bench --package bencher_adapter" | |
# Cargo Audit | |
cargo_audit: | |
name: Cargo Audit | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- uses: actions-rs/audit-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# Cargo Unused Deps | |
cargo_udeps: | |
name: Cargo Unused Deps | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: Install nightly toolchain | |
run: rustup toolchain install nightly | |
- name: Install udeps | |
run: cargo install --version 0.1.40 --locked cargo-udeps | |
- name: Run udeps | |
run: cargo +nightly udeps | |
# Pretty JS | |
npx_rome_format: | |
name: Rome Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Rome format Action | |
working-directory: ./services/action | |
run: | | |
npm install --include=dev | |
npx rome ci --linter-enabled false . | |
# - name: Rome format UI | |
# working-directory: ./services/ui | |
# run: | | |
# npm install --include=dev | |
# npx rome ci --linter-enabled false . | |
- name: Rome format Console UI | |
working-directory: ./services/console | |
run: | | |
npm install --include=dev | |
npx rome ci --linter-enabled false . | |
npx_rome_lint: | |
name: Rome Lint | |
runs-on: ubuntu-latest | |
# TODO fix all lints | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Rome check Action | |
working-directory: ./services/action | |
run: | | |
npm install --include=dev | |
npx rome ci --formatter-enabled false . | |
# - name: Rome check UI | |
# working-directory: ./services/ui | |
# run: | | |
# npm install --include=dev | |
# npx rome ci --formatter-enabled false . | |
- name: Rome check Console UI | |
working-directory: ./services/console | |
run: | | |
npm install --include=dev | |
npx rome ci --formatter-enabled false . | |
# UI WASM | |
build_bencher_valid_wasm: | |
name: Build `bencher_valid` WASM | |
runs-on: ubuntu-latest | |
env: | |
WASM_PACK_BUILD: "wasm-pack build --target web --no-default-features --features plus,wasm" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: jetli/[email protected] | |
- name: WASM pack `bencher_valid` | |
working-directory: ./lib/bencher_valid | |
run: | | |
$WASM_PACK_BUILD || \ | |
$WASM_PACK_BUILD || \ | |
$WASM_PACK_BUILD | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.WASM_BENCHER_VALID }} | |
path: ./lib/bencher_valid/pkg | |
test_bencher_valid_wasm: | |
name: Test `bencher_valid` WASM | |
runs-on: ubuntu-latest | |
needs: | |
- cargo_fmt | |
- cargo_clippy | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: cargo test `bencher_valid` WASM | |
working-directory: ./lib/bencher_valid | |
run: cargo test --no-default-features --features plus,wasm | |
# NPM Test | |
npx_vitest: | |
name: vitest | |
runs-on: ubuntu-latest | |
needs: | |
- cargo_fmt | |
- cargo_clippy | |
- npx_rome_format | |
- npx_rome_lint | |
- build_bencher_valid_wasm | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download `bencher_valid` Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.WASM_BENCHER_VALID }} | |
path: ./lib/bencher_valid/pkg | |
# - name: npx vitest | |
# working-directory: ./services/ui | |
# run: | | |
# npm install --include=dev | |
# npx vitest run | |
- name: npx vitest | |
working-directory: ./services/console | |
run: | | |
npm install --include=dev | |
npx vitest run | |
# API Docker | |
build_local_api_docker: | |
name: Build Local API | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Builder Stage | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./services/api/builder.Dockerfile | |
tags: ${{ env.API_BUILDER_DOCKER_IMAGE }} | |
build-args: | | |
MOLD_VERSION=${{ env.MOLD_VERSION }} | |
push: false | |
- name: Build Local API | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./services/api | |
file: ./services/api/local.Dockerfile | |
tags: ${{ env.API_LOCAL_DOCKER_IMAGE }} | |
push: false | |
- name: Save Local API | |
run: | | |
docker save ${{ env.API_LOCAL_DOCKER_IMAGE }} \ | |
| gzip > ${{ env.API_LOCAL_DOCKER_IMAGE }}.tar.gz | |
- name: Upload Local API Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.API_LOCAL_DOCKER_IMAGE }}.tar.gz | |
path: ./${{ env.API_LOCAL_DOCKER_IMAGE }}.tar.gz | |
build_litestream_api_docker: | |
name: Build Litestream API | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Builder Stage | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./services/api/builder.Dockerfile | |
tags: ${{ env.API_BUILDER_DOCKER_IMAGE }} | |
build-args: | | |
MOLD_VERSION=${{ env.MOLD_VERSION }} | |
push: false | |
- name: Build Litestream API | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./services/api | |
file: ./services/api/litestream.Dockerfile | |
tags: ${{ env.API_LITESTREAM_DOCKER_IMAGE }} | |
push: false | |
- name: Save Litestream API | |
run: | | |
docker save ${{ env.API_LITESTREAM_DOCKER_IMAGE }} \ | |
| gzip > ${{ env.API_LITESTREAM_DOCKER_IMAGE }}.tar.gz | |
- name: Upload Litestream API Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.API_LITESTREAM_DOCKER_IMAGE }}.tar.gz | |
path: ./${{ env.API_LITESTREAM_DOCKER_IMAGE }}.tar.gz | |
# CLI | |
build_cli_bin: | |
name: Build CLI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: goto-bus-stop/setup-zig@v2 | |
- name: Install zigbuild | |
run: cargo install --version 0.16.11 --locked cargo-zigbuild | |
- name: cargo build CLI | |
working-directory: ./services/cli | |
run: cargo zigbuild --release --target x86_64-unknown-linux-gnu.${{ env.GLIBC_VERSION }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.CLI_BIN_NAME }} | |
path: ./target/x86_64-unknown-linux-gnu/release/${{ env.CLI_BIN_NAME }} | |
build_cli_deb: | |
name: Package CLI (.deb) | |
runs-on: ubuntu-latest | |
needs: build_cli_bin | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download CLI Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.CLI_BIN_NAME }} | |
- name: Build .deb package | |
run: | | |
./scripts/deb.sh $CLI_BIN_NAME $(./scripts/version.sh) $CLI_BIN_ARCH $CLI_DEB_DIR | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable | |
echo "DEB_FILE=${CLI_BIN_NAME}_$(./scripts/version.sh)_${CLI_BIN_ARCH}.deb" >> $GITHUB_ENV | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.DEB_FILE }} | |
path: ${{ env.CLI_DEB_DIR }}/${{ env.DEB_FILE }} | |
# UI Docker | |
# build_ui_docker: | |
# name: Build UI Docker | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Build Builder Stage | |
# uses: docker/build-push-action@v5 | |
# with: | |
# context: . | |
# file: ./services/ui/builder.Dockerfile | |
# tags: ${{ env.UI_BUILDER_DOCKER_IMAGE }} | |
# push: false | |
# - name: Build UI | |
# uses: docker/build-push-action@v5 | |
# with: | |
# context: ./services/ui | |
# tags: ${{ env.UI_DOCKER_IMAGE }} | |
# push: false | |
# - name: Save UI | |
# run: | | |
# docker save ${{ env.UI_DOCKER_IMAGE }} \ | |
# | gzip > ${{ env.UI_DOCKER_IMAGE }}.tar.gz | |
# - name: Upload UI Artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: ${{ env.UI_DOCKER_IMAGE }}.tar.gz | |
# path: ./${{ env.UI_DOCKER_IMAGE }}.tar.gz | |
build_ui_docker: | |
name: Build Console UI Docker | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Builder Stage | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./services/console/builder.Dockerfile | |
tags: ${{ env.UI_BUILDER_DOCKER_IMAGE }} | |
build-args: | | |
MOLD_VERSION=${{ env.MOLD_VERSION }} | |
push: false | |
- name: Build Console UI | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./services/console | |
tags: ${{ env.UI_DOCKER_IMAGE }} | |
push: false | |
- name: Save Console UI | |
run: | | |
docker save ${{ env.UI_DOCKER_IMAGE }} \ | |
| gzip > ${{ env.UI_DOCKER_IMAGE }}.tar.gz | |
- name: Upload Console UI Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.UI_DOCKER_IMAGE }}.tar.gz | |
path: ./${{ env.UI_DOCKER_IMAGE }}.tar.gz | |
# UI | |
# build_ui: | |
# if: true && !startsWith(github.ref, 'refs/tags/') | |
# name: Build UI | |
# runs-on: ubuntu-latest | |
# needs: build_bencher_valid_wasm | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Download `bencher_valid` Artifact | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: ${{ env.WASM_BENCHER_VALID }} | |
# path: ./lib/bencher_valid/pkg | |
# - name: Build UI | |
# working-directory: ./services/ui | |
# run: | | |
# npm install | |
# npm run build | |
# - name: Upload UI Artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: ${{ env.UI_BUILD_DIST }} | |
# path: ./services/ui/dist | |
build_ui: | |
if: true && !startsWith(github.ref, 'refs/tags/') | |
name: Build Console UI | |
runs-on: ubuntu-latest | |
needs: | |
- cargo_fmt | |
- cargo_clippy | |
- npx_rome_format | |
- npx_rome_lint | |
- build_bencher_valid_wasm | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download `bencher_valid` Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.WASM_BENCHER_VALID }} | |
path: ./lib/bencher_valid/pkg | |
- name: Build Console UI | |
working-directory: ./services/console | |
run: | | |
echo "PUBLIC_GOOGLE_ANALYTICS_ID=${{ env.GOOGLE_ANALYTICS_ID }}" >> .env.production | |
npm run netlify | |
# API Fly.io | |
deploy_local_api_fly: | |
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') | |
name: Deploy Local API to Fly.io | |
runs-on: ubuntu-latest | |
needs: | |
- build_local_api_docker | |
- build_ui | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Local Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.API_LOCAL_DOCKER_IMAGE }}.tar.gz | |
- name: Load & Tag Local Image | |
run: | | |
docker load < ${{ env.API_LOCAL_DOCKER_IMAGE }}.tar.gz | |
docker tag ${{ env.API_LOCAL_DOCKER_IMAGE }} ${{ env.FLY_REGISTRY }}/bencher-api-dev | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Deploy Local API to Fly.io | |
working-directory: ./services/api | |
run: flyctl deploy --local-only --config fly.dev.toml --wait-timeout 300 | |
- name: Ping API Server | |
run: wget https://dev.api.bencher.dev/v0/server/ping | |
backup_database: | |
if: github.ref == 'refs/heads/main' | |
name: Backup Database | |
runs-on: ubuntu-latest | |
# continue-on-error: true | |
needs: | |
# Test | |
- cargo_test | |
- api_smoke_test | |
- api_smoke_test_compat | |
- cargo_bench | |
- cargo_audit | |
- cargo_udeps | |
- test_bencher_valid_wasm | |
- npx_vitest | |
# Build | |
- build_litestream_api_docker | |
- build_ui | |
- build_cli_bin | |
env: | |
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN_ADMIN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: Install `bencher` CLI | |
run: cargo install --path services/cli --locked | |
- name: Backup API Server Database | |
run: bencher server backup --compress --data-store aws_s3 --rm | |
deploy_litestream_api_fly: | |
name: Deploy Litestream API to Fly.io Prod | |
runs-on: ubuntu-latest | |
needs: backup_database | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Litestream Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.API_LITESTREAM_DOCKER_IMAGE }}.tar.gz | |
- name: Load & Tag Litestream Image | |
run: | | |
docker load < ${{ env.API_LITESTREAM_DOCKER_IMAGE }}.tar.gz | |
docker tag ${{ env.API_LITESTREAM_DOCKER_IMAGE }} ${{ env.FLY_REGISTRY }}/bencher-api | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Deploy Litestream API to Fly.io | |
working-directory: ./services/api | |
run: flyctl deploy --local-only --config fly.toml --wait-timeout 300 | |
- name: Ping API Server | |
run: wget https://api.bencher.dev/v0/server/ping | |
# UI Netlify | |
# deploy_ui_netlify_dev: | |
# name: Deploy UI to Netlify | |
# runs-on: ubuntu-latest | |
# needs: deploy_local_api_fly | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Download UI Artifact | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: ${{ env.UI_BUILD_DIST }} | |
# path: ./services/ui/dist | |
# - uses: netlify/actions/cli@master | |
# with: | |
# args: deploy --dir /github/workspace/services/ui/dist --alias ${GITHUB_REF#refs/*/} --message "${{ github.event.head_commit.message }}" | |
# env: | |
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
deploy_ui_netlify_dev: | |
name: Deploy Console UI to Netlify | |
runs-on: ubuntu-latest | |
needs: deploy_local_api_fly | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download `bencher_valid` Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.WASM_BENCHER_VALID }} | |
path: ./lib/bencher_valid/pkg | |
- name: Build Console UI | |
working-directory: ./services/console | |
run: | | |
echo "PUBLIC_GOOGLE_ANALYTICS_ID=${{ env.GOOGLE_ANALYTICS_ID }}" >> .env.production | |
npm run netlify | |
- uses: netlify/actions/cli@master | |
with: | |
args: | | |
deploy \ | |
--alias ${GITHUB_REF#refs/*/} \ | |
--message "${{ github.event.head_commit.message }}" | |
env: | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
deploy_ui_netlify_prod: | |
name: Deploy UI to Netlify Prod | |
runs-on: ubuntu-latest | |
needs: deploy_litestream_api_fly | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download `bencher_valid` Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.WASM_BENCHER_VALID }} | |
path: ./lib/bencher_valid/pkg | |
- name: Build Console UI | |
working-directory: ./services/console | |
run: | | |
echo "PUBLIC_GOOGLE_ANALYTICS_ID=${{ env.GOOGLE_ANALYTICS_ID }}" >> .env.production | |
npm run netlify | |
- uses: netlify/actions/cli@master | |
with: | |
args: | | |
deploy \ | |
--alias ${GITHUB_REF#refs/*/} \ | |
--message "${{ github.event.head_commit.message }}" \ | |
--prod | |
env: | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
- name: Check updated UI is deployed | |
run: ./scripts/check_ui.sh | |
# Release | |
release_bencher: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Release Bencher | |
runs-on: ubuntu-latest | |
needs: | |
# Test | |
- cargo_test | |
- api_smoke_test | |
- api_smoke_test_compat | |
- cargo_check_api_minus | |
- cargo_check_cli_minus | |
- cargo_bench | |
- cargo_audit | |
- cargo_udeps | |
- test_bencher_valid_wasm | |
- npx_vitest | |
# Integrations | |
- bencher_github_action | |
# Build | |
- build_local_api_docker | |
- build_litestream_api_docker | |
- build_cli_deb | |
- build_ui_docker | |
steps: | |
- uses: actions/checkout@v4 | |
# Download | |
- name: Download Local API Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.API_LOCAL_DOCKER_IMAGE }}.tar.gz | |
- name: Download Litestream API Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.API_LITESTREAM_DOCKER_IMAGE }}.tar.gz | |
- name: Download CLI bin artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.CLI_BIN_NAME }} | |
- name: export DEB_FILE | |
run: echo "DEB_FILE=${CLI_BIN_NAME}_$(./scripts/version.sh)_${CLI_BIN_ARCH}.deb" >> $GITHUB_ENV | |
- name: Download CLI .deb Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.DEB_FILE }} | |
- name: Download UI Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.UI_DOCKER_IMAGE }}.tar.gz | |
# Load | |
- name: Load Local API Image | |
run: docker load < ${{ env.API_LOCAL_DOCKER_IMAGE }}.tar.gz | |
- name: Load Litestream API Image | |
run: docker load < ${{ env.API_LITESTREAM_DOCKER_IMAGE }}.tar.gz | |
- name: Load UI Image | |
run: docker load < ${{ env.UI_DOCKER_IMAGE }}.tar.gz | |
# Login GHCR | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.GITHUB_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Tag & Push | |
- name: Tag & Push Local API Image | |
run: | | |
export GITHUB_IMAGE=${{ env.GITHUB_REGISTRY }}/${{ github.repository_owner }}/${{ env.API_LOCAL_DOCKER_IMAGE }} | |
docker tag ${{ env.API_LOCAL_DOCKER_IMAGE }} ${GITHUB_IMAGE}:latest | |
docker tag ${{ env.API_LOCAL_DOCKER_IMAGE }} ${GITHUB_IMAGE}:${GITHUB_REF#refs/*/} | |
docker push ${GITHUB_IMAGE}:latest | |
docker push ${GITHUB_IMAGE}:${GITHUB_REF#refs/*/} | |
- name: Tag & Push Litestream API Image | |
run: | | |
export GITHUB_IMAGE=${{ env.GITHUB_REGISTRY }}/${{ github.repository_owner }}/${{ env.API_LITESTREAM_DOCKER_IMAGE }} | |
docker tag ${{ env.API_LITESTREAM_DOCKER_IMAGE }} ${GITHUB_IMAGE}:latest | |
docker tag ${{ env.API_LITESTREAM_DOCKER_IMAGE }} ${GITHUB_IMAGE}:${GITHUB_REF#refs/*/} | |
docker push ${GITHUB_IMAGE}:latest | |
docker push ${GITHUB_IMAGE}:${GITHUB_REF#refs/*/} | |
- name: Tag & Push UI Image | |
run: | | |
export GITHUB_IMAGE=${{ env.GITHUB_REGISTRY }}/${{ github.repository_owner }}/${{ env.UI_DOCKER_IMAGE }} | |
docker tag ${{ env.UI_DOCKER_IMAGE }} ${GITHUB_IMAGE}:latest | |
docker tag ${{ env.UI_DOCKER_IMAGE }} ${GITHUB_IMAGE}:${GITHUB_REF#refs/*/} | |
docker push ${GITHUB_IMAGE}:latest | |
docker push ${GITHUB_IMAGE}:${GITHUB_REF#refs/*/} | |
- uses: rui314/setup-mold@v1 | |
with: | |
mold-version: ${{ env.MOLD_VERSION }} | |
- name: Generate Release Notes | |
run: cargo xtask release-notes | |
- name: GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: release-notes.md | |
files: | | |
${{ env.API_LOCAL_DOCKER_IMAGE }}.tar.gz | |
${{ env.API_LITESTREAM_DOCKER_IMAGE }}.tar.gz | |
${{ env.CLI_BIN_NAME }} | |
${{ env.DEB_FILE }} | |
${{ env.UI_DOCKER_IMAGE }}.tar.gz |