2021-06-28 15:53:13 +00:00
|
|
|
name: fluffy CI
|
2021-06-16 19:18:45 +00:00
|
|
|
on:
|
|
|
|
push:
|
2022-02-11 13:43:10 +00:00
|
|
|
paths:
|
|
|
|
- '.github/workflows/fluffy.yml'
|
|
|
|
- 'fluffy/**'
|
|
|
|
- '!fluffy/**.md'
|
|
|
|
- '!fluffy/docs/**'
|
|
|
|
- 'nimbus/rpc/hexstrings.nim'
|
|
|
|
- 'nimbus/rpc/rpc_*.nim'
|
|
|
|
- 'vendor/**'
|
|
|
|
- 'Makefile'
|
|
|
|
- 'nimbus.nimble'
|
|
|
|
|
2021-06-16 19:18:45 +00:00
|
|
|
pull_request:
|
2022-02-11 13:43:10 +00:00
|
|
|
paths:
|
|
|
|
- '.github/workflows/fluffy.yml'
|
|
|
|
- 'fluffy/**'
|
|
|
|
- '!fluffy/**.md'
|
|
|
|
- '!fluffy/docs/**'
|
|
|
|
- 'nimbus/rpc/hexstrings.nim'
|
|
|
|
- 'nimbus/rpc/rpc_*.nim'
|
|
|
|
- 'vendor/**'
|
|
|
|
- 'Makefile'
|
|
|
|
- 'nimbus.nimble'
|
2021-06-16 19:18:45 +00:00
|
|
|
|
|
|
|
jobs:
|
2022-02-03 12:11:54 +00:00
|
|
|
# separate job so it can run concurrently with other tests
|
|
|
|
testutp:
|
|
|
|
# whole test setup runs on ubuntu so we do not need multiple arch setup here
|
2023-02-02 03:58:03 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-02-03 12:11:54 +00:00
|
|
|
# TODO: for now only push event as this way it is easier to get branch name
|
|
|
|
# to build container
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
steps:
|
|
|
|
- name: Checkout nimbus-eth1
|
2022-12-08 09:21:43 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-02-03 12:11:54 +00:00
|
|
|
|
|
|
|
- name: Install modprobe
|
|
|
|
run: |
|
|
|
|
sudo apt-get install -y kmod
|
|
|
|
|
|
|
|
# It is required to correctly run the simulation
|
|
|
|
- name: Load iptables6 kernel modules
|
|
|
|
run: |
|
|
|
|
sudo modprobe ip6table_filter
|
|
|
|
|
|
|
|
- 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-02-03 12:11:54 +00:00
|
|
|
|
|
|
|
- name: Restore prebuilt Nim binaries from cache
|
|
|
|
id: nim-cache
|
2022-12-08 09:21:43 +00:00
|
|
|
uses: actions/cache@v3
|
2022-02-03 12:11:54 +00:00
|
|
|
with:
|
|
|
|
path: NimBinaries
|
2022-03-29 13:51:48 +00:00
|
|
|
key: 'nim-linux-amd64-${{ steps.versions.outputs.nimbus_build_system }}-fluffy'
|
2022-02-03 12:11:54 +00:00
|
|
|
|
|
|
|
- name: Build Nim and Nimbus-eth1 dependencies
|
|
|
|
run: |
|
2023-09-19 00:47:58 +00:00
|
|
|
make -j${ncpu} ARCH_OVERRIDE=${PLATFORM} CI_CACHE=NimBinaries update-from-ci
|
2022-02-03 12:11:54 +00:00
|
|
|
|
|
|
|
- name: build uTP test app container
|
|
|
|
run: |
|
|
|
|
docker build -t test-utp --no-cache --build-arg BRANCH_NAME=${{ github.ref_name }} fluffy/tools/utp_testing/docker
|
2022-02-11 13:43:10 +00:00
|
|
|
|
2022-02-03 12:11:54 +00:00
|
|
|
- name: run test app with simulator
|
|
|
|
run: |
|
|
|
|
SCENARIO="drop-rate --delay=15ms --bandwidth=10Mbps --queue=25 --rate_to_client=10 --rate_to_server=10" docker-compose -f fluffy/tools/utp_testing/docker/docker-compose.yml up -d
|
2022-02-11 13:43:10 +00:00
|
|
|
|
2022-02-03 12:11:54 +00:00
|
|
|
- name: wait 5 seconds for containers to start
|
|
|
|
run: |
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
- name: check containers
|
|
|
|
run: |
|
|
|
|
docker ps -a
|
2022-02-11 13:43:10 +00:00
|
|
|
|
2022-02-03 12:11:54 +00:00
|
|
|
- name: run uTP test
|
|
|
|
run: |
|
|
|
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
|
|
|
|
DEFAULT_MAKE_FLAGS="-j${ncpu}"
|
|
|
|
env CC=gcc CXX=g++ make ${DEFAULT_MAKE_FLAGS} utp-test
|
|
|
|
|
|
|
|
- name: Stop containers
|
|
|
|
if: always()
|
|
|
|
run: docker-compose -f fluffy/tools/utp_testing/docker/docker-compose.yml down
|
|
|
|
|
2021-06-16 19:18:45 +00:00
|
|
|
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
|
2021-06-16 19:18:45 +00:00
|
|
|
- os: macos
|
|
|
|
cpu: amd64
|
|
|
|
- os: windows
|
|
|
|
cpu: amd64
|
|
|
|
include:
|
|
|
|
- target:
|
|
|
|
os: linux
|
2023-02-02 03:58:03 +00:00
|
|
|
builder: ubuntu-22.04
|
2021-06-16 19:18:45 +00:00
|
|
|
- target:
|
|
|
|
os: macos
|
2022-07-28 02:19:57 +00:00
|
|
|
builder: macos-11
|
2021-06-16 19:18:45 +00:00
|
|
|
- target:
|
|
|
|
os: windows
|
|
|
|
builder: windows-latest
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
2023-09-08 15:10:16 +00:00
|
|
|
shell: bash
|
2021-06-16 19:18:45 +00:00
|
|
|
|
|
|
|
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}'
|
|
|
|
runs-on: ${{ matrix.builder }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout nimbus-eth1
|
2022-12-08 09:21:43 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-06-16 19:18:45 +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 \
|
|
|
|
--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
|
|
|
|
|
2021-11-24 07:45:55 +00:00
|
|
|
# Required for running the local testnet script
|
|
|
|
- name: Install build dependencies (MacOS)
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
|
|
|
brew install gnu-getopt
|
|
|
|
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
|
|
|
|
uses: actions/cache@v3
|
2021-06-16 19:18:45 +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-06-16 19:18:45 +00:00
|
|
|
|
|
|
|
- name: Restore Nim DLLs dependencies (Windows) from cache
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
id: windows-dlls-cache
|
2022-12-08 09:21:43 +00:00
|
|
|
uses: actions/cache@v3
|
2021-06-16 19:18:45 +00:00
|
|
|
with:
|
|
|
|
path: external/dlls-${{ matrix.target.cpu }}
|
2022-03-29 13:51:48 +00:00
|
|
|
key: 'dlls-${{ matrix.target.cpu }}-fluffy'
|
2021-06-16 19:18:45 +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-x86_64.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-06-16 19:18:45 +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
|
2021-06-16 19:18:45 +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
|
2021-06-16 19:18:45 +00:00
|
|
|
|
|
|
|
- name: Restore prebuilt Nim binaries from cache
|
|
|
|
id: nim-cache
|
2022-12-08 09:21:43 +00:00
|
|
|
uses: actions/cache@v3
|
2021-06-16 19:18:45 +00:00
|
|
|
with:
|
|
|
|
path: NimBinaries
|
2022-03-29 13:51:48 +00:00
|
|
|
key: 'nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}-fluffy'
|
2021-06-16 19:18:45 +00:00
|
|
|
|
|
|
|
- name: Build Nim and Nimbus-eth1 dependencies
|
|
|
|
run: |
|
2023-01-31 05:13:57 +00:00
|
|
|
# use CC to make sure Nim compiler and subsequent test
|
|
|
|
# using the same glibc version.
|
2023-09-19 00:47:58 +00:00
|
|
|
env CC=gcc make -j${ncpu} ARCH_OVERRIDE=${PLATFORM} CI_CACHE=NimBinaries update-from-ci
|
2021-06-16 19:18:45 +00:00
|
|
|
|
2021-06-28 15:53:13 +00:00
|
|
|
- name: Run fluffy tests (Windows)
|
2021-06-16 19:18:45 +00:00
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
gcc --version
|
2023-09-15 14:21:00 +00:00
|
|
|
DEFAULT_MAKE_FLAGS="-j1"
|
2021-06-28 15:53:13 +00:00
|
|
|
mingw32-make ${DEFAULT_MAKE_FLAGS} fluffy
|
|
|
|
build/fluffy.exe --help
|
2023-05-27 13:52:48 +00:00
|
|
|
find . -type d -name ".git" -exec rm -rf {} +
|
2023-03-10 19:18:50 +00:00
|
|
|
rm -rf nimcache
|
|
|
|
mingw32-make ${DEFAULT_MAKE_FLAGS} fluffy-tools
|
|
|
|
rm -rf nimcache
|
2021-07-09 11:34:16 +00:00
|
|
|
mingw32-make ${DEFAULT_MAKE_FLAGS} fluffy-test
|
2023-03-10 19:18:50 +00:00
|
|
|
rm -rf nimcache
|
2021-06-16 19:18:45 +00:00
|
|
|
|
2021-06-28 15:53:13 +00:00
|
|
|
- name: Run fluffy tests (Linux)
|
2021-06-16 19:18:45 +00:00
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
2023-01-31 05:13:57 +00:00
|
|
|
gcc --version
|
|
|
|
./env.sh nim -v
|
|
|
|
ldd --version
|
2021-06-16 19:18:45 +00:00
|
|
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
|
|
|
|
DEFAULT_MAKE_FLAGS="-j${ncpu}"
|
2021-06-28 15:53:13 +00:00
|
|
|
env CC=gcc make ${DEFAULT_MAKE_FLAGS} fluffy
|
|
|
|
build/fluffy --help
|
2023-03-10 19:18:50 +00:00
|
|
|
env CC=gcc make ${DEFAULT_MAKE_FLAGS} fluffy-tools
|
2021-06-16 19:18:45 +00:00
|
|
|
# CC is needed to select correct compiler 32/64 bit
|
2022-03-29 13:51:48 +00:00
|
|
|
env CC=gcc CXX=g++ make ${DEFAULT_MAKE_FLAGS} fluffy-test
|
2021-06-16 19:18:45 +00:00
|
|
|
|
2021-06-28 15:53:13 +00:00
|
|
|
- name: Run fluffy tests (Macos)
|
2021-06-16 19:18:45 +00:00
|
|
|
if: runner.os == 'Macos'
|
|
|
|
run: |
|
|
|
|
DEFAULT_MAKE_FLAGS="-j${ncpu}"
|
2021-06-28 15:53:13 +00:00
|
|
|
make ${DEFAULT_MAKE_FLAGS} fluffy
|
|
|
|
build/fluffy --help
|
2023-03-10 19:18:50 +00:00
|
|
|
make ${DEFAULT_MAKE_FLAGS} fluffy-tools
|
2021-06-16 19:18:45 +00:00
|
|
|
# "-static" option will not work for osx unless static system libraries are provided
|
2022-03-29 13:51:48 +00:00
|
|
|
make ${DEFAULT_MAKE_FLAGS} fluffy-test
|
2021-11-24 07:45:55 +00:00
|
|
|
|
|
|
|
- name: Run fluffy testnet
|
|
|
|
run: |
|
2023-10-20 12:30:21 +00:00
|
|
|
./fluffy/scripts/launch_local_testnet.sh --run-tests
|