Skip to content
Merged
Show file tree
Hide file tree
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
67 changes: 67 additions & 0 deletions .github/actions/build-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build toolchain
description: >-
Shared CI prologue for the standard toolchain configuration: submodule
checkout, Socket Firewall, platform prep (MSYS2 on Windows, disk cleanup
on macOS), then the LLVM and solc builds. The build parameters below
define the standard-config cache keys shared by test.yaml,
slang-tests.yaml, and cache-warmup.yaml — changing them here re-keys all
of those workflows together. Workflows needing a different LLVM
configuration (sanitizer, coverage, integration, release) call
build-llvm/build-solc directly and pair with their own cache-warmup job.

inputs:
llvm:
description: Whether to build LLVM
required: false
default: 'true'
solc:
description: Whether to build solc
required: false
default: 'true'

runs:
using: composite
steps:
- name: Checkout submodules
uses: ./.github/actions/checkout-submodules

- name: Setup SFW (optional)
uses: ./.github/actions/setup-sfw
with:
optional: 'true'

- name: Prepare Windows env
if: runner.os == 'Windows'
uses: ./.github/actions/prepare-msys

- name: Free disk space (macOS)
if: runner.os == 'macOS'
uses: ./.github/actions/free-disk-space-macos

- name: Build LLVM
if: inputs.llvm == 'true'
uses: ./.github/actions/build-llvm
with:
build-type: RelWithDebInfo
enable-assertions: 'true'
enable-mlir: 'true'
enable-utils: 'true'

# Fresh llvm-sys objects under MSYS2 GCC 16 cannot link against the
# static libstdc++.a that solx-dev bundles into the LLVM tree; dropping
# it resolves -lstdc++ to the shared libstdc++.dll.a instead (#550, fix
# option 2). Test builds link libstdc++ shared; release binaries keep
# static linking (release.yaml builds LLVM itself and does not use this
# action). Runs after build-llvm's mid-action cache save, so the shared
# cached tree keeps the archive.
- name: Drop bundled static libstdc++ (Windows)
if: runner.os == 'Windows' && inputs.llvm == 'true'
shell: bash
run: rm -v target-llvm/target-final/lib/libstdc++.a
Comment thread
nebasuke marked this conversation as resolved.

- name: Build solc
if: inputs.solc == 'true'
uses: ./.github/actions/build-solc
with:
cmake-build-type: RelWithDebInfo
working-dir: 'solx-solidity'
45 changes: 6 additions & 39 deletions .github/workflows/cache-warmup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,10 @@ jobs:
if: runner.os == 'Linux' && matrix.image != ''
uses: ./.github/actions/free-disk-space-linux

- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --force --depth=1 --recursive --checkout

- name: Prepare Windows env
if: runner.os == 'Windows'
uses: ./.github/actions/prepare-msys

- name: Setup SFW (optional)
uses: ./.github/actions/setup-sfw
- name: Build toolchain
uses: ./.github/actions/build-toolchain
with:
optional: 'true'

- name: Build LLVM
uses: ./.github/actions/build-llvm
with:
build-type: RelWithDebInfo
enable-assertions: 'true'
enable-mlir: 'true'
enable-utils: 'true'
solc: 'false'

# When the artifact cache is warm, build-llvm skips ccache entirely,
# so the ccache entry's LRU timer isn't refreshed. Touch it explicitly
Expand Down Expand Up @@ -144,26 +127,10 @@ jobs:
if: runner.os == 'Linux' && matrix.image != ''
uses: ./.github/actions/free-disk-space-linux

- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --force --depth=1 --recursive --checkout

- name: Prepare Windows env
if: runner.os == 'Windows'
uses: ./.github/actions/prepare-msys

- name: Setup SFW (optional)
uses: ./.github/actions/setup-sfw
- name: Build toolchain
uses: ./.github/actions/build-toolchain
with:
optional: 'true'

- name: Build solc
uses: ./.github/actions/build-solc
with:
cmake-build-type: RelWithDebInfo
boost-version: '1.83.0'
working-dir: 'solx-solidity'
llvm: 'false'

- name: Touch solc ccache
if: always()
Expand Down
25 changes: 5 additions & 20 deletions .github/workflows/slang-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,12 @@ jobs:
with:
submodules: true

# This step is required to checkout submodules
# that are disabled in .gitmodules config
- name: Checkout submodules
uses: ./.github/actions/checkout-submodules

- name: Setup SFW (optional)
uses: ./.github/actions/setup-sfw
with:
optional: 'true'

- name: Prepare Windows env
if: runner.os == 'Windows'
uses: ./.github/actions/prepare-msys

- name: Build LLVM
uses: ./.github/actions/build-llvm
# solc is built separately below: the lit tests need a Release build
# against a synced solx-solidity, not the standard config.
- name: Build toolchain
uses: ./.github/actions/build-toolchain
with:
build-type: RelWithDebInfo
enable-assertions: 'true'
enable-mlir: 'true'
enable-utils: 'true'
solc: 'false'

# TODO: remove this step and the Build solc step below once the lit
# tests stop running against solc.
Expand Down
59 changes: 8 additions & 51 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,10 @@ jobs:
- name: Free disk space (Linux)
uses: ./.github/actions/free-disk-space-linux

# This step is required to checkout submodules
# that are disabled in .gitmodules config
- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --force --depth=1 --recursive --checkout

- name: Setup SFW (optional)
uses: ./.github/actions/setup-sfw
- name: Build toolchain
uses: ./.github/actions/build-toolchain
with:
optional: 'true'
solc: 'false'

- name: Cache cargo artifacts
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
Expand All @@ -131,14 +124,6 @@ jobs:
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Build LLVM
uses: ./.github/actions/build-llvm
with:
build-type: RelWithDebInfo
enable-assertions: 'true'
enable-mlir: 'true'
enable-utils: 'true'

- name: Cargo checks
uses: ./.github/actions/cargo-check

Expand Down Expand Up @@ -234,47 +219,19 @@ jobs:
if: runner.os == 'Linux' && matrix.image != ''
uses: ./.github/actions/free-disk-space-linux

# This step is required to checkout submodules
# that are disabled in .gitmodules config
- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --force --depth=1 --recursive --checkout

- name: Setup SFW (optional)
uses: ./.github/actions/setup-sfw
with:
optional: 'true'

- name: Prepare Windows env
if: runner.os == 'Windows'
uses: ./.github/actions/prepare-msys

- name: Free disk space (macOS)
if: runner.os == 'macOS'
uses: ./.github/actions/free-disk-space-macos
- name: Build toolchain
uses: ./.github/actions/build-toolchain

# Positioned after build-toolchain: prepare-msys switches the rustup
# host, which is part of the cache key, so only the post-msys position
# matches the keys already saved on main.
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
prefix-key: build-and-test-v2
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Build LLVM
uses: ./.github/actions/build-llvm
with:
build-type: RelWithDebInfo
enable-assertions: 'true'
enable-mlir: 'true'
enable-utils: 'true'

- name: Building solc
uses: ./.github/actions/build-solc
with:
cmake-build-type: RelWithDebInfo
working-dir: 'solx-solidity'

- name: Free disk space (remove LLVM source and build artifacts)
shell: bash
run: |
Expand Down
Loading