Skip to content

ci: enable M1 runners for CI job #2370

ci: enable M1 runners for CI job

ci: enable M1 runners for CI job #2370

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
# Tag for cache invalidation
CACHE_VERSION: v9
jobs:
build:
name: Build Echidna on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
container: ${{ fromJSON(matrix.container || '{"image":null}') }}
strategy:
matrix:
include:
- os: ubuntu-latest
shell: bash
container: "{\"image\": \"elopeztob/alpine-haskell-stack-echidna:ghc-9.8.4\", \"options\": \"--user 1001\"}"
- os: macos-13 # x86_64 macOS
shell: bash
- os: macos-latest-xlarge
shell: bash
- os: windows-latest
shell: msys2 {0}
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Get Packages (macOS)
if: runner.os == 'macOS'
run: brew install autoconf automake libtool
- name: Get Packages (Windows)
uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
id: msys2
with:
msystem: CLANG64
path-type: minimal
update: true
install: >-
base-devel
gmp-devel
openssl-devel
git
unzip
pacboy: >-
cmake:p
ninja:p
clang:p
lld:p
autotools:p
gmp:p
openssl:p
- name: Install Stack
uses: haskell-actions/[email protected]
id: stack
if: matrix.container == ''
with:
ghc-version: '9.8.4'
enable-stack: true
stack-version: 'latest'
- name: Configure Stack environment
run: |
HOME="${{ (runner.os == 'Windows' && '$(cygpath -m ~)') || '$HOME' }}"
# This relative path works only if GHC was installed using chocolatey, but not when it was installed with ghcup
GHC_MINGW_PATH="${{ (runner.os == 'Windows' && '$(cygpath -m "$GHC_BIN_PATH/../mingw")') || '' }}"
if [ -n "$GHC_MINGW_PATH" ] && [ ! -d "$GHC_MINGW_PATH" ]; then
echo "The expected GHC_MINGW_PATH directory $GHC_MINGW_PATH does not exist"
echo "Trying to locate it via ghcup"
GHCUP_PATH=$(cygpath -m "C:\ghcup\bin\ghcup.exe")
GHC_REAL_PATH=$("$GHCUP_PATH" whereis ghc "$GHC_VERSION" | tr -d '\r')
GHC_MINGW_PATH="$(cygpath -m "$(dirname $GHC_REAL_PATH)"/../mingw)"
fi
echo "GHC_MINGW_PATH=$GHC_MINGW_PATH" >> "$GITHUB_ENV"
mkdir -p "$STACK_ROOT"
{ echo "extra-include-dirs:";
echo "- $HOME/.local/include";
echo "$EXTRA_INCLUDE_WIN";
echo "$EXTRA_INCLUDE_MAC_AARCH64";
echo;
echo "extra-lib-dirs:";
if [ ! "$GHC_MINGW_PATH" = "" ]; then
echo "- $GHC_MINGW_PATH/x86_64-w64-mingw32/lib";
echo "- $GHC_MINGW_PATH/lib";
echo "- D:/a/_temp/msys64/clang64/lib";
fi;
echo "- $HOME/.local/lib";
echo "$EXTRA_LIB_WIN";
echo "$EXTRA_LIB_MAC_AARCH64";
echo;
echo "ghc-options:";
echo ' "$locals": -Werror'
"$REPLACE_LINKER_WIN" && echo ' "$everything": -pgml='$(cygpath -m "$GHC_MINGW_PATH/bin/clang.exe") -optc-idirafter -optc'D:/a/_temp/msys64/clang64/include' -optcxx-idirafter -optcxx'D:/a/_temp/msys64/clang64/include';
echo;
"$SKIP_MSYS" && echo "skip-msys: true" || true
echo "system-ghc: true";
echo "install-ghc: false";
echo "skip-ghc-check: true";
} >> "$STACK_ROOT/config.yaml"
cat "$STACK_ROOT/config.yaml"
env:
STACK_ROOT: ${{ steps.stack.outputs.stack-root || '/etc/stack' }}
REPLACE_LINKER_WIN: ${{ (runner.os == 'Windows' && 'true') || 'false' }}
EXTRA_INCLUDE_MAC_AARCH64: ${{ (runner.os == 'macOS' && runner.arch == 'ARM64' && '- /opt/homebrew/include') || '' }}
EXTRA_LIB_MAC_AARCH64: ${{ (runner.os == 'macOS' && runner.arch == 'ARM64' && '- /opt/homebrew/lib') || '' }}
SKIP_MSYS: ${{ (runner.os == 'Windows' && 'true') || 'false' }}
GHC_BIN_PATH: ${{ steps.stack.outputs.ghc-path }}
GHC_VERSION: ${{ steps.stack.outputs.ghc-version }}
- name: Configure Haskell paths (Windows)
if: runner.os == 'Windows'
run: |
HASKELL_PATHS="$(cygpath -u "$GHC_PATH"):$(cygpath -u "$CABAL_PATH"):$(cygpath -u "$STACK_PATH")"
HASKELL_MINGW_PATH="$(cygpath -u "$GHC_MINGW_PATH")"
SYSTEM_MINGW_PATH="$(cygpath -m "$MSYS2_LOCATION/$MSYSTEM")"
echo "HASKELL_PATHS=$HASKELL_PATHS" >> "$GITHUB_ENV"
echo "HASKELL_MINGW_PATH=$HASKELL_MINGW_PATH" >> "$GITHUB_ENV"
echo "SYSTEM_MINGW_PATH=$SYSTEM_MINGW_PATH" >> "$GITHUB_ENV"
env:
GHC_PATH: ${{ steps.stack.outputs.ghc-path }}
CABAL_PATH: ${{ steps.stack.outputs.cabal-path }}
STACK_PATH: ${{ steps.stack.outputs.stack-path }}
MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
- name: Checkout
uses: actions/checkout@v5
- name: Cache Local
uses: actions/cache@v4
with:
path: |
~/.local
D:\a\_temp\msys64\home\runneradmin\.local
key: ${{ runner.os }}-${{ runner.arch }}-local-${{ env.CACHE_VERSION }}-${{ hashFiles('.github/scripts/install-*') }}
- name: Configure static build flags
run: |
printf "\nflags:\n hevm:\n static-secp256k1: true\n echidna:\n static: true\n" >> stack.yaml
- name: Cache Stack & Cabal
uses: actions/cache@v4
with:
path: |
.stack-work
${{ steps.stack.outputs.cabal-store || '~/.cabal' }}/*
${{ steps.stack.outputs.stack-root || '~/.stack' }}/*
!${{ steps.stack.outputs.stack-root || '~/.stack' }}/pantry/hackage/*.tar
!${{ steps.stack.outputs.stack-root || '~/.stack' }}/pantry/hackage/*.tar.gz
!${{ steps.stack.outputs.stack-root || '~/.stack' }}/config.yaml
key: ${{ runner.os }}-${{ runner.arch }}-stack-${{ env.CACHE_VERSION }}-${{ hashFiles('package.yaml', 'stack.yaml') }}
- name: Build Libraries
run: |
if [ "$HOST_OS" = "Windows" ]; then
export PATH="$(cygpath -u "$HASKELL_MINGW_PATH/bin"):$PATH"
fi
.github/scripts/install-libsecp256k1.sh
.github/scripts/install-libff.sh
env:
HOST_OS: ${{ runner.os }}
GHC_BIN_PATH: ${{ steps.stack.outputs.ghc-path }}
- name: Build Dependencies
run: |
export PATH="$HASKELL_PATHS:$PATH"
stack build --ghc-options="-Werror" --only-dependencies
- name: Build and install echidna
run: |
export PATH="$HASKELL_PATHS:$PATH"
stack install --ghc-options="-Werror"
- name: Amend and compress binaries (macOS)
if: runner.os == 'macOS'
run: .github/scripts/build-macos-release.sh
- name: Compress binary (Linux)
if: runner.os == 'Linux'
run: GZIP=-9 tar -czf echidna.tar.gz -C $HOME/.local/bin/ echidna
- name: Compress binary (Windows)
if: runner.os == 'Windows'
run: GZIP=-9 tar -czf echidna.tar.gz -C $APPDATA/local/bin/ echidna.exe
- name: Generate artifact name
id: artifact-name
run: |
case "$OS-$ARCH" in
macOS-ARM64)
NAME="aarch64-macos"
;;
macOS-X64)
NAME="x86_64-macos"
;;
Windows-X64)
NAME="x86_64-windows"
;;
Linux-X64)
NAME="x86_64-linux"
;;
*)
echo "Unknown os-arch combo: ${OS}-${ARCH}"
exit 1
;;
esac
echo "name=${NAME}" >> "$GITHUB_OUTPUT"
env:
OS: ${{ runner.os }}
ARCH: ${{ runner.arch }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: echidna-${{ steps.artifact-name.outputs.name }}
path: echidna.tar.gz
- name: Build and copy test suite
if: runner.os != 'macOS'
run: |
export PATH="$HASKELL_PATHS:$PATH"
stack build --test --no-run-tests --ghc-options="-Werror"
cp "$(find "$PWD" -name 'echidna-testsuite*' -type f)" .
- name: Upload testsuite
if: runner.os != 'macOS'
uses: actions/upload-artifact@v4
with:
name: echidna-testsuite-${{ runner.os }}
path: echidna-testsuite*
test:
name: Test with solc ${{ matrix.solc }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build
continue-on-error: ${{ matrix.experimental || false }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
solc: ${{
((github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci-all-solc'))) &&
fromJSON('["0.4.25", "0.5.7", "0.6.12", "0.7.5", "0.8.10", "0.8.25"]') ||
fromJSON('["0.8.10", "0.8.25"]')
}}
include:
- os: windows-latest
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install dependencies
shell: bash
run: |
.github/scripts/install-solc.sh
.github/scripts/install-crytic-compile.sh
.github/scripts/install-z3.sh
.github/scripts/install-bitwuzla.sh
env:
HOST_OS: ${{ runner.os }}
SOLC_VER: ${{ matrix.solc }}
- name: Download testsuite
uses: actions/download-artifact@v5
with:
name: echidna-testsuite-${{ runner.os }}
- name: Test
run: |
export PATH="$PATH:$HOME/.local/bin"
solc-select use ${{ matrix.solc }}
chmod +x echidna-testsuite*
./echidna-testsuite*
shell: bash