Skip to content

Pull Request for 811/merge by gnalh #2742

Pull Request for 811/merge by gnalh

Pull Request for 811/merge by gnalh #2742

Workflow file for this run

name: Pull Request
run-name: Pull Request for ${{ github.ref_name }} by ${{ github.actor }}
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: write-all
on:
pull_request: {}
workflow_dispatch: {}
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
build_release:
name: Build CLI for ${{ matrix.platform.target }}
strategy:
matrix:
platform:
- os-name: linux-x86_64
runs-on: ubuntu-latest
target: x86_64-unknown-linux-musl
- os-name: linux-aarch64
runs-on: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
- os-name: x86_64-linux
runs-on: ubuntu-latest
target: x86_64-unknown-illumos
- os-name: x86_64-darwin
runs-on: macos-latest
target: x86_64-apple-darwin
- os-name: aarch64-darwin
runs-on: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.platform.runs-on }}
steps:
# we've been hitting out of free space issues
- name: Delete unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Checkout
uses: actions/checkout@v4
with:
lfs: "true"
- name: Setup Xcode 16
if: contains(matrix.platform.os-name, 'darwin')
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 16
- name: Setup Rust & Cargo
uses: ./.github/actions/setup_rust_cargo
# This is a canary test to ensure that the github actions crate is working
# as expected in a real environment. If this fails, we should investigate
# why the github actions crate is not working as expected. This test relies
# on the github actions crate to be able to extract the job ID from the logs,
# which is an undocumented feature that can break at any moment.
- name: canary - Test github actions crate
shell: bash
run: |
cargo run --bin github-actions -- -v
if [[ "$?" -ne 0 ]]; then
echo "Failed to run github-actions crate"
exit 1
fi
- name: Run tests
uses: ./.github/actions/run_tests
id: tests
continue-on-error: true
with:
target: ${{ matrix.platform.target }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
- name: Build darwin target
uses: ./.github/actions/build_cli_macos_target
if: contains(matrix.platform.os-name, 'darwin')
with:
target: ${{ matrix.platform.target }}
profile: release
force-sentry-dev: true
- name: Build unix target
uses: ./.github/actions/build_cli_linux_target
if: "!contains(matrix.platform.os-name, 'darwin')"
with:
target: ${{ matrix.platform.target }}
profile: release
force-sentry-dev: true
- name: Extract step outcome
shell: bash
id: extract
run: |
if [[ "${{steps.tests.outcome}}" == "failure" ]]; then
echo "test-step-outcome=1" >> $GITHUB_OUTPUT
else
echo "test-step-outcome=0" >> $GITHUB_OUTPUT
fi
- name: Upload results to staging using built CLI
env:
TRUNK_PUBLIC_API_ADDRESS: https://api.trunk-staging.io
shell: bash
if: "!contains(matrix.platform.target, 'illumos')"
run: |
target/${{ matrix.platform.target }}/release/trunk-analytics-cli upload \
--junit-paths ${{ github.workspace }}/target/**/*junit.xml \
--org-url-slug trunk-staging-org \
--token ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }} \
--test-process-exit-code ${{ steps.extract.outputs.test-step-outcome }}
- name: Upload results to prod using built CLI
shell: bash
if: "!contains(matrix.platform.target, 'illumos')"
run: |
target/${{ matrix.platform.target }}/release/trunk-analytics-cli upload \
--junit-paths ${{ github.workspace }}/target/**/*junit.xml \
--org-url-slug trunk \
--token ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
trunk_check_runner:
name: Trunk Check runner [linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Setup Rust & Cargo
uses: ./.github/actions/setup_rust_cargo
- name: Setup Ruby
uses: ./.github/actions/setup_ruby
- name: Build workspace
run: cargo build --all
- name: Setup and build pyo3
uses: ./.github/actions/setup_build_pyo3
- name: Setup and build wasm
uses: ./.github/actions/setup_build_wasm
- name: Trunk Check
uses: trunk-io/trunk-action@v1
with:
cache: false