feat(slang): lower revert statements #2242
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: Tests | |
| # Execute workflow for each PR and with each merge to the trunk | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| merge_group: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| packages: read | |
| # Cancel the workflow if any new changes pushed to a feature branch or the trunk | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Detect whether code (non-doc) files changed | |
| changes: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| outputs: | |
| code: ${{ steps.filter.outputs.code }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: filter | |
| with: | |
| predicate-quantifier: 'every' | |
| filters: | | |
| code: | |
| - '**' | |
| - '!docs/**' | |
| - '!**/*.md' | |
| - '!**/*.mdx' | |
| - '!**/LICENSE*' | |
| # Check for cargo issues | |
| cargo-checks: | |
| needs: changes | |
| if: needs.changes.outputs.code == 'true' | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ghcr.io/nomicfoundation/solx-ci-runner@sha256:c2b03000a1074d2cc3e6cf25a1c4fdc6eb0a61d23e63bef59205050249fa1d6e | |
| # Host tooling bind-mounted so the free-disk-space action can reclaim | |
| # ~24 GB before the cold LLVM build fills the runner's 14 GB budget. | |
| # Anchor shared with build-and-test below; keep in sync with the | |
| # matching list in cache-warmup.yaml. | |
| volumes: &free-disk-volumes | |
| - /usr/share/dotnet:/mnt/free-disk-space/dotnet | |
| - /usr/local/lib/android:/mnt/free-disk-space/android | |
| - /opt/ghc:/mnt/free-disk-space/ghc | |
| - /usr/local/.ghcup:/mnt/free-disk-space/ghcup | |
| - /opt/hostedtoolcache/CodeQL:/mnt/free-disk-space/codeql | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: true | |
| - name: Free disk space | |
| uses: ./.github/actions/free-disk-space | |
| # 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 | |
| uses: ./.github/actions/setup-sfw | |
| - name: Build LLVM | |
| uses: ./.github/actions/build-llvm | |
| with: | |
| build-type: RelWithDebInfo | |
| enable-assertions: 'true' | |
| enable-mlir: 'true' | |
| - name: Cargo checks | |
| uses: ./.github/actions/cargo-check | |
| cooldown-check: | |
| name: Cargo cooldown check | |
| runs-on: ubuntu-24.04 | |
| needs: changes | |
| if: needs.changes.outputs.code == 'true' | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/cooldown-check | |
| # Build and run regression tests | |
| build-and-test: | |
| needs: changes | |
| if: needs.changes.outputs.code == 'true' | |
| env: | |
| CARGO_INCREMENTAL: "0" | |
| permissions: | |
| contents: read | |
| checks: write | |
| packages: read | |
| strategy: | |
| fail-fast: false # finalize testing of all targets even if one failed | |
| matrix: | |
| include: | |
| - name: "MacOS x86" | |
| runner: macos-15-intel | |
| - name: "MacOS arm64" | |
| runner: macos-15 | |
| - name: "Linux x86 gnu" | |
| runner: ubuntu-24.04 | |
| image: ghcr.io/nomicfoundation/solx-ci-runner@sha256:c2b03000a1074d2cc3e6cf25a1c4fdc6eb0a61d23e63bef59205050249fa1d6e | |
| target: "x86_64-unknown-linux-gnu" | |
| - name: "Linux ARM64 gnu" | |
| runner: ubuntu-24.04-arm | |
| image: ghcr.io/nomicfoundation/solx-ci-runner@sha256:c2b03000a1074d2cc3e6cf25a1c4fdc6eb0a61d23e63bef59205050249fa1d6e | |
| target: "aarch64-unknown-linux-gnu" | |
| - name: "Windows" | |
| runner: windows-2025 | |
| target: "x86_64-pc-windows-gnu" | |
| runs-on: ${{ matrix.runner }} | |
| container: | |
| image: ${{ matrix.image || '' }} # Special workaround to allow matrix builds with optional container | |
| # Host tooling bind-mounts for the free-disk-space action. These apply | |
| # only when a container is started (matrix legs with `image:` set); the | |
| # macOS/Windows legs run bare and the paths are irrelevant there. | |
| volumes: *free-disk-volumes | |
| name: ${{ matrix.name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: true | |
| persist-credentials: false | |
| # Only meaningful on containerized Linux legs (the hosted x86 leg is the | |
| # disk-constrained one); a no-op on macOS/Windows since the mount points | |
| # don't exist there. | |
| - name: Free disk space | |
| if: runner.os == 'Linux' && matrix.image != '' | |
| uses: ./.github/actions/free-disk-space | |
| # 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 | |
| uses: ./.github/actions/setup-sfw | |
| - name: Prepare Windows env | |
| if: runner.os == 'Windows' | |
| uses: ./.github/actions/prepare-msys | |
| - name: Free disk space (macOS) | |
| if: runner.os == 'macOS' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| echo "=== Before macOS cleanup ===" && df -h . | |
| # 1. Simulator runtimes — stored on read-only APFS snapshot volumes, | |
| # so plain `rm` fails. `simctl runtime delete all` unmounts them. | |
| # May warn on already-deleted runtimes; that is harmless. | |
| echo "--- Removing simulator runtimes ---" | |
| xcrun simctl delete all 2>&1 || true | |
| xcrun simctl runtime delete all 2>&1 || true | |
| # 2. Xcode — remove every versioned copy EXCEPT the one that | |
| # xcode-select points to (we need its toolchain for C/C++ builds). | |
| # Active Xcode path looks like /Applications/Xcode_16.2.app/Contents/Developer. | |
| echo "--- Removing inactive Xcode versions ---" | |
| ACTIVE_XCODE="$(xcode-select -p 2>/dev/null | sed 's|/Contents/Developer/*$||' || true)" | |
| ACTIVE_XCODE="${ACTIVE_XCODE%/}" | |
| removed=0 | |
| if [ -z "${ACTIVE_XCODE}" ] || [[ "${ACTIVE_XCODE}" != /Applications/Xcode*.app ]]; then | |
| echo " warning: active Xcode path '${ACTIVE_XCODE}' is not an Xcode app; skipping Xcode removal" | |
| else | |
| echo "Active Xcode (keeping): ${ACTIVE_XCODE}" | |
| to_remove=() | |
| for app in /Applications/Xcode_*.app; do | |
| [ -d "$app" ] || continue | |
| if [ "$app" = "$ACTIVE_XCODE" ]; then | |
| echo " skip (active): $app" | |
| else | |
| echo " removing: $app" | |
| to_remove+=("$app") | |
| fi | |
| done | |
| # Each Xcode bundle is ~15 GB of small files; `rm -rf` is I/O-bound | |
| # per inode, so run them concurrently (one worker per bundle). | |
| # Soft-fail: a stray rm error shouldn't sink the whole job — rm's | |
| # stderr will pinpoint the bad path above. | |
| # | |
| # `removed` reflects the attempt count, not per-bundle success: | |
| # xargs returns non-zero if *any* child failed, so gating the | |
| # count on xargs success would print "Removed 0" even after | |
| # ~30 GB was freed. The count is off by the number of failed | |
| # bundles — usually one in practice — which is still a much | |
| # better signal than zero. | |
| if [ "${#to_remove[@]}" -gt 0 ]; then | |
| removed=${#to_remove[@]} | |
| if ! printf '%s\0' "${to_remove[@]}" \ | |
| | xargs -0 -n1 -P "${#to_remove[@]}" sudo rm -rf; then | |
| echo " warning: one or more Xcode removals failed (see rm stderr above)" | |
| fi | |
| fi | |
| fi | |
| echo "Removed ${removed} inactive Xcode version(s)" | |
| # 3. Remaining large packages that this project never uses. | |
| # Each path is removed individually so a missing path doesn't | |
| # mask a real permission error on another. | |
| echo "--- Removing unused SDKs and caches ---" | |
| for dir in \ | |
| /Library/Developer/CoreSimulator \ | |
| /usr/local/lib/android \ | |
| "${RUNNER_TOOL_CACHE:-/Users/runner/hostedtoolcache}"; do | |
| if [ -d "$dir" ]; then | |
| echo " removing: $dir" | |
| sudo rm -rf "$dir" || echo " warning: failed to remove $dir" | |
| else | |
| echo " not found (skipped): $dir" | |
| fi | |
| done | |
| echo "=== After macOS cleanup ===" && df -h . | |
| - name: Cache cargo artifacts | |
| if: ${{ !matrix.image }} | |
| 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' | |
| - 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: | | |
| echo "Before cleanup:" && df -h . | |
| rm -rf solx-llvm target-llvm/build-final | |
| # Remove solx-solidity source, keeping build/ and boost/ for tests | |
| find solx-solidity -mindepth 1 -maxdepth 1 ! -name build ! -name boost -exec rm -rf {} + | |
| rm -rf .git/modules | |
| echo "After cleanup:" && df -h . | |
| - name: Run tests | |
| uses: ./.github/actions/rust-unit-tests | |
| env: | |
| BOOST_PREFIX: ${{ github.workspace }}/solx-solidity/boost/lib | |
| SOLC_PREFIX: ${{ github.workspace }}/solx-solidity/build | |
| with: | |
| target: ${{ matrix.target || '' }} | |
| # Special job that allows some of the jobs to be skipped or failed | |
| # requiring others to be successful | |
| pr-checks: | |
| name: PR Checks (Tests) | |
| runs-on: ubuntu-24.04 | |
| if: always() | |
| needs: | |
| - changes | |
| - cargo-checks | |
| - build-and-test | |
| - cooldown-check | |
| steps: | |
| - name: Decide on PR checks | |
| uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} | |
| allowed-skips: >- | |
| ${{ needs.changes.outputs.code != 'true' && 'cargo-checks, build-and-test, cooldown-check' || '' }} |