Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 81 additions & 42 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,46 +113,65 @@ jobs:
echo "RUST_GPU_CACHE=$HOME/.cache/rust-gpu" >> "$GITHUB_ENV"
fi

- &shared-test-steps
parallel:
- *checkout-step
- *cache-restore-step
# TODO: Can't use parallel steps: https://github.com/taiki-e/install-action/issues/1958
#- &shared-test-steps
# parallel:
- *checkout-step
- *cache-restore-step

- name: RISC-V support
run: |
echo "command=${command} -Zbuild-std" >> $GITHUB_ENV
echo "RUSTFLAGS=${RUSTFLAGS} -C linker=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
# TODO: Temporary workaround for https://github.com/rust-lang/cc-rs/issues/1654
echo "CC_riscv64_unknown_none_abundance=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
sudo apt-get update
sudo apt-get install --no-install-recommends --yes g++-riscv64-linux-gnu
if: contains(matrix.target, 'riscv64')

- name: Install wild-linker
uses: taiki-e/install-action@6a1bd70eaac3c8bdf093356838d7ee09fda951cf # 2.85.5
with:
tool: wild-linker
if: runner.os == 'Linux' && matrix.target == ''

# Use Wild linker for shorter build times
- name: Use Wild linker on Linux
shell: bash
run: |
LINKER_FLAGS="-C linker=clang -C link-arg=--ld-path=wild"
# TODO: Remove once https://github.com/wild-linker/wild/issues/2260 is resolved
if [[ "$(uname -m)" == "aarch64" ]]; then
LINKER_FLAGS="${LINKER_FLAGS} -A linker_messages"
fi
echo "RUSTFLAGS=${RUSTFLAGS} ${LINKER_FLAGS}" >> $GITHUB_ENV
if: runner.os == 'Linux' && matrix.target == ''

# Use LLD linker for shorter build times
- name: Use LLD linker on Windows
shell: bash
run: |
echo "RUSTFLAGS=${RUSTFLAGS} -C linker=rust-lld" >> $GITHUB_ENV
if: runner.os == 'Windows'
- &install-sccache-step
name: Install sccache
uses: &install-action-version taiki-e/install-action@6a1bd70eaac3c8bdf093356838d7ee09fda951cf # 2.85.5
with:
tool: sccache

# Speeds up builds across the multiple `CARGO_TARGET_DIR`s used within a job by sharing compiled
# artifacts through a local-disk cache instead of recompiling them for each target dir
- &use-sccache-step
name: Use sccache
shell: bash
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV

- &riscv-support-step
name: RISC-V support
run: |
echo "command=${command} -Zbuild-std" >> $GITHUB_ENV
echo "RUSTFLAGS=${RUSTFLAGS} -C linker=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
# TODO: Temporary workaround for https://github.com/rust-lang/cc-rs/issues/1654
echo "CC_riscv64_unknown_none_abundance=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
sudo apt-get update
sudo apt-get install --no-install-recommends --yes g++-riscv64-linux-gnu
if: contains(matrix.target, 'riscv64')

- &install-wild-step
name: Install wild-linker
uses: *install-action-version
with:
tool: wild-linker
if: runner.os == 'Linux' && matrix.target == ''

# Use Wild linker for shorter build times
- &use-wild-step
name: Use Wild linker on Linux
shell: bash
run: |
LINKER_FLAGS="-C linker=clang -C link-arg=--ld-path=wild"
# TODO: Remove once https://github.com/wild-linker/wild/issues/2260 is resolved
if [[ "$(uname -m)" == "aarch64" ]]; then
LINKER_FLAGS="${LINKER_FLAGS} -A linker_messages"
fi
echo "RUSTFLAGS=${RUSTFLAGS} ${LINKER_FLAGS}" >> $GITHUB_ENV
if: runner.os == 'Linux' && matrix.target == ''

# Use LLD linker for shorter build times
- &use-lld-step
name: Use LLD linker on Windows
shell: bash
run: |
echo "RUSTFLAGS=${RUSTFLAGS} -C linker=rust-lld" >> $GITHUB_ENV
if: runner.os == 'Windows'

- name: cargo clippy
run: |
Expand Down Expand Up @@ -321,12 +340,21 @@ jobs:

steps: &test-steps
- name: Install cargo-nextest
uses: taiki-e/install-action@6a1bd70eaac3c8bdf093356838d7ee09fda951cf # 2.85.5
uses: *install-action-version
with:
tool: cargo-nextest

- *rust-gpu-cache
- *shared-test-steps
# TODO: Can't use parallel steps: https://github.com/taiki-e/install-action/issues/1958
#- *shared-test-steps
- *checkout-step
- *cache-restore-step
- *install-sccache-step
- *use-sccache-step
- *riscv-support-step
- *install-wild-step
- *use-wild-step
- *use-lld-step

- name: Install Vulkan runtime (Linux)
run: |
Expand Down Expand Up @@ -663,7 +691,16 @@ jobs:

steps:
- *rust-gpu-cache
- *shared-test-steps
# TODO: Can't use parallel steps: https://github.com/taiki-e/install-action/issues/1958
#- *shared-test-steps
- *checkout-step
- *cache-restore-step
- *install-sccache-step
- *use-sccache-step
- *riscv-support-step
- *install-wild-step
- *use-wild-step
- *use-lld-step

# Increase the inlining threshold to make sure the compiler can see that some functions do not panic.
# Native CPU and LTO to allow the compiler to apply more optimizations and prove lack of panics in more cases.
Expand Down Expand Up @@ -769,6 +806,8 @@ jobs:
steps:
- *checkout-step
- *cache-restore-step
- *install-sccache-step
- *use-sccache-step

# TODO: Run clippy and `no-panic` on custom target for contracts too
- name: Ensure contracts compile for a custom target
Expand Down
Loading