Files
revive/.github/workflows/test.yml
T
LJ 733e01c78e Implement verification of reproducible builds and run differential E2E tests (#468)
## Description

This adds verification for reproducible builds (via
[revive-differential-tests](https://github.com/paritytech/revive-differential-tests)
testing framework) by:

1. Compiling
[contracts](https://github.com/paritytech/resolc-compiler-tests/tree/main/fixtures/solidity)
and generating hashes from each bytecode
    * With the resolc builds:
      * linux musl
      * macos universal
      * windows
      * (future todo: wasm32 emscripten)
    * With optimization levels `0`, `3`, `z` for each contract
2. Exporting the hashes
3. Comparing the hashes
    * For each optimization level:
* Checks if each hash for a specific contract is identical across the
platforms

This PR also runs the differential E2E tests (via `retester`) with the
resolc linux musl build.

All of the above only runs if our `test` workflow succeeds.

## Related

This PR initially implemented the above in this repo but has now been
implemented into the separate testing framework instead. The most
relevant PRs implemented alongside this PR as prerequisites are:

* `revive-differential-tests`:
  * [Generate bytecode hashes included in the report
](https://github.com/paritytech/revive-differential-tests/pull/238)
* [Fix handling of resolc's optimizer `mode` and allow setting solc
optimizer
enabled](https://github.com/paritytech/revive-differential-tests/pull/243)
* [Fix solc and resolc optimization
settings](https://github.com/paritytech/revive-differential-tests/pull/253)
* [Implement a `compile` context/subcommand for standalone compilation
mode](https://github.com/paritytech/revive-differential-tests/pull/239)
* [Implement support for `--mode` CLI argument for
`compile`](https://github.com/paritytech/revive-differential-tests/pull/246)
* [Implement `export-hashes` and `compare-hashes` subcommands for report
processor
](https://github.com/paritytech/revive-differential-tests/pull/250)
* [Implement GH actions for compiling, exporting and comparing
hashes](https://github.com/paritytech/revive-differential-tests/pull/251)
* [Gate zombienet-sdk behind `cfg(unix)` to fix Windows
builds](https://github.com/paritytech/revive-differential-tests/pull/254)
* [Link library-using contracts with dummy addresses for `--compile`
command](https://github.com/paritytech/revive-differential-tests/pull/267)
* `revive`:
* [Build LLVM for Windows using MSVC-compatible
Clang](https://github.com/paritytech/revive/pull/497)
* [Apply LLVM patches for deterministic operand order and correct
peephole optimization for `minsize`
](https://github.com/paritytech/revive/pull/500)
* Investigation of comparison mismatches in third-party dependencies:
  * `llvm-project`:
* [`SelectionDAG` type legalization produces different operand ordering
for `i256` multiply across
platforms](https://github.com/llvm/llvm-project/issues/190148)
  * `solidity`:
* [Windows absolute paths in standard JSON break import resolution and
library linking](https://github.com/argotorg/solidity/issues/16579)

## Notes

### Failed compilations

Since
[resolc-compiler-tests](https://github.com/paritytech/resolc-compiler-tests)
currently includes contracts that are expected to fail resolc
compilation (e.g. due to unsupported instructions, contracts that are
expected to work with solc for evm/revm), the compilation workflow job
is not expected to fail if compilation fails for a contract.

Instead, if a contract compiles with one build but not with another, a
hash will be missing and will thereby generate a mismatch when comparing
all hashes, failing at the verification step.

## Resolved Issues

Closes [#175](https://github.com/paritytech/revive/issues/175)
2026-04-14 16:58:58 +02:00

68 lines
1.5 KiB
YAML

name: Test
on:
push:
branches: ["main"]
paths-ignore:
- "**.md"
pull_request:
branches: ["main"]
types: [opened, synchronize]
paths-ignore:
- "**.md"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# without this it will override our rust flags
rustflags: ""
components: rustfmt, clippy
- name: Install Solc
uses: ./.github/actions/get-solc
- name: Download LLVM
uses: ./.github/actions/get-llvm
with:
target: x86_64-unknown-linux-gnu
- name: Set LLVM Environment Variables
run: |
echo "LLVM_SYS_211_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
- name: Install Geth
run: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt update
sudo apt install -y ethereum
- name: Machete
uses: bnjbvr/cargo-machete@v0.7.1
- name: Format
run: make format
- name: Clippy
run: make clippy
- name: Test cargo workspace
run: make test-workspace
- name: Test docs
run: make doc
run-differential-tests:
# Only run this if `test` successfully completes.
needs: test
uses: ./.github/workflows/differential-tests.yml