Pull Request for main by trunk-io[bot] #3161
This file contains hidden or 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: 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-darwin | |
| runs-on: macos-latest | |
| target: x86_64-apple-darwin | |
| - os-name: aarch64-darwin | |
| runs-on: macos-latest | |
| target: aarch64-apple-darwin | |
| - os-name: windows-x86_64 | |
| runs-on: public-amd64-4xlarge-dind-germany | |
| target: x86_64-pc-windows-gnu | |
| 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: Install build tools (Windows and Linux build) | |
| shell: bash | |
| if: ${{ !contains(matrix.platform.os-name, 'darwin') }} | |
| run: | | |
| sudo bash -c 'cat << EOF > /etc/apt/sources.list | |
| deb http://mirror.hetzner.com/ubuntu/packages jammy main restricted universe multiverse | |
| deb http://mirror.hetzner.com/ubuntu/packages jammy-updates main restricted universe multiverse | |
| deb http://mirror.hetzner.com/ubuntu/packages jammy-backports main restricted universe multiverse | |
| deb http://mirror.hetzner.com/ubuntu/packages jammy-security main restricted universe multiverse | |
| EOF' | |
| sudo apt-get update | |
| sudo apt-get install -y git-lfs build-essential | |
| git lfs install | |
| - 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/Windows target | |
| uses: ./.github/actions/build_cli_linux_windows_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 | |
| # Skip Windows builds - can't run Windows binaries on Linux runners | |
| # Windows binaries are tested in the release workflow on actual Windows runners | |
| if: ${{ !contains(matrix.platform.target, 'illumos') && !contains(matrix.platform.os-name, 'windows') }} | |
| 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 | |
| # Skip Windows builds - can't run Windows binaries on Linux runners | |
| # Windows binaries are tested in the release workflow on actual Windows runners | |
| if: ${{ !contains(matrix.platform.target, 'illumos') && !contains(matrix.platform.os-name, 'windows') }} | |
| 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 |