Use rust-lld in CI (#1253)

Which guarantees:
 - faster linking on all targets when `cargo-zigbuild` is not used
 - allow cross-lang-lto to be enabled

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-08-08 10:53:36 +10:00 committed by GitHub
parent 435df675b3
commit 1e4e0d166d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -38,11 +38,18 @@ jobs:
os: windows-latest os: windows-latest
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env: env:
CARGO_BUILD_TARGET: ${{ matrix.target }} CARGO_BUILD_TARGET: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use rust-lld
run: |
echo "CARGO_TARGET_${CARGO_BUILD_TARGET}_LINKER=rust-lld" >> "$GITHUB_ENV"
- uses: ./.github/actions/just-setup - uses: ./.github/actions/just-setup
env: env:
# just-setup use binstall to install sccache, # just-setup use binstall to install sccache,
@ -74,10 +81,17 @@ jobs:
- target: aarch64-pc-windows-msvc - target: aarch64-pc-windows-msvc
os: windows-latest os: windows-latest
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env: env:
CARGO_BUILD_TARGET: ${{ matrix.target }} CARGO_BUILD_TARGET: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use rust-lld
run: |
echo "CARGO_TARGET_${CARGO_BUILD_TARGET}_LINKER=rust-lld" >> "$GITHUB_ENV"
- uses: ./.github/actions/just-setup - uses: ./.github/actions/just-setup
with: with:
tools: cargo-hack tools: cargo-hack
@ -107,6 +121,9 @@ jobs:
os: windows-latest os: windows-latest
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: ./.github/actions/just-setup - uses: ./.github/actions/just-setup

View file

@ -42,6 +42,9 @@ jobs:
name: ${{ matrix.t }} name: ${{ matrix.t }}
runs-on: ${{ matrix.o }} runs-on: ${{ matrix.o }}
defaults:
run:
shell: bash
env: env:
CARGO_BUILD_TARGET: ${{ matrix.t }} CARGO_BUILD_TARGET: ${{ matrix.t }}
GLIBC_VERSION: ${{ matrix.g }} GLIBC_VERSION: ${{ matrix.g }}
@ -60,6 +63,10 @@ jobs:
if: inputs.CARGO_PROFILE_RELEASE_CODEGEN_UNITS if: inputs.CARGO_PROFILE_RELEASE_CODEGEN_UNITS
run: echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=${{ inputs.CARGO_PROFILE_RELEASE_CODEGEN_UNITS }}" >> "$GITHUB_ENV" run: echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=${{ inputs.CARGO_PROFILE_RELEASE_CODEGEN_UNITS }}" >> "$GITHUB_ENV"
- name: Use rust-lld
run: |
echo "CARGO_TARGET_${CARGO_BUILD_TARGET}_LINKER=rust-lld" >> "$GITHUB_ENV"
- uses: ./.github/actions/just-setup - uses: ./.github/actions/just-setup
with: with:
tools: cargo-auditable tools: cargo-auditable
@ -73,6 +80,7 @@ jobs:
- run: just package - run: just package
- if: runner.os == 'Windows' - if: runner.os == 'Windows'
shell: pwsh
run: Get-ChildItem packages/ run: Get-ChildItem packages/
- if: runner.os != 'Windows' - if: runner.os != 'Windows'
run: ls -shal packages/ run: ls -shal packages/