Skip to content

Simulators

Simulators #374

Workflow file for this run

# 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.
name: Simulators
on:
schedule:
# every two days 11 PM
- cron: "0 23 */2 * *"
workflow_dispatch:
jobs:
build-linux-amd64:
name: Linux-amd64
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get latest nimbus-build-system commit hash
id: versions
run: |
sudo apt-get -q update
sudo apt-get install -y librocksdb-dev libpcre3-dev
getHash() {
git ls-remote "https://github.com/$1" "${2:-HEAD}" | cut -f 1
}
nbsHash=$(getHash status-im/nimbus-build-system)
echo "nimbus_build_system=$nbsHash" >> $GITHUB_OUTPUT
- name: Restore prebuilt Nim from cache
uses: actions/cache@v4
with:
path: NimBinaries
key: 'nim-linux-amd64-${{ steps.versions.outputs.nimbus_build_system }}-sim'
- name: Build Nim and deps
run: |
ncpu=$(nproc)
make -j${ncpu} ARCH_OVERRIDE=x64 CI_CACHE=NimBinaries update-from-ci
make -j${ncpu} deps
- name: Run Simulators
run: |
SIM_SCRIPT="hive_integration/nodocker/build_sims.sh"
chmod +x ${SIM_SCRIPT}
${SIM_SCRIPT} "Linux-amd64"
- name: Upload artefact
uses: actions/upload-artifact@v4
with:
name: linux_amd64_stat
path: ./simulators.md
retention-days: 2
build-macos-amd64:
name: Macos-amd64
runs-on: macos-12
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore rocksdb from cache
id: rocksdb-cache
uses: actions/cache@v4
with:
path: rocks-db-cache
key: 'rocksdb-v2'
- name: Build and install rocksdb
run: |
HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install ccache
echo "/usr/local/opt/ccache/libexec" >> ${GITHUB_PATH}
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
- 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)
echo "nimbus_build_system=$nbsHash" >> $GITHUB_OUTPUT
- name: Restore prebuilt Nim from cache
uses: actions/cache@v4
with:
path: NimBinaries
key: 'nim-macos-amd64-${{ steps.versions.outputs.nimbus_build_system }}-sim'
- name: Build Nim and deps
run: |
ncpu=$(sysctl -n hw.ncpu)
make -j${ncpu} ARCH_OVERRIDE=x64 CI_CACHE=NimBinaries update-from-ci
make -j${ncpu} deps
- name: Run Simulators
run: |
SIM_SCRIPT="hive_integration/nodocker/build_sims.sh"
chmod +x ${SIM_SCRIPT}
${SIM_SCRIPT} "MacOS-amd64"
- name: Upload artefact
uses: actions/upload-artifact@v4
with:
name: macos_amd64_stat
path: ./simulators.md
retention-days: 2
build-windows-amd64:
name: Windows-amd64
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore Nim DLLs dependencies from cache
id: windows-dlls-cache
uses: actions/cache@v4
with:
path: external/dlls
# 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
- name: Install DLLs dependencies
if: steps.windows-dlls-cache.outputs.cache-hit != 'true'
run: |
ROCKSDBSUB=x64
DLLPATH=external/dlls
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: Restore llvm-mingw from cache
id: windows-mingw-cache
uses: actions/cache@v4
with:
path: external/mingw-amd64
key: 'mingw-llvm-17-sim'
- name: Install llvm-mingw dependency
if: steps.windows-mingw-cache.outputs.cache-hit != 'true'
run: |
mkdir -p external
MINGW_BASE="https://github.com/mstorsjo/llvm-mingw/releases/download/20230905"
MINGW_URL="$MINGW_BASE/llvm-mingw-20230905-ucrt-x86_64.zip"
curl -L "$MINGW_URL" -o "external/mingw-amd64.zip"
7z x -y "external/mingw-amd64.zip" -oexternal/mingw-amd64/
mv external/mingw-amd64/**/* ./external/mingw-amd64
- name: Path to cached dependencies
run: |
echo '${{ github.workspace }}'"/external/mingw-amd64/bin" >> $GITHUB_PATH
echo '${{ github.workspace }}'"/external/dlls" >> $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)
echo "nimbus_build_system=$nbsHash" >> $GITHUB_OUTPUT
- name: Restore prebuilt Nim from cache
uses: actions/cache@v4
with:
path: NimBinaries
key: 'nim-windows-amd64-${{ steps.versions.outputs.nimbus_build_system }}-sim'
- name: Build Nim and deps
run: |
ncpu=${NUMBER_OF_PROCESSORS}
mingw32-make -j${ncpu} ARCH_OVERRIDE=x64 CI_CACHE=NimBinaries update-from-ci
mingw32-make -j${ncpu} deps
- name: Run Simulators
run: |
SIM_SCRIPT="hive_integration/nodocker/build_sims.sh"
${SIM_SCRIPT} "Windows-amd64"
- name: Upload artefact
uses: actions/upload-artifact@v4
with:
name: windows_amd64_stat
path: ./simulators.md
retention-days: 2
prepare-stat:
name: Test results
needs: [build-linux-amd64, build-macos-amd64, build-windows-amd64]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: master
- name: Download artefacts
uses: actions/download-artifact@v4
- name: Create statistics notes
run: |
cat linux_amd64_stat/* > stat_notes.md
cat macos_amd64_stat/* >> stat_notes.md
cat windows_amd64_stat/* >> stat_notes.md
- name: Delete tag
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: sim-stat
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Simulators results
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: true
commit: master
name: "Simulators results"
tag: sim-stat
bodyFile: "stat_notes.md"
- name: Delete artefacts
uses: geekyeggo/delete-artifact@v2
with:
failOnError: false
name: |
linux_amd64_stat
macos_amd64_stat
windows_amd64_stat