2022-11-23 16:11:38 +00:00
|
|
|
name: Nimbus CI
|
2021-04-27 09:55:11 +00:00
|
|
|
on:
|
|
|
|
push:
|
2021-06-16 19:18:45 +00:00
|
|
|
paths-ignore: ['doc/**', 'docs/**', '**/*.md', 'hive_integration/**',
|
2022-11-23 16:11:38 +00:00
|
|
|
'fluffy/**', '.github/workflows/fluffy.yml',
|
|
|
|
'nimbus_verified_proxy/**', '.github/workflows/nimbus_verified_proxy.yml',
|
|
|
|
]
|
CI: Restore "push" events but disable "pull_request"
Reverts part of commit 2539bd9 while keeping the intention of it:
To avoid duplicate CI runs when making and updating a PR.
Disabling `push` means we cannot push to a branch and see the CI results
directly without making a PR, which some of us use. There are many situations
where this is useful, and "[WIP]" PRs are not appropriate for all.
Disabling `pull_request` has a similar effect, removing duplicate CI.
It is known that `pull_request` _is_ needed when a third party sends a
PR (because it's not committed to the repo yet). But this is rare at the
moment, and there's a workaround: A committer can push the third party change
to a branch, triggering CI.
So re-enable `push`, disable `pull_request`, and we'll see if the latter
missing causes problems in practice. Won't know until we try it.
Note: This might be interim until `workflow_dispatch` is working better.
Perhaps that needs more configuration. Currently, `workflow_dispatch` is kind
of useless for CI tests, because it doesn't result in any CI indicator
associated with a commit or branch. Even the actions page doesn't show the
name of the branch, just a less-than-useful generic "CI" for these actions.
Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-05-28 12:30:35 +00:00
|
|
|
# Disable `pull_request`. Experimenting with using only `push` for PRs.
|
|
|
|
#pull_request:
|
|
|
|
# paths-ignore: ['doc/**', 'docs/**', '**/*.md', 'hive_integration/**']
|
2021-05-28 14:14:01 +00:00
|
|
|
workflow_dispatch:
|
2021-01-06 07:40:07 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 20
|
|
|
|
matrix:
|
|
|
|
target:
|
2021-04-14 03:08:12 +00:00
|
|
|
- os: linux
|
|
|
|
cpu: amd64
|
|
|
|
evmc: evmc
|
2023-09-08 15:10:16 +00:00
|
|
|
#- os: linux
|
|
|
|
# cpu: i386
|
|
|
|
# evmc: evmc
|
2021-01-19 09:02:24 +00:00
|
|
|
- os: macos
|
|
|
|
cpu: amd64
|
|
|
|
evmc: evmc
|
2021-04-14 03:08:12 +00:00
|
|
|
- os: windows
|
|
|
|
cpu: amd64
|
|
|
|
evmc: evmc
|
2021-04-08 14:52:10 +00:00
|
|
|
- os: linux
|
|
|
|
cpu: amd64
|
2023-06-27 00:40:01 +00:00
|
|
|
evmc: nimvm
|
2023-09-08 15:10:16 +00:00
|
|
|
#- os: linux
|
|
|
|
# cpu: i386
|
|
|
|
# evmc: nimvm
|
2021-04-08 14:52:10 +00:00
|
|
|
- os: windows
|
|
|
|
cpu: amd64
|
2023-06-27 00:40:01 +00:00
|
|
|
evmc: nimvm
|
2021-04-08 14:52:10 +00:00
|
|
|
- os: macos
|
|
|
|
cpu: amd64
|
2023-06-27 00:40:01 +00:00
|
|
|
evmc: nimvm
|
2021-01-06 07:40:07 +00:00
|
|
|
include:
|
|
|
|
- target:
|
|
|
|
os: linux
|
2022-08-16 07:17:57 +00:00
|
|
|
builder: ubuntu-20.04
|
2021-01-06 07:40:07 +00:00
|
|
|
- target:
|
|
|
|
os: macos
|
2022-07-28 02:19:57 +00:00
|
|
|
builder: macos-11
|
2021-01-06 07:40:07 +00:00
|
|
|
- target:
|
|
|
|
os: windows
|
2021-04-08 15:46:00 +00:00
|
|
|
builder: windows-latest
|
2021-01-06 07:40:07 +00:00
|
|
|
|
2021-04-08 15:46:00 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
2023-09-08 15:10:16 +00:00
|
|
|
shell: bash
|
2021-04-08 15:46:00 +00:00
|
|
|
|
|
|
|
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.target.evmc }}'
|
2021-01-06 07:40:07 +00:00
|
|
|
runs-on: ${{ matrix.builder }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout nimbus-eth1
|
2022-11-17 02:52:07 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-04-08 15:46:00 +00:00
|
|
|
|
|
|
|
- name: Derive environment variables
|
|
|
|
run: |
|
|
|
|
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
|
|
|
PLATFORM=x64
|
|
|
|
GOARCH=amd64
|
|
|
|
USE_MIRACL=0
|
|
|
|
else
|
|
|
|
PLATFORM=x86
|
|
|
|
GOARCH=386
|
|
|
|
USE_MIRACL=1
|
|
|
|
fi
|
|
|
|
echo "PLATFORM=${PLATFORM}" >> $GITHUB_ENV
|
|
|
|
echo "GOARCH=${GOARCH}" >> $GITHUB_ENV
|
|
|
|
echo "USE_MIRACL=${USE_MIRACL}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
# libminiupnp / natpmp
|
|
|
|
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'i386' ]]; then
|
|
|
|
export CFLAGS="${CFLAGS} -m32 -mno-adx"
|
|
|
|
echo "CFLAGS=${CFLAGS}" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
|
|
|
|
ncpu=''
|
|
|
|
case '${{ runner.os }}' in
|
|
|
|
'Linux')
|
|
|
|
ncpu=$(nproc)
|
|
|
|
;;
|
|
|
|
'macOS')
|
|
|
|
ncpu=$(sysctl -n hw.ncpu)
|
|
|
|
;;
|
|
|
|
'Windows')
|
|
|
|
ncpu=${NUMBER_OF_PROCESSORS}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
|
|
|
|
echo "ncpu=${ncpu}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
if [[ '${{ matrix.target.evmc }}' == 'evmc' ]]; then
|
|
|
|
echo "ENABLE_EVMC=1" >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo "ENABLE_EVMC=0" >> $GITHUB_ENV
|
2022-09-26 04:56:54 +00:00
|
|
|
fi
|
|
|
|
|
2021-01-06 07:40:07 +00:00
|
|
|
- name: Install build dependencies (Linux i386)
|
|
|
|
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
|
|
|
run: |
|
|
|
|
sudo dpkg --add-architecture i386
|
|
|
|
sudo apt-fast update -qq
|
|
|
|
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
|
|
|
|
--no-install-recommends -yq gcc-multilib g++-multilib \
|
|
|
|
libz-dev:i386 libbz2-dev:i386 libssl-dev:i386 libpcre3-dev:i386
|
|
|
|
mkdir -p external/bin
|
|
|
|
cat << EOF > external/bin/gcc
|
|
|
|
#!/bin/bash
|
|
|
|
exec $(which gcc) -m32 "\$@"
|
|
|
|
EOF
|
|
|
|
cat << EOF > external/bin/g++
|
|
|
|
#!/bin/bash
|
|
|
|
exec $(which g++) -m32 "\$@"
|
|
|
|
EOF
|
|
|
|
chmod 755 external/bin/gcc external/bin/g++
|
|
|
|
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH
|
|
|
|
|
2023-01-20 15:01:29 +00:00
|
|
|
- name: Install build dependencies (Macos)
|
|
|
|
# Some home brew modules were reported missing
|
|
|
|
if: runner.os == 'Macos'
|
|
|
|
run: |
|
|
|
|
HOMEBREW_NO_INSTALL_CLEANUP=1 brew install gnu-getopt
|
|
|
|
brew link --force gnu-getopt
|
|
|
|
|
2021-01-16 11:26:55 +00:00
|
|
|
- name: Restore rocksdb from cache (Macos/Linux)
|
|
|
|
if: runner.os != 'Windows'
|
2021-01-06 07:40:07 +00:00
|
|
|
id: rocksdb-cache
|
2022-11-17 02:52:07 +00:00
|
|
|
uses: actions/cache@v3
|
2021-01-06 07:40:07 +00:00
|
|
|
with:
|
|
|
|
path: rocks-db-cache-${{ matrix.target.cpu }}
|
2022-01-12 20:41:23 +00:00
|
|
|
key: 'rocksdb-v2-${{ matrix.target.os }}-${{ matrix.target.cpu }}'
|
2021-01-06 07:40:07 +00:00
|
|
|
|
|
|
|
- name: Build and install rocksdb (Linux i386)
|
|
|
|
# no librocksdb-dev:i386
|
|
|
|
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
|
|
|
run: |
|
|
|
|
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_rocksdb.sh
|
|
|
|
bash build_rocksdb.sh rocks-db-cache-${{ matrix.target.cpu }}
|
|
|
|
|
|
|
|
- name: Install rocksdb (Linux amd64)
|
|
|
|
# mysterious illegal instruction error if we build our own librocksdb
|
|
|
|
if: runner.os == 'Linux' && matrix.target.cpu == 'amd64'
|
|
|
|
run: |
|
|
|
|
sudo apt-get -q update
|
|
|
|
sudo apt-get install -y librocksdb-dev libpcre3-dev
|
|
|
|
|
|
|
|
- name: Build and install rocksdb (Macos)
|
|
|
|
if: runner.os == 'Macos'
|
|
|
|
run: |
|
|
|
|
HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install ccache
|
2021-04-08 15:46:00 +00:00
|
|
|
echo "/usr/local/opt/ccache/libexec" >> ${GITHUB_PATH}
|
2021-01-06 07:40:07 +00:00
|
|
|
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_rocksdb.sh
|
|
|
|
bash build_rocksdb.sh rocks-db-cache-${{ matrix.target.cpu }}
|
|
|
|
|
2023-09-08 15:10:16 +00:00
|
|
|
- name: Restore llvm-mingw (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-mingw-cache
|
|
|
|
uses: actions/cache@v3
|
2021-01-06 07:40:07 +00:00
|
|
|
with:
|
2023-09-08 15:10:16 +00:00
|
|
|
path: external/mingw-${{ matrix.target.cpu }}
|
|
|
|
key: 'mingw-llvm-17-${{ matrix.target.cpu }}'
|
2021-01-06 07:40:07 +00:00
|
|
|
|
|
|
|
- name: Restore Nim DLLs dependencies (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-dlls-cache
|
2022-11-17 02:52:07 +00:00
|
|
|
uses: actions/cache@v3
|
2021-01-06 07:40:07 +00:00
|
|
|
with:
|
|
|
|
path: external/dlls-${{ matrix.target.cpu }}
|
2022-01-18 16:19:32 +00:00
|
|
|
# according to docu, idle caches are kept for up to 7 days
|
|
|
|
# so change dlls# to force new cache contents (for some number #)
|
|
|
|
key: dlls0-${{ matrix.target.cpu }}
|
2021-01-06 07:40:07 +00:00
|
|
|
|
2023-09-08 15:10:16 +00:00
|
|
|
- name: Install llvm-mingw dependency (Windows)
|
|
|
|
if: >
|
|
|
|
steps.windows-mingw-cache.outputs.cache-hit != 'true' &&
|
|
|
|
runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
mkdir -p external
|
|
|
|
MINGW_BASE="https://github.com/mstorsjo/llvm-mingw/releases/download/20230905"
|
|
|
|
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
|
|
|
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-x86_64.zip"
|
|
|
|
ARCH=64
|
|
|
|
else
|
|
|
|
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-i686.zip"
|
|
|
|
ARCH=32
|
|
|
|
fi
|
|
|
|
curl -L "$MINGW_URL" -o "external/mingw-${{ matrix.target.cpu }}.zip"
|
|
|
|
7z x -y "external/mingw-${{ matrix.target.cpu }}.zip" -oexternal/mingw-${{ matrix.target.cpu }}/
|
|
|
|
mv external/mingw-${{ matrix.target.cpu }}/**/* ./external/mingw-${{ matrix.target.cpu }}
|
|
|
|
|
2021-01-06 07:40:07 +00:00
|
|
|
- name: Install DLLs dependencies (Windows)
|
|
|
|
if: >
|
|
|
|
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
|
|
|
runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
|
|
|
ROCKSDBSUB=x64
|
|
|
|
else
|
|
|
|
ROCKSDBSUB=x86
|
|
|
|
fi
|
|
|
|
DLLPATH=external/dlls-${{ matrix.target.cpu }}
|
|
|
|
mkdir -p external
|
|
|
|
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
|
|
|
|
7z x -y external/windeps.zip -o"$DLLPATH"
|
|
|
|
# ROCKSDB
|
|
|
|
curl -L "https://github.com/status-im/nimbus-deps/releases/download/nimbus-deps/nimbus-deps.zip" -o external/nimbus-deps.zip
|
|
|
|
7z x -y external/nimbus-deps.zip
|
|
|
|
cp "./$ROCKSDBSUB/librocksdb.dll" "$DLLPATH/librocksdb.dll"
|
|
|
|
|
|
|
|
- name: Path to cached dependencies (Windows)
|
|
|
|
if: >
|
|
|
|
runner.os == 'Windows'
|
|
|
|
run: |
|
2023-09-08 15:10:16 +00:00
|
|
|
echo '${{ github.workspace }}'"/external/mingw-${{ matrix.target.cpu }}/bin" >> $GITHUB_PATH
|
|
|
|
echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
|
2021-01-06 07:40:07 +00:00
|
|
|
|
|
|
|
- name: Get latest nimbus-build-system commit hash
|
|
|
|
id: versions
|
|
|
|
run: |
|
|
|
|
getHash() {
|
|
|
|
git ls-remote "https://github.com/$1" "${2:-HEAD}" | cut -f 1
|
|
|
|
}
|
|
|
|
nbsHash=$(getHash status-im/nimbus-build-system)
|
2022-11-17 02:52:07 +00:00
|
|
|
echo "nimbus_build_system=$nbsHash" >> $GITHUB_OUTPUT
|
2021-01-06 07:40:07 +00:00
|
|
|
|
|
|
|
- name: Restore prebuilt Nim from cache
|
|
|
|
id: nim-cache
|
2022-11-17 02:52:07 +00:00
|
|
|
uses: actions/cache@v3
|
2021-01-06 07:40:07 +00:00
|
|
|
with:
|
2022-07-28 02:19:57 +00:00
|
|
|
path: NimBinCache
|
2021-01-06 07:40:07 +00:00
|
|
|
key: 'nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}'
|
|
|
|
|
2021-04-08 15:46:00 +00:00
|
|
|
- name: Build Nim and Nimbus-eth1 dependencies
|
2021-01-19 09:02:24 +00:00
|
|
|
run: |
|
2022-07-28 02:19:57 +00:00
|
|
|
make -j${ncpu} ARCH_OVERRIDE=${PLATFORM} CI_CACHE=NimBinCache update
|
2021-01-06 07:40:07 +00:00
|
|
|
|
|
|
|
- name: Run nimbus-eth1 tests (Windows)
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
2021-04-08 15:46:00 +00:00
|
|
|
gcc --version
|
2022-09-26 04:56:54 +00:00
|
|
|
DEFAULT_MAKE_FLAGS="-j${ncpu} ENABLE_EVMC=${ENABLE_EVMC} ENABLE_VMLOWMEM=${ENABLE_VMLOWMEM}"
|
2021-04-08 15:46:00 +00:00
|
|
|
mingw32-make ${DEFAULT_MAKE_FLAGS}
|
2021-01-06 07:40:07 +00:00
|
|
|
build/nimbus.exe --help
|
2023-05-27 13:52:48 +00:00
|
|
|
# give us more space
|
|
|
|
find . -type d -name ".git" -exec rm -rf {} +
|
|
|
|
find . -type d -name "nimcache" -exec rm -rf {} +
|
2021-04-08 15:46:00 +00:00
|
|
|
mingw32-make ${DEFAULT_MAKE_FLAGS} test
|
2021-01-06 07:40:07 +00:00
|
|
|
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
2022-03-27 11:21:15 +00:00
|
|
|
mingw32-make ${DEFAULT_MAKE_FLAGS}
|
2021-01-06 07:40:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Run nimbus-eth1 tests (Linux)
|
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
2021-04-08 15:46:00 +00:00
|
|
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
|
|
|
|
DEFAULT_MAKE_FLAGS="-j${ncpu} USE_MIRACL=${USE_MIRACL} ENABLE_EVMC=${ENABLE_EVMC}"
|
|
|
|
env CC=gcc make ${DEFAULT_MAKE_FLAGS}
|
2021-01-06 07:40:07 +00:00
|
|
|
build/nimbus --help
|
2021-01-16 11:26:55 +00:00
|
|
|
# CC, GOARCH, and CGO_ENABLED are needed to select correct compiler 32/64 bit
|
2022-04-06 05:28:19 +00:00
|
|
|
if [[ '${{ matrix.target.cpu }}' == 'i386' ]]; then
|
|
|
|
# hide CI failures
|
|
|
|
env CC=gcc GOARCH=${GOARCH} CXX=g++ CGO_ENABLED=1 make ${DEFAULT_MAKE_FLAGS} test || true
|
|
|
|
else
|
2023-02-26 15:44:05 +00:00
|
|
|
# pushd vendor/nimbus-eth2
|
|
|
|
# env NIMBUSEL_BINARY=../../build/nimbus NIMBUSEL_GENESIS=scripts/nimbusel_genesis.json \
|
|
|
|
# ./scripts/launch_local_testnet.sh --nodes=3 --stop-at-epoch=7 \
|
|
|
|
# --disable-htop --reuse-binaries --run-nimbus-el --dl-eth2 --verbose --kill-old-processes
|
|
|
|
# popd
|
2022-04-06 05:28:19 +00:00
|
|
|
env CC=gcc GOARCH=${GOARCH} CXX=g++ CGO_ENABLED=1 make ${DEFAULT_MAKE_FLAGS} test
|
|
|
|
fi
|
2021-01-06 07:40:07 +00:00
|
|
|
|
|
|
|
- name: Run nimbus-eth1 tests (Macos)
|
|
|
|
if: runner.os == 'Macos'
|
|
|
|
run: |
|
2022-03-27 11:21:15 +00:00
|
|
|
export ZERO_AR_DATE=1 # avoid timestamps in binaries
|
2021-04-08 15:46:00 +00:00
|
|
|
DEFAULT_MAKE_FLAGS="-j${ncpu} ENABLE_EVMC=${ENABLE_EVMC}"
|
|
|
|
make ${DEFAULT_MAKE_FLAGS}
|
2021-01-06 07:40:07 +00:00
|
|
|
build/nimbus --help
|
|
|
|
# "-static" option will not work for osx unless static system libraries are provided
|
2023-02-26 15:44:05 +00:00
|
|
|
# pushd vendor/nimbus-eth2
|
|
|
|
# env NIMBUSEL_BINARY=../../build/nimbus NIMBUSEL_GENESIS=scripts/nimbusel_genesis.json \
|
|
|
|
# ./scripts/launch_local_testnet.sh --nodes=3 --stop-at-epoch=7 \
|
|
|
|
# --disable-htop --reuse-binaries --run-nimbus-el --dl-eth2 --verbose --kill-old-processes
|
|
|
|
# popd
|
2022-03-27 11:21:15 +00:00
|
|
|
make ${DEFAULT_MAKE_FLAGS} test
|
2021-04-08 15:46:00 +00:00
|
|
|
|