2021-04-28 16:41:02 +00:00
|
|
|
name: CI
|
2021-04-30 20:22:37 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths-ignore: ['media/**', 'docs/**', '**/*.md']
|
|
|
|
pull_request:
|
|
|
|
paths-ignore: ['media/**', 'docs/**', '**/*.md']
|
2020-09-24 11:45:34 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 20
|
|
|
|
matrix:
|
|
|
|
target:
|
|
|
|
# Unit tests
|
|
|
|
- os: linux
|
|
|
|
cpu: amd64
|
|
|
|
TEST_KIND: unit-tests
|
|
|
|
- os: linux
|
|
|
|
cpu: i386
|
|
|
|
TEST_KIND: unit-tests
|
|
|
|
- os: macos
|
|
|
|
cpu: amd64
|
|
|
|
TEST_KIND: unit-tests
|
|
|
|
- os: windows
|
|
|
|
cpu: amd64
|
|
|
|
TEST_KIND: unit-tests
|
2020-09-28 12:24:52 +00:00
|
|
|
# Devel cache corrupted for mingw? missing propidl.h on PR but not push CI
|
|
|
|
# - os: windows
|
|
|
|
# cpu: i386
|
|
|
|
# TEST_KIND: unit-tests
|
2020-09-24 11:45:34 +00:00
|
|
|
|
|
|
|
# # Minimal integration tests
|
|
|
|
# - os: linux
|
|
|
|
# cpu: amd64
|
|
|
|
# TEST_KIND: finalization-minimal
|
|
|
|
# - os: linux
|
|
|
|
# cpu: i386
|
|
|
|
# TEST_KIND: finalization-minimal
|
|
|
|
# # Requires GNU getopt
|
|
|
|
# - os: macos
|
|
|
|
# cpu: amd64
|
|
|
|
# TEST_KIND: finalization-minimal
|
|
|
|
# - os: windows
|
|
|
|
# cpu: amd64
|
|
|
|
# TEST_KIND: finalization-minimal
|
2021-08-02 16:40:38 +00:00
|
|
|
# # TODO - Bootstrap issue: https://github.com/status-im/nimbus-eth2/issues/1725
|
2020-09-24 11:45:34 +00:00
|
|
|
# # - os: windows
|
|
|
|
# # cpu: i386
|
|
|
|
# # TEST_KIND: finalization-minimal
|
|
|
|
|
|
|
|
# Mainnet integration tests
|
|
|
|
# - os: linux
|
|
|
|
# cpu: amd64
|
|
|
|
# TEST_KIND: finalization-mainnet
|
|
|
|
# # - os: linux
|
|
|
|
# # cpu: i386
|
|
|
|
# # TEST_KIND: finalization-mainnet
|
|
|
|
# # - os: macos
|
|
|
|
# # cpu: amd64
|
|
|
|
# # TEST_KIND: finalization-mainnet
|
|
|
|
# - os: windows
|
|
|
|
# cpu: amd64
|
|
|
|
# TEST_KIND: finalization-mainnet
|
2021-08-02 16:40:38 +00:00
|
|
|
# # TODO - Bootstrap issue: https://github.com/status-im/nimbus-eth2/issues/1725
|
2020-09-24 11:45:34 +00:00
|
|
|
# # - os: windows
|
|
|
|
# # cpu: i386
|
|
|
|
# # TEST_KIND: finalization-mainnet
|
|
|
|
include:
|
|
|
|
- target:
|
|
|
|
os: linux
|
|
|
|
builder: ubuntu-18.04
|
|
|
|
- target:
|
|
|
|
os: macos
|
|
|
|
builder: macos-10.15
|
|
|
|
- target:
|
|
|
|
os: windows
|
|
|
|
builder: windows-2019
|
|
|
|
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (${{ matrix.target.TEST_KIND }})'
|
|
|
|
runs-on: ${{ matrix.builder }}
|
|
|
|
steps:
|
2020-09-25 12:10:35 +00:00
|
|
|
- name: Get branch name
|
|
|
|
shell: bash
|
2020-10-06 13:52:36 +00:00
|
|
|
run: |
|
2020-10-06 14:16:10 +00:00
|
|
|
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
|
2020-10-06 14:14:45 +00:00
|
|
|
echo "##[set-output name=branch_name;]$(echo ${GITHUB_HEAD_REF})"
|
|
|
|
echo "Branch found (PR): ${GITHUB_HEAD_REF}"
|
|
|
|
else
|
|
|
|
echo "##[set-output name=branch_name;]$(echo ${GITHUB_REF#refs/heads/})"
|
|
|
|
echo "Branch found (not PR): ${GITHUB_REF#refs/heads/}"
|
|
|
|
fi
|
2020-09-25 12:10:35 +00:00
|
|
|
id: get_branch
|
|
|
|
|
|
|
|
- name: Cancel Previous Runs (except master/devel)
|
|
|
|
if: >
|
2020-09-30 14:50:13 +00:00
|
|
|
steps.get_branch.outputs.branch_name != 'master' &&
|
2021-01-10 14:23:02 +00:00
|
|
|
steps.get_branch.outputs.branch_name != 'devel' &&
|
|
|
|
steps.get_branch.outputs.branch_name != 'stable' &&
|
2021-01-10 16:34:02 +00:00
|
|
|
steps.get_branch.outputs.branch_name != 'unstable' &&
|
|
|
|
steps.get_branch.outputs.branch_name != 'testing'
|
2020-09-24 11:45:34 +00:00
|
|
|
uses: styfle/cancel-workflow-action@0.5.0
|
|
|
|
with:
|
|
|
|
access_token: ${{ github.token }}
|
|
|
|
|
2021-11-25 18:41:39 +00:00
|
|
|
- name: Support longpaths (Windows)
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: git config --system core.longpaths true
|
|
|
|
|
2021-08-02 16:40:38 +00:00
|
|
|
- name: Checkout nimbus-eth2
|
2020-09-24 11:45:34 +00:00
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
2021-08-02 16:40:38 +00:00
|
|
|
path: nimbus-eth2
|
2020-09-24 11:45:34 +00:00
|
|
|
|
|
|
|
- name: Derive environment variables
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
|
|
|
ARCH=64
|
|
|
|
PLATFORM=x64
|
|
|
|
else
|
|
|
|
ARCH=32
|
|
|
|
PLATFORM=x86
|
|
|
|
fi
|
2021-01-08 10:12:10 +00:00
|
|
|
echo "ARCH=$ARCH" >> $GITHUB_ENV
|
|
|
|
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
|
2020-09-24 11:45:34 +00:00
|
|
|
|
2021-11-05 17:11:25 +00:00
|
|
|
# Stack usage test on recent enough gcc:
|
|
|
|
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
|
|
|
export NIMFLAGS="${NIMFLAGS} -d:limitStackUsage"
|
|
|
|
echo "NIMFLAGS=$NIMFLAGS" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
|
2020-09-24 11:45:34 +00:00
|
|
|
# libminiupnp / natpmp
|
|
|
|
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'i386' ]]; then
|
2020-12-10 09:18:07 +00:00
|
|
|
export CFLAGS="${CFLAGS} -m32 -mno-adx"
|
2021-01-08 10:12:10 +00:00
|
|
|
echo "CFLAGS=$CFLAGS" >> $GITHUB_ENV
|
2020-09-24 11:45:34 +00:00
|
|
|
fi
|
|
|
|
|
2021-02-02 22:31:01 +00:00
|
|
|
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
|
|
|
|
|
2020-09-24 11:45:34 +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 \
|
2020-11-13 15:00:45 +00:00
|
|
|
--no-install-recommends -yq gcc-multilib g++-multilib
|
2020-09-24 11:45:34 +00:00
|
|
|
mkdir -p external/bin
|
|
|
|
cat << EOF > external/bin/gcc
|
|
|
|
#!/bin/bash
|
2020-12-10 09:18:07 +00:00
|
|
|
exec $(which gcc) -m32 -mno-adx "\$@"
|
2020-09-24 11:45:34 +00:00
|
|
|
EOF
|
|
|
|
cat << EOF > external/bin/g++
|
|
|
|
#!/bin/bash
|
2020-12-10 09:18:07 +00:00
|
|
|
exec $(which g++) -m32 -mno-adx "\$@"
|
2020-09-24 11:45:34 +00:00
|
|
|
EOF
|
|
|
|
chmod 755 external/bin/gcc external/bin/g++
|
2021-01-08 10:12:10 +00:00
|
|
|
echo "${{ github.workspace }}/external/bin" >> $GITHUB_PATH
|
2020-09-24 11:45:34 +00:00
|
|
|
|
|
|
|
- name: Restore MinGW-W64 (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-mingw-cache
|
2020-09-25 14:05:29 +00:00
|
|
|
uses: actions/cache@v2
|
2020-09-24 11:45:34 +00:00
|
|
|
with:
|
2020-09-25 16:53:17 +00:00
|
|
|
path: external/mingw-${{ matrix.target.cpu }}
|
2021-08-02 16:40:38 +00:00
|
|
|
key: 'mingw-${{ matrix.target.cpu }}-cachekey_v2'
|
2020-09-24 11:45:34 +00:00
|
|
|
|
|
|
|
- name: Restore Nim DLLs dependencies (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-dlls-cache
|
2020-09-25 14:05:29 +00:00
|
|
|
uses: actions/cache@v2
|
2020-09-24 11:45:34 +00:00
|
|
|
with:
|
2020-09-25 16:53:17 +00:00
|
|
|
path: external/dlls-${{ matrix.target.cpu }}
|
2020-09-24 11:45:34 +00:00
|
|
|
key: 'dlls-${{ matrix.target.cpu }}'
|
|
|
|
|
|
|
|
- name: Install MinGW64 dependency (Windows)
|
|
|
|
if: >
|
|
|
|
steps.windows-mingw-cache.outputs.cache-hit != 'true' &&
|
|
|
|
runner.os == 'Windows'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p external
|
2021-08-02 16:40:38 +00:00
|
|
|
curl -L "https://nim-lang.org/download/mingw$ARCH.7z" -o "external/mingw-${{ matrix.target.cpu }}.7z"
|
2020-09-24 11:45:34 +00:00
|
|
|
7z x -y "external/mingw-${{ matrix.target.cpu }}.7z" -oexternal/
|
|
|
|
mv external/mingw$ARCH external/mingw-${{ matrix.target.cpu }}
|
|
|
|
|
|
|
|
- name: Install DLLs dependencies (Windows)
|
|
|
|
if: >
|
|
|
|
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
|
|
|
runner.os == 'Windows'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p external
|
|
|
|
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
|
|
|
|
7z x -y external/windeps.zip -oexternal/dlls-${{ matrix.target.cpu }}
|
2020-09-25 16:53:17 +00:00
|
|
|
|
|
|
|
- name: Path to cached dependencies (Windows)
|
|
|
|
if: >
|
|
|
|
runner.os == 'Windows'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-01-08 10:12:10 +00:00
|
|
|
echo "${{ github.workspace }}/external/mingw-${{ matrix.target.cpu }}/bin" >> $GITHUB_PATH
|
|
|
|
echo "${{ github.workspace }}/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
|
2020-09-24 11:45:34 +00:00
|
|
|
|
|
|
|
- name: Install build dependencies (MacOS)
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
brew install gnu-getopt
|
|
|
|
brew link --force gnu-getopt
|
|
|
|
|
|
|
|
- name: Get latest nimbus-build-system commit hash
|
|
|
|
id: versions
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
getHash() {
|
|
|
|
git ls-remote "https://github.com/$1" "${2:-HEAD}" | cut -f 1
|
|
|
|
}
|
|
|
|
nbsHash=$(getHash status-im/nimbus-build-system)
|
|
|
|
echo "::set-output name=nimbus_build_system::$nbsHash"
|
|
|
|
|
|
|
|
- name: Restore prebuilt Nim binaries from cache
|
|
|
|
id: nim-cache
|
2020-09-25 14:05:29 +00:00
|
|
|
uses: actions/cache@v2
|
2020-09-24 11:45:34 +00:00
|
|
|
with:
|
2021-08-02 16:40:38 +00:00
|
|
|
path: nimbus-eth2/NimBinaries
|
2020-09-24 11:45:34 +00:00
|
|
|
key: 'nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}'
|
|
|
|
|
2021-02-11 19:03:29 +00:00
|
|
|
- name: Build Nim and Nimbus dependencies
|
2020-09-24 11:45:34 +00:00
|
|
|
shell: bash
|
2021-08-02 16:40:38 +00:00
|
|
|
working-directory: nimbus-eth2
|
2020-09-24 11:45:34 +00:00
|
|
|
run: |
|
2021-05-19 06:38:13 +00:00
|
|
|
if [[ "${{ runner.os }}" == "macOS" ]]; then
|
|
|
|
ulimit -n 1024
|
|
|
|
fi
|
2021-02-11 19:03:29 +00:00
|
|
|
make -j$ncpu ARCH_OVERRIDE=$PLATFORM CI_CACHE=NimBinaries QUICK_AND_DIRTY_COMPILER=1 update
|
2020-09-24 11:45:34 +00:00
|
|
|
|
|
|
|
- name: Get latest fixtures commit hash
|
|
|
|
if: matrix.target.TEST_KIND == 'unit-tests'
|
|
|
|
id: fixtures_version
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
getHash() {
|
|
|
|
git ls-remote "https://github.com/$1" "${2:-HEAD}" | cut -f 1
|
|
|
|
}
|
|
|
|
fixturesHash=$(getHash status-im/nim-eth2-scenarios)
|
|
|
|
echo "::set-output name=fixtures::$fixturesHash"
|
|
|
|
|
|
|
|
- name: Restore Ethereum Foundation fixtures from cache
|
|
|
|
if: matrix.target.TEST_KIND == 'unit-tests'
|
|
|
|
id: fixtures-cache
|
2020-09-25 14:05:29 +00:00
|
|
|
uses: actions/cache@v2
|
2020-09-24 11:45:34 +00:00
|
|
|
with:
|
2021-08-02 16:40:38 +00:00
|
|
|
path: nimbus-eth2/fixturesCache
|
2020-09-25 14:05:29 +00:00
|
|
|
key: 'eth2-scenarios-${{ steps.fixtures_version.outputs.fixtures }}'
|
2020-09-24 11:45:34 +00:00
|
|
|
|
2020-09-25 16:13:46 +00:00
|
|
|
# Important: even with a cache hit, this should be run
|
|
|
|
# as it symlinks the cached items in their proper place
|
2020-09-24 11:45:34 +00:00
|
|
|
- name: Get the Ethereum Foundation fixtures
|
2020-09-25 16:13:46 +00:00
|
|
|
if: matrix.target.TEST_KIND == 'unit-tests'
|
2020-09-24 11:45:34 +00:00
|
|
|
shell: bash
|
2021-08-02 16:40:38 +00:00
|
|
|
working-directory: nimbus-eth2
|
2020-09-24 11:45:34 +00:00
|
|
|
run: |
|
2021-10-12 11:36:52 +00:00
|
|
|
scripts/setup_scenarios.sh fixturesCache
|
2020-09-24 11:45:34 +00:00
|
|
|
|
2020-09-25 14:05:29 +00:00
|
|
|
- name: Smoke test the Beacon Node and Validator Client with all tracing enabled
|
|
|
|
if: matrix.target.TEST_KIND == 'unit-tests'
|
|
|
|
shell: bash
|
2021-08-02 16:40:38 +00:00
|
|
|
working-directory: nimbus-eth2
|
2020-09-25 14:05:29 +00:00
|
|
|
run: |
|
2021-05-19 06:38:13 +00:00
|
|
|
if [[ "${{ runner.os }}" == "macOS" ]]; then
|
|
|
|
ulimit -n 1024
|
|
|
|
fi
|
2021-11-02 17:06:36 +00:00
|
|
|
make -j$ncpu ARCH_OVERRIDE=$PLATFORM LOG_LEVEL=TRACE nimbus_beacon_node nimbus_validator_client
|
2020-09-25 14:05:29 +00:00
|
|
|
|
2021-08-02 16:40:38 +00:00
|
|
|
- name: Run nimbus-eth2 tests
|
2020-09-24 11:45:34 +00:00
|
|
|
if: matrix.target.TEST_KIND == 'unit-tests'
|
|
|
|
shell: bash
|
2021-08-02 16:40:38 +00:00
|
|
|
working-directory: nimbus-eth2
|
2020-09-24 11:45:34 +00:00
|
|
|
run: |
|
2021-05-19 06:38:13 +00:00
|
|
|
if [[ "${{ runner.os }}" == "macOS" ]]; then
|
|
|
|
ulimit -n 1024
|
|
|
|
fi
|
2020-09-24 11:45:34 +00:00
|
|
|
make -j$ncpu ARCH_OVERRIDE=$PLATFORM DISABLE_TEST_FIXTURES_SCRIPT=1 test
|
|
|
|
|
2021-04-28 16:41:02 +00:00
|
|
|
# The upload creates a combined report that gets posted as a comment on the PR
|
2021-10-26 22:49:35 +00:00
|
|
|
# https://github.com/EnricoMi/publish-unit-test-result-action
|
2021-04-28 16:41:02 +00:00
|
|
|
- name: Upload combined results
|
|
|
|
if: matrix.target.TEST_KIND == 'unit-tests'
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: Unit Test Results ${{ matrix.target.os }}-${{ matrix.target.cpu }}
|
2021-08-02 16:40:38 +00:00
|
|
|
path: nimbus-eth2/build/*.xml
|
2021-04-28 16:41:02 +00:00
|
|
|
|
2021-08-02 16:40:38 +00:00
|
|
|
- name: Run nimbus-eth2 testnet0 (minimal)
|
2020-09-24 11:45:34 +00:00
|
|
|
if: matrix.target.TEST_KIND == 'finalization-minimal'
|
|
|
|
shell: bash
|
2021-08-02 16:40:38 +00:00
|
|
|
working-directory: nimbus-eth2
|
2020-09-24 11:45:34 +00:00
|
|
|
run: |
|
2021-07-16 10:02:27 +00:00
|
|
|
./scripts/launch_local_testnet.sh --preset minimal --nodes 4 --stop-at-epoch 5 --log-level DEBUG --disable-htop --enable-logtrace --data-dir local_testnet0_data --base-port 9000 --base-rpc-port 7000 --base-metrics-port 8008 --timeout 600 -- --verify-finalization --discv5:no
|
2020-09-24 11:45:34 +00:00
|
|
|
|
2021-08-02 16:40:38 +00:00
|
|
|
- name: Run nimbus-eth2 testnet1 (mainnet)
|
2020-09-24 11:45:34 +00:00
|
|
|
if: matrix.target.TEST_KIND == 'finalization-mainnet'
|
|
|
|
shell: bash
|
2021-08-02 16:40:38 +00:00
|
|
|
working-directory: nimbus-eth2
|
2020-09-24 11:45:34 +00:00
|
|
|
run: |
|
2021-07-16 10:02:27 +00:00
|
|
|
./scripts/launch_local_testnet.sh --nodes 4 --stop-at-epoch 5 --log-level DEBUG --disable-htop --enable-logtrace --data-dir local_testnet0_data --base-port 9000 --base-rpc-port 7000 --base-metrics-port 8008 --timeout 2400 -- --verify-finalization --discv5:no
|
2021-04-28 16:41:02 +00:00
|
|
|
|
2021-10-26 22:49:35 +00:00
|
|
|
# https://github.com/EnricoMi/publish-unit-test-result-action
|
|
|
|
event_file:
|
|
|
|
name: "Event File"
|
2021-04-28 16:41:02 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-10-26 22:49:35 +00:00
|
|
|
- name: Upload
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: Event File
|
|
|
|
path: ${{ github.event_path }}
|