2024-01-27 13:34:11 +00:00
|
|
|
# Nimbus
|
|
|
|
# Copyright (c) 2021-2024 Status Research & Development GmbH
|
|
|
|
# Licensed under either of
|
|
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
|
|
# http://opensource.org/licenses/MIT)
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except
|
|
|
|
# according to those terms.
|
|
|
|
|
2022-11-23 16:11:38 +00:00
|
|
|
name: Nimbus verified proxy CI
|
2022-09-16 13:25:07 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths:
|
2022-11-23 16:11:38 +00:00
|
|
|
- '.github/workflows/nimbus_verified_proxy.yml'
|
|
|
|
- 'nimbus_verified_proxy/**'
|
|
|
|
- '!nimbus_verified_proxy/**.md'
|
|
|
|
- '!nimbus_verified_proxy/docs/**'
|
2023-11-20 11:53:20 +00:00
|
|
|
- 'nimbus/db/**'
|
2022-09-16 13:25:07 +00:00
|
|
|
- 'vendor/**'
|
|
|
|
- 'Makefile'
|
|
|
|
- 'nimbus.nimble'
|
|
|
|
|
|
|
|
pull_request:
|
|
|
|
paths:
|
2022-11-23 16:11:38 +00:00
|
|
|
- '.github/workflows/nimbus_verified_proxy.yml'
|
|
|
|
- 'nimbus_verified_proxy/**'
|
|
|
|
- '!nimbus_verified_proxy/**.md'
|
|
|
|
- '!nimbus_verified_proxy/docs/**'
|
2023-11-20 11:53:20 +00:00
|
|
|
- 'nimbus/db/**'
|
2022-09-16 13:25:07 +00:00
|
|
|
- 'vendor/**'
|
|
|
|
- 'Makefile'
|
|
|
|
- 'nimbus.nimble'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 20
|
|
|
|
matrix:
|
|
|
|
target:
|
|
|
|
- os: linux
|
|
|
|
cpu: amd64
|
2023-01-26 12:37:19 +00:00
|
|
|
# - os: linux
|
|
|
|
# cpu: i386
|
2022-09-16 13:25:07 +00:00
|
|
|
- os: macos
|
|
|
|
cpu: amd64
|
|
|
|
- os: windows
|
|
|
|
cpu: amd64
|
|
|
|
include:
|
|
|
|
- target:
|
|
|
|
os: linux
|
|
|
|
builder: ubuntu-20.04
|
|
|
|
- target:
|
|
|
|
os: macos
|
2024-02-21 09:15:05 +00:00
|
|
|
builder: macos-12
|
2022-09-16 13:25:07 +00:00
|
|
|
- target:
|
|
|
|
os: windows
|
|
|
|
builder: windows-latest
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
2023-09-08 15:10:16 +00:00
|
|
|
shell: bash
|
2022-09-16 13:25:07 +00:00
|
|
|
|
|
|
|
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}'
|
|
|
|
runs-on: ${{ matrix.builder }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout nimbus-eth1
|
2024-01-27 13:34:11 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-09-16 13:25:07 +00:00
|
|
|
|
|
|
|
- name: Derive environment variables
|
|
|
|
run: |
|
|
|
|
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
|
|
|
|
PLATFORM=x64
|
|
|
|
else
|
|
|
|
PLATFORM=x86
|
|
|
|
fi
|
|
|
|
echo "PLATFORM=${PLATFORM}" >> $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
|
|
|
|
|
|
|
|
- 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 \
|
2024-01-26 22:04:08 +00:00
|
|
|
--no-install-recommends -yq gcc-multilib g++-multilib \
|
|
|
|
libz-dev:i386 libbz2-dev:i386 libssl-dev:i386 libpcre3-dev:i386
|
2022-09-16 13:25:07 +00:00
|
|
|
mkdir -p external/bin
|
|
|
|
cat << EOF > external/bin/gcc
|
|
|
|
#!/bin/bash
|
2024-01-26 22:04:08 +00:00
|
|
|
exec $(which gcc) -m32 "\$@"
|
2022-09-16 13:25:07 +00:00
|
|
|
EOF
|
|
|
|
cat << EOF > external/bin/g++
|
|
|
|
#!/bin/bash
|
2024-01-26 22:04:08 +00:00
|
|
|
exec $(which g++) -m32 "\$@"
|
2022-09-16 13:25:07 +00:00
|
|
|
EOF
|
|
|
|
chmod 755 external/bin/gcc external/bin/g++
|
2024-01-26 22:04:08 +00:00
|
|
|
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH
|
2022-09-16 13:25:07 +00:00
|
|
|
|
2024-01-26 22:04:08 +00:00
|
|
|
- name: Install build dependencies (Macos)
|
|
|
|
# Some home brew modules were reported missing
|
|
|
|
if: runner.os == 'Macos'
|
2022-09-16 13:25:07 +00:00
|
|
|
run: |
|
2024-01-26 22:04:08 +00:00
|
|
|
HOMEBREW_NO_INSTALL_CLEANUP=1 brew install gnu-getopt
|
2022-09-16 13:25:07 +00:00
|
|
|
brew link --force gnu-getopt
|
|
|
|
|
2023-09-08 15:10:16 +00:00
|
|
|
- name: Restore llvm-mingw (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-mingw-cache
|
2024-01-27 13:34:11 +00:00
|
|
|
uses: actions/cache@v4
|
2022-09-16 13:25: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 }}'
|
2022-09-16 13:25:07 +00:00
|
|
|
|
|
|
|
- name: Restore Nim DLLs dependencies (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-dlls-cache
|
2024-01-27 13:34:11 +00:00
|
|
|
uses: actions/cache@v4
|
2022-09-16 13:25:07 +00:00
|
|
|
with:
|
|
|
|
path: external/dlls-${{ matrix.target.cpu }}
|
2022-11-23 16:11:38 +00:00
|
|
|
key: 'dlls-${{ matrix.target.cpu }}-verified-proxy'
|
2022-09-16 13:25: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
|
2024-01-26 22:04:08 +00:00
|
|
|
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-i686.zip"
|
2023-09-08 15:10:16 +00:00
|
|
|
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 }}
|
|
|
|
|
2022-09-16 13:25:07 +00:00
|
|
|
- name: Install DLLs dependencies (Windows)
|
|
|
|
if: >
|
|
|
|
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
|
|
|
runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
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"
|
|
|
|
|
|
|
|
- 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
|
2022-09-16 13:25:07 +00:00
|
|
|
echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- 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-12-08 09:21:43 +00:00
|
|
|
echo "nimbus_build_system=$nbsHash" >> $GITHUB_OUTPUT
|
2022-09-16 13:25:07 +00:00
|
|
|
|
2024-01-26 22:04:08 +00:00
|
|
|
- name: Restore prebuilt Nim from cache
|
2022-09-16 13:25:07 +00:00
|
|
|
id: nim-cache
|
2024-01-27 13:34:11 +00:00
|
|
|
uses: actions/cache@v4
|
2022-09-16 13:25:07 +00:00
|
|
|
with:
|
2024-01-26 22:04:08 +00:00
|
|
|
path: NimBinCache
|
2022-11-23 16:11:38 +00:00
|
|
|
key: 'nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}-verified-proxy'
|
2022-09-16 13:25:07 +00:00
|
|
|
|
|
|
|
- name: Build Nim and Nimbus-eth1 dependencies
|
|
|
|
run: |
|
2024-01-26 22:04:08 +00:00
|
|
|
make V=1 -j${ncpu} ARCH_OVERRIDE=${PLATFORM} CI_CACHE=NimBinCache update-from-ci
|
2022-09-16 13:25:07 +00:00
|
|
|
|
2022-11-23 16:11:38 +00:00
|
|
|
- name: Run verified proxy tests (Windows)
|
2022-09-16 13:25:07 +00:00
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
gcc --version
|
|
|
|
DEFAULT_MAKE_FLAGS="-j${ncpu}"
|
2024-01-26 22:04:08 +00:00
|
|
|
mingw32-make ${DEFAULT_MAKE_FLAGS} nimbus_verified_proxy libverifproxy
|
2022-11-23 16:11:38 +00:00
|
|
|
build/nimbus_verified_proxy.exe --help
|
|
|
|
mingw32-make ${DEFAULT_MAKE_FLAGS} nimbus-verified-proxy-test
|
2022-09-16 13:25:07 +00:00
|
|
|
|
2022-11-23 16:11:38 +00:00
|
|
|
- name: Run verified proxy tests (Linux)
|
2022-09-16 13:25:07 +00:00
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
|
|
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
|
|
|
|
DEFAULT_MAKE_FLAGS="-j${ncpu}"
|
2024-01-26 22:04:08 +00:00
|
|
|
env CC=gcc make ${DEFAULT_MAKE_FLAGS} nimbus_verified_proxy libverifproxy
|
2022-11-23 16:11:38 +00:00
|
|
|
build/nimbus_verified_proxy --help
|
2022-09-16 13:25:07 +00:00
|
|
|
# CC is needed to select correct compiler 32/64 bit
|
2022-11-23 16:11:38 +00:00
|
|
|
env CC=gcc CXX=g++ make ${DEFAULT_MAKE_FLAGS} nimbus-verified-proxy-test
|
2022-09-16 13:25:07 +00:00
|
|
|
|
2022-11-23 16:11:38 +00:00
|
|
|
- name: Run verified proxy tests (Macos)
|
2022-09-16 13:25:07 +00:00
|
|
|
if: runner.os == 'Macos'
|
|
|
|
run: |
|
|
|
|
DEFAULT_MAKE_FLAGS="-j${ncpu}"
|
2024-01-26 22:04:08 +00:00
|
|
|
make ${DEFAULT_MAKE_FLAGS} nimbus_verified_proxy libverifproxy
|
2022-11-23 16:11:38 +00:00
|
|
|
build/nimbus_verified_proxy --help
|
2022-09-16 13:25:07 +00:00
|
|
|
# "-static" option will not work for osx unless static system libraries are provided
|
2022-11-23 16:11:38 +00:00
|
|
|
make ${DEFAULT_MAKE_FLAGS} nimbus-verified-proxy-test
|
2024-02-10 13:49:34 +00:00
|
|
|
|
|
|
|
lint:
|
|
|
|
name: "Lint verified proxy"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
fetch-depth: 2 # In PR, has extra merge commit: ^1 = PR, ^2 = base
|
|
|
|
|
2024-02-15 13:50:25 +00:00
|
|
|
- name: Check nph formatting
|
|
|
|
# Pin nph to a specific version to avoid sudden style differences.
|
|
|
|
# Updating nph version should be accompanied with running the new
|
|
|
|
# version on the fluffy directory.
|
|
|
|
run: |
|
|
|
|
VERSION="v0.4.1"
|
|
|
|
ARCHIVE="nph-linux_x64.tar.gz"
|
|
|
|
curl -L "https://github.com/arnetheduck/nph/releases/download/${VERSION}/${ARCHIVE}" -o ${ARCHIVE}
|
|
|
|
tar -xzf ${ARCHIVE}
|
|
|
|
./nph nimbus_verified_proxy/
|
|
|
|
git diff --exit-code
|
|
|
|
|
2024-02-10 13:49:34 +00:00
|
|
|
- name: Check copyright year
|
|
|
|
if: ${{ !cancelled() }} && github.event_name == 'pull_request'
|
|
|
|
run: |
|
|
|
|
bash scripts/check_copyright_year.sh
|