Skip to content

Release Analytics CLI #91

Release Analytics CLI

Release Analytics CLI #91

Workflow file for this run

name: Release Analytics CLI
on:
workflow_dispatch:
inputs:
release_tag:
type: string
description: Tag to create
required: True
concurrency: ${{ github.workflow }}
jobs:
build_linux:
name: Build ${{ matrix.target }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
artifact-name: x86_64-unknown-linux
runs-on: public-amd64-2xlarge
- target: aarch64-unknown-linux-musl
artifact-name: aarch64-unknown-linux
runs-on: public-arm64-2xlarge
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust & Cargo
uses: ./.github/actions/setup_rust_cargo
if: "!cancelled()"
- name: Update version
uses: ./.github/actions/update_version
if: "!cancelled()"
with:
version: ${{ github.event.inputs.release_tag }}
- name: Build ${{ matrix.target }} target
uses: ./.github/actions/build_cli_linux_target
if: "!cancelled()"
with:
target: ${{ matrix.target }}
profile: release-with-debug
- name: Upload debug info to Sentry
uses: ./.github/actions/upload_sentry_debug_info
if: "!cancelled()"
with:
target: ${{ matrix.target }}
sentry-org: ${{ secrets.SENTRY_ORG }}
sentry-project: ${{ secrets.SENTRY_PROJECT }}
sentry-auth-token: ${{ secrets.SENTRY_AUTH_TOKEN }}
- uses: actions/upload-artifact@v4
if: "!cancelled()"
with:
name: ${{ matrix.artifact-name }}
path: target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli
if-no-files-found: error
build_macos:
name: Build ${{ matrix.target }}
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
runs-on: [macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust & Cargo
uses: ./.github/actions/setup_rust_cargo
if: "!cancelled()"
- name: Update version
uses: ./.github/actions/update_version
if: "!cancelled()"
with:
version: ${{ github.event.inputs.release_tag }}
- name: Build ${{ matrix.target }} target
uses: ./.github/actions/build_cli_macos_target
if: "!cancelled()"
with:
target: ${{ matrix.target }}
profile: release-with-debug
- name: Upload debug info to Sentry
uses: ./.github/actions/upload_sentry_debug_info
if: "!cancelled()"
with:
target: ${{ matrix.target }}
sentry-org: ${{ secrets.SENTRY_ORG }}
sentry-project: ${{ secrets.SENTRY_PROJECT }}
sentry-auth-token: ${{ secrets.SENTRY_AUTH_TOKEN }}
- uses: actions/upload-artifact@v4
if: "!cancelled()"
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli
if-no-files-found: error
perform_smoke_test:
name: Smoke test ${{ github.event.inputs.release_tag }}
runs-on: public-amd64-small
needs:
- build_linux
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Release Candidate
uses: actions/download-artifact@v4
with:
name: x86_64-unknown-linux
path: ./trunk-analytics-cli
- name: Setup Run Smoke Tests
uses: ./.github/actions/setup_run_smoke_tests
- name: Run succeeding test
env:
TRUNK_PUBLIC_API_ADDRESS: https://api.trunk-staging.io
shell: bash
run: |
./trunk-analytics-cli/trunk-analytics-cli test \
--org-url-slug trunk-staging-org \
--junit-paths ${{ github.workspace }}/target/**/*junit.xml \
--token ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }} \
cargo nextest run -p smoke-test --profile ci
# tag_and_release:
# name: Tag and Release [ ${{ github.event.inputs.release_tag }} ]
# runs-on: public-amd64-small
# needs: [build_linux, build_macos, perform_smoke_test]
# if: needs.perform_smoke_test.result == 'success'
#
# steps:
# - uses: actions/checkout@v4
#
# - id: download
# uses: actions/download-artifact@v4
# with:
# path: build
#
# - name: Compress binaries
# run: |
# for target in $(ls build)
# do
# chmod u+x build/${target}/trunk-analytics-cli
# tar czvf \
# build/trunk-analytics-cli-${target}.tar.gz \
# -C build/${target} trunk-analytics-cli
# done
#
# - name: Install gh
# uses: trunk-io/trunk-action/install@v1
# with:
# tools: gh
#
# - name: Create GH release and upload binary
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh release create --prerelease --latest=false \
# --target ${{ github.ref }} \
# --generate-notes ${{ github.event.inputs.release_tag }} \
# ./build/*.tar.gz
#
# - name: Create Sentry release
# uses: getsentry/action-release@v1
# env:
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
# SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
# SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
# with:
# environment: production
# version: ${{ github.event.inputs.release_tag }}