From 9b326a9a76c89c8aebb88ba5e02c8d7c559c958f Mon Sep 17 00:00:00 2001 From: jangko Date: Tue, 16 Sep 2025 17:30:11 +0700 Subject: [PATCH 01/12] Common workflow --- .github/workflows/ci.yml | 167 ++++----------------------------------- 1 file changed, 15 insertions(+), 152 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28591ccb8c..6ebd8050cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,160 +13,19 @@ on: # and only run base autobahn tests here. jobs: - build: - strategy: - fail-fast: false - matrix: - target: - - os: linux - cpu: amd64 - - os: linux - cpu: i386 - - os: macos - cpu: arm64 - - os: windows - cpu: amd64 - branch: [version-2-0, version-2-2, devel] - include: - - target: - os: linux - builder: ubuntu-latest - shell: bash - - target: - os: macos - cpu: arm64 - builder: macos-latest - shell: bash - - target: - os: windows - builder: windows-latest - shell: msys2 {0} - - defaults: - run: - shell: ${{ matrix.shell }} - - name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})' - runs-on: ${{ matrix.builder }} - continue-on-error: ${{ matrix.branch == 'devel' }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - - name: Install build dependencies (Linux i386) - if: runner.os == 'Linux' && matrix.target.cpu == 'i386' - run: | - sudo dpkg --add-architecture i386 - sudo apt-get update -qq - sudo DEBIAN_FRONTEND='noninteractive' apt-get install \ - --no-install-recommends -yq gcc-multilib g++-multilib \ - libssl-dev:i386 - mkdir -p external/bin - cat << EOF > external/bin/gcc - #!/bin/bash - exec $(which gcc) -m32 "\$@" - EOF - cat << EOF > external/bin/g++ - #!/bin/bash - exec $(which g++) -m32 "\$@" - EOF - chmod 755 external/bin/gcc external/bin/g++ - echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH - - - name: MSYS2 (Windows i386) - if: runner.os == 'Windows' && matrix.target.cpu == 'i386' - uses: msys2/setup-msys2@v2 - with: - path-type: inherit - msystem: MINGW32 - install: >- - base-devel - git - mingw-w64-i686-toolchain - - - 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 - - - name: Restore Nim DLLs dependencies (Windows) from cache - if: runner.os == 'Windows' - id: windows-dlls-cache - uses: actions/cache@v4 - with: - path: external/dlls-${{ matrix.target.cpu }} - key: 'dlls-${{ matrix.target.cpu }}' - - - 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: | - echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH - - - name: Derive environment variables - run: | - if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then - PLATFORM=x64 - elif [[ '${{ matrix.target.cpu }}' == 'arm64' ]]; then - PLATFORM=arm64 - else - PLATFORM=x86 - fi - echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV - - ncpu= - MAKE_CMD="make" - case '${{ runner.os }}' in - 'Linux') - ncpu=$(nproc) - ;; - 'macOS') - ncpu=$(sysctl -n hw.ncpu) - ;; - 'Windows') - ncpu=$NUMBER_OF_PROCESSORS - MAKE_CMD="mingw32-make" - ;; - esac - [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1 - echo "ncpu=$ncpu" >> $GITHUB_ENV - echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV - - - name: Build Nim and Nimble - run: | - curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh - env MAKE="${MAKE_CMD} -j${ncpu}" ARCH_OVERRIDE=${PLATFORM} NIM_COMMIT=${{ matrix.branch }} \ - QUICK_AND_DIRTY_COMPILER=1 QUICK_AND_DIRTY_NIMBLE=1 CC=gcc \ - bash build_nim.sh nim csources dist/nimble NimBinaries - echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH - - - name: Run tests - run: | - nim --version - nimble --version - nimble install -y --depsOnly - nimble test - env NIMFLAGS="--mm:refc" nimble test + build: + uses: status-im/nimbus-common-workflow/.github/workflows/common.yml@main + with: + test-command: | + nim --version + nimble --version + nimble install -y --depsOnly + nimble test + env NIMFLAGS="--mm:refc" nimble test autobahn-test: - if: github.event_name == 'push' # || github.event_name == 'pull_request' + # temporary disabled + if: false # github.event_name == 'push' # || github.event_name == 'pull_request' name: "Autobahn test suite" runs-on: ubuntu-latest @@ -271,6 +130,8 @@ jobs: # Applying Merging multiple artifacts: # https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md#merging-multiple-artifacts merge-autobahn-artifact: + # temporary disabled + if: false runs-on: ubuntu-latest needs: autobahn-test steps: @@ -281,6 +142,8 @@ jobs: pattern: autobahn-artifact-* deploy-test: + # temporary disabled + if: false name: "Deplay Autobahn results" needs: merge-autobahn-artifact runs-on: ubuntu-latest From d4c1b8e375d7ce208d5c5a3fd04bf44c49ca236a Mon Sep 17 00:00:00 2001 From: jangko Date: Tue, 16 Sep 2025 17:31:42 +0700 Subject: [PATCH 02/12] Fixes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ebd8050cf..86432ce522 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ on: # and only run base autobahn tests here. jobs: - build: + build: uses: status-im/nimbus-common-workflow/.github/workflows/common.yml@main with: test-command: | From 255efb60737096241c58e8e8b67c03a780af6015 Mon Sep 17 00:00:00 2001 From: jangko Date: Tue, 16 Sep 2025 18:19:55 +0700 Subject: [PATCH 03/12] Fixes --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86432ce522..36483302d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,12 @@ jobs: test-command: | nim --version nimble --version + + nim --version | grep -q "1.6" + if [ $? -eq 0 ]; then + nimble install chronicles@0.10.3 + fi + nimble install -y --depsOnly nimble test env NIMFLAGS="--mm:refc" nimble test @@ -144,7 +150,7 @@ jobs: deploy-test: # temporary disabled if: false - name: "Deplay Autobahn results" + name: "Deploy Autobahn results" needs: merge-autobahn-artifact runs-on: ubuntu-latest From f4800f9841d065f4714a00cc0c2eed58da262a2a Mon Sep 17 00:00:00 2001 From: jangko Date: Tue, 16 Sep 2025 19:39:25 +0700 Subject: [PATCH 04/12] Fixes --- .github/workflows/ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36483302d5..1c055f6014 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,15 +16,10 @@ jobs: build: uses: status-im/nimbus-common-workflow/.github/workflows/common.yml@main with: + nim-versions: '["version-2-0", "version-2-2", "devel"]' test-command: | nim --version nimble --version - - nim --version | grep -q "1.6" - if [ $? -eq 0 ]; then - nimble install chronicles@0.10.3 - fi - nimble install -y --depsOnly nimble test env NIMFLAGS="--mm:refc" nimble test From 5444c08b2f77bfe6b1136ef1fa6be55c527b8722 Mon Sep 17 00:00:00 2001 From: jangko Date: Tue, 16 Sep 2025 21:16:04 +0700 Subject: [PATCH 05/12] Fixes --- .github/workflows/ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c055f6014..d9f2745f62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: max-parallel: 20 matrix: websock: [ws, wsc, wss, wssc] - branch: [version-1-6, version-2-0, devel] + branch: [version-2-0, version-2-2, devel] defaults: run: @@ -44,8 +44,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - submodules: true - name: Build Nim and Nimble run: | @@ -62,10 +60,10 @@ jobs: - name: Setup Autobahn. run: | - sudo apt-get install -y python2.7-dev + sudo apt-get install -y python3-dev pip install virtualenv pip install markdown2 - virtualenv --python=/usr/bin/python2.7 autobahn + virtualenv --python=/usr/bin/python3 autobahn source autobahn/bin/activate pip install autobahntestsuite txaio==2.1.0 autobahn[twisted,accelerate]==0.10.9 jinja2==2.6 markupsafe==0.19 Werkzeug==0.9.6 klein==0.2.3 pyopenssl service_identity==14.0.0 unittest2==1.1.0 wsaccel==0.6.2 pip freeze From 1d81f2933f9421c9a11135e675cfb36bb9015536 Mon Sep 17 00:00:00 2001 From: jangko Date: Tue, 16 Sep 2025 17:30:11 +0700 Subject: [PATCH 06/12] Common workflow --- .github/workflows/ci.yml | 242 +++++--------------------------- .gitignore | 1 + autobahn/fuzzingserver_tls.json | 4 +- scripts/ws.sh | 30 ++++ scripts/wsc.sh | 30 ++++ scripts/wss.sh | 29 ++++ scripts/wssc.sh | 29 ++++ 7 files changed, 160 insertions(+), 205 deletions(-) create mode 100644 scripts/ws.sh create mode 100644 scripts/wsc.sh create mode 100644 scripts/wss.sh create mode 100644 scripts/wssc.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28591ccb8c..084498187c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,156 +14,15 @@ on: jobs: build: - strategy: - fail-fast: false - matrix: - target: - - os: linux - cpu: amd64 - - os: linux - cpu: i386 - - os: macos - cpu: arm64 - - os: windows - cpu: amd64 - branch: [version-2-0, version-2-2, devel] - include: - - target: - os: linux - builder: ubuntu-latest - shell: bash - - target: - os: macos - cpu: arm64 - builder: macos-latest - shell: bash - - target: - os: windows - builder: windows-latest - shell: msys2 {0} - - defaults: - run: - shell: ${{ matrix.shell }} - - name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})' - runs-on: ${{ matrix.builder }} - continue-on-error: ${{ matrix.branch == 'devel' }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - - name: Install build dependencies (Linux i386) - if: runner.os == 'Linux' && matrix.target.cpu == 'i386' - run: | - sudo dpkg --add-architecture i386 - sudo apt-get update -qq - sudo DEBIAN_FRONTEND='noninteractive' apt-get install \ - --no-install-recommends -yq gcc-multilib g++-multilib \ - libssl-dev:i386 - mkdir -p external/bin - cat << EOF > external/bin/gcc - #!/bin/bash - exec $(which gcc) -m32 "\$@" - EOF - cat << EOF > external/bin/g++ - #!/bin/bash - exec $(which g++) -m32 "\$@" - EOF - chmod 755 external/bin/gcc external/bin/g++ - echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH - - - name: MSYS2 (Windows i386) - if: runner.os == 'Windows' && matrix.target.cpu == 'i386' - uses: msys2/setup-msys2@v2 - with: - path-type: inherit - msystem: MINGW32 - install: >- - base-devel - git - mingw-w64-i686-toolchain - - - 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 - - - name: Restore Nim DLLs dependencies (Windows) from cache - if: runner.os == 'Windows' - id: windows-dlls-cache - uses: actions/cache@v4 - with: - path: external/dlls-${{ matrix.target.cpu }} - key: 'dlls-${{ matrix.target.cpu }}' - - - 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: | - echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH - - - name: Derive environment variables - run: | - if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then - PLATFORM=x64 - elif [[ '${{ matrix.target.cpu }}' == 'arm64' ]]; then - PLATFORM=arm64 - else - PLATFORM=x86 - fi - echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV - - ncpu= - MAKE_CMD="make" - case '${{ runner.os }}' in - 'Linux') - ncpu=$(nproc) - ;; - 'macOS') - ncpu=$(sysctl -n hw.ncpu) - ;; - 'Windows') - ncpu=$NUMBER_OF_PROCESSORS - MAKE_CMD="mingw32-make" - ;; - esac - [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1 - echo "ncpu=$ncpu" >> $GITHUB_ENV - echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV - - - name: Build Nim and Nimble - run: | - curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh - env MAKE="${MAKE_CMD} -j${ncpu}" ARCH_OVERRIDE=${PLATFORM} NIM_COMMIT=${{ matrix.branch }} \ - QUICK_AND_DIRTY_COMPILER=1 QUICK_AND_DIRTY_NIMBLE=1 CC=gcc \ - bash build_nim.sh nim csources dist/nimble NimBinaries - echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH - - - name: Run tests - run: | - nim --version - nimble --version - nimble install -y --depsOnly - nimble test - env NIMFLAGS="--mm:refc" nimble test + uses: status-im/nimbus-common-workflow/.github/workflows/common.yml@main + with: + nim-versions: '["version-2-0", "version-2-2", "devel"]' + test-command: | + nim --version + nimble --version + nimble install -y --depsOnly + nimble test + env NIMFLAGS="--mm:refc" nimble test autobahn-test: if: github.event_name == 'push' # || github.event_name == 'pull_request' @@ -175,7 +34,7 @@ jobs: max-parallel: 20 matrix: websock: [ws, wsc, wss, wssc] - branch: [version-1-6, version-2-0, devel] + branch: [version-2-0, version-2-2, devel] defaults: run: @@ -184,31 +43,46 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + + - name: Get latest nimbus-build-system commit hash + id: versions + run: | + nbsHash=$(git ls-remote "https://github.com/status-im/nimbus-build-system" "${2:-HEAD}" | cut -f 1 ) + echo "nimbus_build_system=$nbsHash" >> $GITHUB_OUTPUT + + - name: Restore prebuilt Nim from cache + uses: actions/cache@v4 with: - submodules: true + path: NimBinCache + key: 'nim-${{ matrix.branch }}-${{ steps.versions.outputs.nimbus_build_system }}' - name: Build Nim and Nimble run: | curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh env MAKE="make -j$(nproc)" NIM_COMMIT=${{ matrix.branch }} \ QUICK_AND_DIRTY_COMPILER=1 QUICK_AND_DIRTY_NIMBLE=1 CC=gcc \ - bash build_nim.sh nim csources dist/nimble NimBinaries + bash build_nim.sh nim csources dist/nimble NimBinCache echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH + - name: Get docker image cache key + id: cache_key + run: | + dockerHash=$(docker buildx imagetools inspect crossbario/autobahn-testsuite | grep "Digest" | cut -d':' -f 3) + echo "cache_key=$dockerHash" >> $GITHUB_OUTPUT + + - name: Cache Docker images + uses: ScribeMD/docker-cache@0.5.0 + with: + key: docker-${{ runner.os }}-${{ steps.cache_key.outputs.cache_key }} + - name: Setup Python version uses: actions/setup-python@v5 with: - python-version: pypy-2.7 + python-version: pypy-3.10 - - name: Setup Autobahn. + - name: Setup dependencies run: | - sudo apt-get install -y python2.7-dev - pip install virtualenv pip install markdown2 - virtualenv --python=/usr/bin/python2.7 autobahn - source autobahn/bin/activate - pip install autobahntestsuite txaio==2.1.0 autobahn[twisted,accelerate]==0.10.9 jinja2==2.6 markupsafe==0.19 Werkzeug==0.9.6 klein==0.2.3 pyopenssl service_identity==14.0.0 unittest2==1.1.0 wsaccel==0.6.2 - pip freeze nimble install -y --depsOnly - name: Generate index.html @@ -219,47 +93,9 @@ jobs: sed -i "s/COMMIT_SHA/$GITHUB_SHA/g" autobahn/index.md markdown2 autobahn/index.md > autobahn/reports/index.html - - name: Run Autobahn test suite. + - name: Run Autobahn test suite run: | - source autobahn/bin/activate - case '${{ matrix.websock }}' in - ws) - nim c -d:release examples/server.nim - examples/server & - server=$! - - cd autobahn - wstest --mode fuzzingclient --spec fuzzingclient.json - ;; - wsc) - nim c -d:tls -d:release -o:examples/tls_server examples/server.nim - examples/tls_server & - server=$! - - cd autobahn - wstest --mode fuzzingclient --spec fuzzingclient_tls.json - ;; - wss) - cd autobahn - wstest --webport=0 --mode fuzzingserver --spec fuzzingserver.json & - server=$! - - cd .. - nim c -d:release examples/autobahn_client - examples/autobahn_client - ;; - wssc) - cd autobahn - wstest --webport=0 --mode fuzzingserver --spec fuzzingserver_tls.json & - server=$! - - cd .. - nim c -d:tls -d:release -o:examples/autobahn_tlsclient examples/autobahn_client - examples/autobahn_tlsclient - ;; - esac - - kill $server + bash scripts/${{ matrix.websock }}.sh - name: Upload Autobahn result uses: actions/upload-artifact@v4 @@ -281,7 +117,7 @@ jobs: pattern: autobahn-artifact-* deploy-test: - name: "Deplay Autobahn results" + name: "Deploy Autobahn results" needs: merge-autobahn-artifact runs-on: ubuntu-latest @@ -296,7 +132,7 @@ jobs: name: autobahn-report path: ./autobahn_reports - - name: Deploy autobahn report. + - name: Deploy autobahn report uses: peaceiris/actions-gh-pages@v4 with: personal_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index f470f9c988..d5b0fbd94d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ nimcache nimble.develop nimble.paths +reports/ diff --git a/autobahn/fuzzingserver_tls.json b/autobahn/fuzzingserver_tls.json index a10512cf8c..14b199f650 100644 --- a/autobahn/fuzzingserver_tls.json +++ b/autobahn/fuzzingserver_tls.json @@ -1,7 +1,7 @@ { "url": "wss://127.0.0.1:9002", - "key": "tls/server.key", - "cert": "tls/server.crt", + "key": "/config/tls/server.key", + "cert": "/config/tls/server.crt", "options": {"failByDrop": false}, "outdir": "./reports/client_tls", diff --git a/scripts/ws.sh b/scripts/ws.sh new file mode 100644 index 0000000000..26df6a5cb6 --- /dev/null +++ b/scripts/ws.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# Copyright (c) 2025 Status Research & Development GmbH. +# Licensed under either of: +# - Apache License, version 2.0 +# - MIT license +# at your option. + +# prevent issue https://github.com/status-im/nimbus-eth1/issues/3661 + +set -e + +cd "$(dirname "${BASH_SOURCE[0]}")"/.. + +REPO_DIR="${PWD}" + +nim c -d:release examples/server +examples/server & +server=$! + +mkdir -p reports + +docker run \ + -v ${REPO_DIR}/autobahn:/config \ + -v ${REPO_DIR}/reports:/reports \ + --network=host \ + --name fuzzingclient \ + crossbario/autobahn-testsuite wstest --mode fuzzingclient --spec /config/fuzzingclient.json + +kill $server diff --git a/scripts/wsc.sh b/scripts/wsc.sh new file mode 100644 index 0000000000..259793f175 --- /dev/null +++ b/scripts/wsc.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# Copyright (c) 2025 Status Research & Development GmbH. +# Licensed under either of: +# - Apache License, version 2.0 +# - MIT license +# at your option. + +# prevent issue https://github.com/status-im/nimbus-eth1/issues/3661 + +set -e + +cd "$(dirname "${BASH_SOURCE[0]}")"/.. + +REPO_DIR="${PWD}" + +nim c -d:tls -d:release -o:examples/tls_server examples/server.nim +examples/tls_server & +server=$! + +mkdir -p reports + +docker run \ + -v ${REPO_DIR}/autobahn:/config \ + -v ${REPO_DIR}/reports:/reports \ + --network=host \ + --name fuzzingclient_tls \ + crossbario/autobahn-testsuite wstest --mode fuzzingclient --spec /config/fuzzingclient_tls.json + +kill $server diff --git a/scripts/wss.sh b/scripts/wss.sh new file mode 100644 index 0000000000..db062bab41 --- /dev/null +++ b/scripts/wss.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Copyright (c) 2025 Status Research & Development GmbH. +# Licensed under either of: +# - Apache License, version 2.0 +# - MIT license +# at your option. + +# prevent issue https://github.com/status-im/nimbus-eth1/issues/3661 + +set -e + +cd "$(dirname "${BASH_SOURCE[0]}")"/.. + +REPO_DIR="${PWD}" + +mkdir -p reports + +docker run -d \ + -v ${REPO_DIR}/autobahn:/config \ + -v ${REPO_DIR}/reports:/reports \ + --network=host \ + --name fuzzingserver \ + crossbario/autobahn-testsuite wstest --webport=0 --mode fuzzingserver --spec /config/fuzzingserver.json + +nim c -d:release examples/autobahn_client +examples/autobahn_client + +docker kill fuzzingserver diff --git a/scripts/wssc.sh b/scripts/wssc.sh new file mode 100644 index 0000000000..5f1aededb6 --- /dev/null +++ b/scripts/wssc.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Copyright (c) 2025 Status Research & Development GmbH. +# Licensed under either of: +# - Apache License, version 2.0 +# - MIT license +# at your option. + +# prevent issue https://github.com/status-im/nimbus-eth1/issues/3661 + +set -e + +cd "$(dirname "${BASH_SOURCE[0]}")"/.. + +REPO_DIR="${PWD}" + +mkdir -p reports + +docker run -d \ + -v ${REPO_DIR}/autobahn:/config \ + -v ${REPO_DIR}/reports:/reports \ + --network=host \ + --name fuzzingserver_tls \ + crossbario/autobahn-testsuite wstest --webport=0 --mode fuzzingserver --spec /config/fuzzingserver_tls.json + +nim c -d:tls -d:release -o:examples/autobahn_tlsclient examples/autobahn_client +examples/autobahn_tlsclient + +docker kill fuzzingserver_tls From dac25a0d64e539e6322c5f4ecb642a987f9663d8 Mon Sep 17 00:00:00 2001 From: jangko Date: Fri, 19 Sep 2025 08:30:47 +0700 Subject: [PATCH 07/12] Fix docker image cache mechanism --- .github/workflows/ci.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 229f87587d..093a6d9e0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,8 @@ name: CI +permissions: + contents: read + pull-requests: write + on: push: branches: @@ -69,10 +73,16 @@ jobs: dockerHash=$(docker buildx imagetools inspect crossbario/autobahn-testsuite | grep "Digest" | cut -d':' -f 3) echo "cache_key=$dockerHash" >> $GITHUB_OUTPUT - - name: Cache Docker images - uses: ScribeMD/docker-cache@0.5.0 + - name: Cache Docker image + id: cache-docker-image + uses: actions/cache@v4 with: - key: docker-${{ runner.os }}-${{ steps.cache_key.outputs.cache_key }} + path: /var/lib/docker # Or the specific path where your image is stored + key: ${{ runner.os }}-docker-image-${{ steps.cache_key.outputs.cache_key }} + + - name: Pull Docker image if not cached + if: steps.cache-docker-image.outputs.cache-hit != 'true' + run: docker pull crossbario/autobahn-testsuite:latest - name: Setup Python version uses: actions/setup-python@v5 @@ -136,3 +146,9 @@ jobs: with: personal_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./autobahn_reports + + - name: Delete artefacts + uses: geekyeggo/delete-artifact@v5 + with: + failOnError: false + name: autobahn-report From 8716113444839a8bd4e1f8ef1b856c3864c83379 Mon Sep 17 00:00:00 2001 From: jangko Date: Fri, 19 Sep 2025 10:05:44 +0700 Subject: [PATCH 08/12] Fix autobahn reports gen --- .github/workflows/ci.yml | 35 +++++++++++++++++++---------------- autobahn/index.md | 4 ---- scripts/ws.sh | 12 ++++++++++-- scripts/wsc.sh | 27 +++++++++++++++++---------- scripts/wss.sh | 26 ++++++++++++++++++-------- scripts/wssc.sh | 12 ++++++++++-- 6 files changed, 74 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 093a6d9e0e..ea83c384bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,4 @@ name: CI -permissions: - contents: read - pull-requests: write on: push: @@ -84,27 +81,18 @@ jobs: if: steps.cache-docker-image.outputs.cache-hit != 'true' run: docker pull crossbario/autobahn-testsuite:latest - - name: Setup Python version - uses: actions/setup-python@v5 - with: - python-version: pypy-3.10 - - - name: Setup dependencies - run: | - pip install markdown2 - nimble install -y --depsOnly - - name: Generate index.html - if: matrix.websock == 'ws' + # Run this step only once for all matrix combinations + if: matrix.websock == 'ws' && matrix.branch == 'devel' run: | mkdir autobahn/reports sed -i "s/COMMIT_SHA_SHORT/${GITHUB_SHA::7}/g" autobahn/index.md sed -i "s/COMMIT_SHA/$GITHUB_SHA/g" autobahn/index.md - markdown2 autobahn/index.md > autobahn/reports/index.html + cp -a autobahn/index.md > autobahn/reports/index.md - name: Run Autobahn test suite run: | - bash scripts/${{ matrix.websock }}.sh + bash scripts/${{ matrix.websock }}.sh ${{ matrix.branch }} - name: Upload Autobahn result uses: actions/upload-artifact@v4 @@ -141,6 +129,21 @@ jobs: name: autobahn-report path: ./autobahn_reports + - name: Setup Python version + uses: actions/setup-python@v5 + with: + python-version: pypy-3.10 + + - name: Setup dependencies + run: | + pip install markdown2 + nimble install -y --depsOnly + + - name: Setup dependencies + run: | + cat autobahn/reports/*.txt >> autobahn/reports/index.md + markdown2 autobahn/reports/index.md > autobahn/reports/index.html + - name: Deploy autobahn report uses: peaceiris/actions-gh-pages@v4 with: diff --git a/autobahn/index.md b/autobahn/index.md index 36dd20dfe1..700b065b42 100644 --- a/autobahn/index.md +++ b/autobahn/index.md @@ -2,7 +2,3 @@ Generated by commit [COMMIT_SHA_SHORT](https://github.com/status-im/nim-websock/commit/COMMIT_SHA). -* [ws server summary report](server/index.html) -* [wss server summary report](server_tls/index.html) -* [ws client summary report](client/index.html) -* [wss client summary report](client_tls/index.html) diff --git a/scripts/ws.sh b/scripts/ws.sh index 26df6a5cb6..f8b6686a10 100644 --- a/scripts/ws.sh +++ b/scripts/ws.sh @@ -10,6 +10,10 @@ set -e +# script arguments +[[ $# -ne 1 ]] && { echo "Usage: $0 NIM_VERSION"; } +NIM_VERSION="$1" + cd "$(dirname "${BASH_SOURCE[0]}")"/.. REPO_DIR="${PWD}" @@ -18,13 +22,17 @@ nim c -d:release examples/server examples/server & server=$! -mkdir -p reports +mkdir -p autobahn/reports docker run \ -v ${REPO_DIR}/autobahn:/config \ - -v ${REPO_DIR}/reports:/reports \ + -v ${REPO_DIR}/autobahn/reports:/reports \ --network=host \ --name fuzzingclient \ crossbario/autobahn-testsuite wstest --mode fuzzingclient --spec /config/fuzzingclient.json kill $server + +mv autobahn/reports/server autobahn/reports/server-${NIM_VERSION} + +echo "* [Nim-${NIM_VERSION} ws server summary report](server-${NIM_VERSION}/index.html)" > "autobahn/reports/server-${NIM_VERSION}.txt" diff --git a/scripts/wsc.sh b/scripts/wsc.sh index 259793f175..5b4da3f735 100644 --- a/scripts/wsc.sh +++ b/scripts/wsc.sh @@ -10,21 +10,28 @@ set -e +# script arguments +[[ $# -ne 1 ]] && { echo "Usage: $0 NIM_VERSION"; } +NIM_VERSION="$1" + cd "$(dirname "${BASH_SOURCE[0]}")"/.. REPO_DIR="${PWD}" -nim c -d:tls -d:release -o:examples/tls_server examples/server.nim -examples/tls_server & -server=$! - -mkdir -p reports +mkdir -p autobahn/reports -docker run \ +docker run -d \ -v ${REPO_DIR}/autobahn:/config \ - -v ${REPO_DIR}/reports:/reports \ + -v ${REPO_DIR}/autobahn/reports:/reports \ --network=host \ - --name fuzzingclient_tls \ - crossbario/autobahn-testsuite wstest --mode fuzzingclient --spec /config/fuzzingclient_tls.json + --name fuzzingserver \ + crossbario/autobahn-testsuite wstest --webport=0 --mode fuzzingserver --spec /config/fuzzingserver.json + +nim c -d:release examples/autobahn_client +examples/autobahn_client + +docker kill fuzzingserver + +mv autobahn/reports/client autobahn/reports/client-${NIM_VERSION} -kill $server +echo "* [Nim-${NIM_VERSION} ws client summary report](client-${NIM_VERSION}/index.html)" > "autobahn/reports/client-${NIM_VERSION}.txt" diff --git a/scripts/wss.sh b/scripts/wss.sh index db062bab41..cd51fe69e0 100644 --- a/scripts/wss.sh +++ b/scripts/wss.sh @@ -8,22 +8,32 @@ # prevent issue https://github.com/status-im/nimbus-eth1/issues/3661 + set -e +# script arguments +[[ $# -ne 1 ]] && { echo "Usage: $0 NIM_VERSION"; } +NIM_VERSION="$1" + cd "$(dirname "${BASH_SOURCE[0]}")"/.. REPO_DIR="${PWD}" -mkdir -p reports +nim c -d:tls -d:release -o:examples/tls_server examples/server.nim +examples/tls_server & +server=$! -docker run -d \ +mkdir -p autobahn/reports + +docker run \ -v ${REPO_DIR}/autobahn:/config \ - -v ${REPO_DIR}/reports:/reports \ + -v ${REPO_DIR}/autobahn/reports:/reports \ --network=host \ - --name fuzzingserver \ - crossbario/autobahn-testsuite wstest --webport=0 --mode fuzzingserver --spec /config/fuzzingserver.json + --name fuzzingclient_tls \ + crossbario/autobahn-testsuite wstest --mode fuzzingclient --spec /config/fuzzingclient_tls.json + +kill $server -nim c -d:release examples/autobahn_client -examples/autobahn_client +mv autobahn/reports/server_tls autobahn/reports/server_tls-${NIM_VERSION} -docker kill fuzzingserver +echo "* [Nim-${NIM_VERSION} wss server summary report](server_tls-${NIM_VERSION}/index.html)" > "autobahn/reports/server_tls-${NIM_VERSION}.txt" diff --git a/scripts/wssc.sh b/scripts/wssc.sh index 5f1aededb6..8174438825 100644 --- a/scripts/wssc.sh +++ b/scripts/wssc.sh @@ -10,15 +10,19 @@ set -e +# script arguments +[[ $# -ne 1 ]] && { echo "Usage: $0 NIM_VERSION"; } +NIM_VERSION="$1" + cd "$(dirname "${BASH_SOURCE[0]}")"/.. REPO_DIR="${PWD}" -mkdir -p reports +mkdir -p autobahn/reports docker run -d \ -v ${REPO_DIR}/autobahn:/config \ - -v ${REPO_DIR}/reports:/reports \ + -v ${REPO_DIR}/autobahn/reports:/reports \ --network=host \ --name fuzzingserver_tls \ crossbario/autobahn-testsuite wstest --webport=0 --mode fuzzingserver --spec /config/fuzzingserver_tls.json @@ -27,3 +31,7 @@ nim c -d:tls -d:release -o:examples/autobahn_tlsclient examples/autobahn_client examples/autobahn_tlsclient docker kill fuzzingserver_tls + +mv autobahn/reports/client_tls autobahn/reports/client_tls-${NIM_VERSION} + +echo "* [Nim-${NIM_VERSION} wss client summary report](client_tls-${NIM_VERSION}/index.html)" > "autobahn/reports/client_tls-${NIM_VERSION}.txt" From 22ff663a18c1bd54bb42d1b2286e4b1d3f0ea2d2 Mon Sep 17 00:00:00 2001 From: jangko Date: Fri, 19 Sep 2025 10:09:18 +0700 Subject: [PATCH 09/12] Fix dependencies --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea83c384bc..07334d912a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,10 @@ jobs: if: steps.cache-docker-image.outputs.cache-hit != 'true' run: docker pull crossbario/autobahn-testsuite:latest + - name: Setup dependencies + run: | + nimble install -y --depsOnly + - name: Generate index.html # Run this step only once for all matrix combinations if: matrix.websock == 'ws' && matrix.branch == 'devel' @@ -137,7 +141,6 @@ jobs: - name: Setup dependencies run: | pip install markdown2 - nimble install -y --depsOnly - name: Setup dependencies run: | From 36d03560ad5a9d4b06f05ef6ede2929bc25fd288 Mon Sep 17 00:00:00 2001 From: jangko Date: Fri, 19 Sep 2025 10:20:54 +0700 Subject: [PATCH 10/12] Argh --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07334d912a..bb8d6fe8e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,7 +92,7 @@ jobs: mkdir autobahn/reports sed -i "s/COMMIT_SHA_SHORT/${GITHUB_SHA::7}/g" autobahn/index.md sed -i "s/COMMIT_SHA/$GITHUB_SHA/g" autobahn/index.md - cp -a autobahn/index.md > autobahn/reports/index.md + cp -a autobahn/index.md autobahn/reports/index.md - name: Run Autobahn test suite run: | From d1f1335532e1e4420a9d617b498a377029b3ef0d Mon Sep 17 00:00:00 2001 From: jangko Date: Fri, 19 Sep 2025 11:29:12 +0700 Subject: [PATCH 11/12] Fix autobahn reports paths --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb8d6fe8e5..76e1e9f4aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,6 +121,8 @@ jobs: name: "Deploy Autobahn results" needs: merge-autobahn-artifact runs-on: ubuntu-latest + permissions: + contents: write defaults: run: @@ -144,8 +146,8 @@ jobs: - name: Setup dependencies run: | - cat autobahn/reports/*.txt >> autobahn/reports/index.md - markdown2 autobahn/reports/index.md > autobahn/reports/index.html + cat autobahn_reports/*.txt >> autobahn_reports/index.md + markdown2 autobahn_reports/index.md > autobahn_reports/index.html - name: Deploy autobahn report uses: peaceiris/actions-gh-pages@v4 From 4ae0e869e902a6a3c8c69a75a5e1f7148b828611 Mon Sep 17 00:00:00 2001 From: jangko Date: Fri, 19 Sep 2025 11:33:20 +0700 Subject: [PATCH 12/12] Remove artifact after usage --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76e1e9f4aa..cd097c9860 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,4 +159,7 @@ jobs: uses: geekyeggo/delete-artifact@v5 with: failOnError: false - name: autobahn-report + name: | + autobahn-report + autobahn-artifact-* +