2024-02-28 18:04:34 +00:00
|
|
|
# beacon_chain
|
|
|
|
# Copyright (c) 2021-2024 Status Research & Development GmbH
|
|
|
|
# Licensed and distributed under either of
|
|
|
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
|
|
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
|
|
|
2021-05-18 17:18:22 +00:00
|
|
|
name: Daily
|
|
|
|
on:
|
|
|
|
schedule:
|
2021-05-20 18:00:38 +00:00
|
|
|
- cron: "10 20 * * *"
|
2021-08-18 12:40:03 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
#pull_request:
|
2021-05-18 17:18:22 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
target:
|
|
|
|
- os: linux
|
|
|
|
cpu: amd64
|
|
|
|
- os: linux
|
|
|
|
cpu: i386
|
|
|
|
- os: macos
|
|
|
|
cpu: amd64
|
|
|
|
- os: windows
|
|
|
|
cpu: amd64
|
2024-10-06 15:11:46 +00:00
|
|
|
branch: [upstream/version-2-0, upstream/devel]
|
2021-05-18 17:18:22 +00:00
|
|
|
include:
|
2024-10-06 15:11:46 +00:00
|
|
|
- branch: upstream/version-2-0
|
|
|
|
branch-short: version-2-0
|
2024-03-04 14:21:28 +00:00
|
|
|
- branch: upstream/devel
|
|
|
|
branch-short: devel
|
|
|
|
nimflags-extra: --mm:refc
|
2021-05-18 17:18:22 +00:00
|
|
|
- target:
|
|
|
|
os: linux
|
2022-08-18 18:07:57 +00:00
|
|
|
builder: ubuntu-20.04
|
2021-05-18 17:18:22 +00:00
|
|
|
shell: bash
|
|
|
|
- target:
|
|
|
|
os: macos
|
2024-10-06 15:11:46 +00:00
|
|
|
builder: macos-13
|
2021-05-18 17:18:22 +00:00
|
|
|
shell: bash
|
|
|
|
- target:
|
|
|
|
os: windows
|
|
|
|
builder: windows-2019
|
|
|
|
shell: msys2 {0}
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: ${{ matrix.shell }}
|
|
|
|
|
2024-03-04 14:21:28 +00:00
|
|
|
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch-short }})'
|
2021-05-18 17:18:22 +00:00
|
|
|
runs-on: ${{ matrix.builder }}
|
2024-03-04 14:21:28 +00:00
|
|
|
continue-on-error: ${{ matrix.branch-short == 'devel' }}
|
2021-05-18 17:18:22 +00:00
|
|
|
steps:
|
2022-02-25 08:19:12 +00:00
|
|
|
- name: Checkout
|
2021-08-18 12:40:03 +00:00
|
|
|
if: ${{ github.event_name != 'pull_request' }}
|
2024-02-28 18:04:34 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-05-18 17:18:22 +00:00
|
|
|
with:
|
|
|
|
ref: unstable
|
|
|
|
|
2022-02-25 08:19:12 +00:00
|
|
|
- name: Checkout (pull request)
|
2021-08-18 12:40:03 +00:00
|
|
|
if: ${{ github.event_name == 'pull_request' }}
|
2024-02-28 18:04:34 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-05-18 17:18:22 +00:00
|
|
|
|
|
|
|
- name: Install build dependencies (Linux i386)
|
|
|
|
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
|
|
|
run: |
|
|
|
|
sudo dpkg --add-architecture i386
|
2024-10-15 21:45:28 +00:00
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo DEBIAN_FRONTEND='noninteractive' apt-get install \
|
2021-05-18 17:18:22 +00:00
|
|
|
--no-install-recommends -yq gcc-multilib g++-multilib
|
|
|
|
mkdir -p external/bin
|
|
|
|
cat << EOF > external/bin/gcc
|
|
|
|
#!/bin/bash
|
|
|
|
exec $(which gcc) -m32 -mno-adx "\$@"
|
|
|
|
EOF
|
|
|
|
cat << EOF > external/bin/g++
|
|
|
|
#!/bin/bash
|
|
|
|
exec $(which g++) -m32 -mno-adx "\$@"
|
|
|
|
EOF
|
|
|
|
chmod 755 external/bin/gcc external/bin/g++
|
|
|
|
echo "${{ github.workspace }}/external/bin" >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: MSYS2 (Windows amd64)
|
|
|
|
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64'
|
|
|
|
uses: msys2/setup-msys2@v2
|
|
|
|
with:
|
|
|
|
path-type: inherit
|
|
|
|
install: >-
|
|
|
|
base-devel
|
|
|
|
git
|
|
|
|
mingw-w64-x86_64-toolchain
|
2022-06-14 11:35:17 +00:00
|
|
|
mingw-w64-x86_64-cmake
|
2021-05-18 17:18:22 +00:00
|
|
|
|
|
|
|
- name: Restore Nim DLLs dependencies (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-dlls-cache
|
2024-02-28 18:04:34 +00:00
|
|
|
uses: actions/cache@v4
|
2021-05-18 17:18:22 +00:00
|
|
|
with:
|
2022-02-25 08:19:12 +00:00
|
|
|
path: external/dlls
|
2021-05-18 17:18:22 +00:00
|
|
|
key: 'dlls-${{ matrix.target.cpu }}'
|
|
|
|
|
|
|
|
- name: Install DLLs dependencies (Windows)
|
|
|
|
if: >
|
|
|
|
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
|
|
|
runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
mkdir -p external
|
|
|
|
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
|
2022-02-25 08:19:12 +00:00
|
|
|
7z x -y external/windeps.zip -oexternal/dlls
|
2021-05-18 17:18:22 +00:00
|
|
|
|
|
|
|
- name: Path to cached dependencies (Windows)
|
|
|
|
if: >
|
|
|
|
runner.os == 'Windows'
|
|
|
|
run: |
|
2022-02-25 08:19:12 +00:00
|
|
|
echo "${{ github.workspace }}/external/dlls" >> $GITHUB_PATH
|
2021-08-18 12:40:03 +00:00
|
|
|
# for miniupnp that runs "wingenminiupnpcstrings.exe" from the current dir
|
|
|
|
echo "." >> $GITHUB_PATH
|
2021-05-18 17:18:22 +00:00
|
|
|
|
|
|
|
- name: Install build dependencies (macOS)
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
|
|
|
brew install gnu-getopt
|
|
|
|
brew link --force gnu-getopt
|
|
|
|
|
2021-08-18 12:40:03 +00:00
|
|
|
- name: Derive environment variables
|
|
|
|
run: |
|
|
|
|
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
|
|
|
PLATFORM=x64
|
|
|
|
else
|
|
|
|
PLATFORM=x86
|
|
|
|
fi
|
|
|
|
echo "PLATFORM=${PLATFORM}" >> $GITHUB_ENV
|
|
|
|
|
2022-02-25 08:19:12 +00:00
|
|
|
# Stack usage test on recent enough gcc:
|
|
|
|
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
|
|
|
export NIMFLAGS="${NIMFLAGS} -d:limitStackUsage"
|
|
|
|
fi
|
|
|
|
|
2021-08-18 12:40:03 +00:00
|
|
|
# libminiupnp / natpmp
|
|
|
|
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'i386' ]]; then
|
|
|
|
export CFLAGS="${CFLAGS} -m32 -mno-adx"
|
|
|
|
echo "CFLAGS=${CFLAGS}" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
|
2024-03-04 14:21:28 +00:00
|
|
|
export NIMFLAGS="${NIMFLAGS} ${{ matrix.nimflags-extra }}"
|
|
|
|
echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV
|
|
|
|
|
2021-08-18 12:40:03 +00:00
|
|
|
ncpu=""
|
2022-06-14 11:35:17 +00:00
|
|
|
make_cmd="make"
|
2021-08-18 12:40:03 +00:00
|
|
|
case '${{ runner.os }}' in
|
|
|
|
'Linux')
|
|
|
|
ncpu=$(nproc)
|
|
|
|
;;
|
|
|
|
'macOS')
|
|
|
|
ncpu=$(sysctl -n hw.ncpu)
|
|
|
|
;;
|
|
|
|
'Windows')
|
|
|
|
ncpu=${NUMBER_OF_PROCESSORS}
|
2022-06-14 11:35:17 +00:00
|
|
|
make_cmd="mingw32-make"
|
2021-08-18 12:40:03 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
|
|
|
|
echo "ncpu=${ncpu}" >> $GITHUB_ENV
|
2022-06-14 11:35:17 +00:00
|
|
|
echo "make_cmd=${make_cmd}" >> $GITHUB_ENV
|
2021-08-18 12:40:03 +00:00
|
|
|
|
2021-05-20 18:00:38 +00:00
|
|
|
- name: Build Nim and Nimbus dependencies
|
|
|
|
run: |
|
2022-06-14 11:35:17 +00:00
|
|
|
${make_cmd} -j ${ncpu} NIM_COMMIT=${{ matrix.branch }} ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update
|
2021-12-15 19:43:17 +00:00
|
|
|
./env.sh nim --version
|
2021-05-20 18:00:38 +00:00
|
|
|
|
2021-05-18 17:18:22 +00:00
|
|
|
- name: Get latest fixtures commit hash
|
|
|
|
id: fixtures_version
|
|
|
|
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
|
|
|
|
id: fixtures-cache
|
2024-02-28 18:04:34 +00:00
|
|
|
uses: actions/cache@v4
|
2021-05-18 17:18:22 +00:00
|
|
|
with:
|
|
|
|
path: fixturesCache
|
|
|
|
key: 'eth2-scenarios-${{ steps.fixtures_version.outputs.fixtures }}'
|
|
|
|
|
|
|
|
- name: Get the Ethereum Foundation fixtures
|
|
|
|
run: |
|
2021-10-12 11:36:52 +00:00
|
|
|
scripts/setup_scenarios.sh fixturesCache
|
2021-05-18 17:18:22 +00:00
|
|
|
|
2021-08-18 12:40:03 +00:00
|
|
|
- name: Build all tools
|
2021-05-18 17:18:22 +00:00
|
|
|
run: |
|
2022-06-14 11:35:17 +00:00
|
|
|
${make_cmd} -j ${ncpu} V=1 NIM_COMMIT=${{ matrix.branch }}
|
2021-08-18 12:40:03 +00:00
|
|
|
# The Windows image runs out of disk space, so make some room
|
|
|
|
rm -rf nimcache
|
2021-05-18 17:18:22 +00:00
|
|
|
|
2022-02-25 08:19:12 +00:00
|
|
|
- name: Run tests
|
2021-05-18 17:18:22 +00:00
|
|
|
run: |
|
2022-06-14 11:35:17 +00:00
|
|
|
${make_cmd} -j ${ncpu} V=1 NIM_COMMIT=${{ matrix.branch }} DISABLE_TEST_FIXTURES_SCRIPT=1 test
|