From a7e63da0662b77a2b2d9c0143d4197c85589bde0 Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Sun, 15 Oct 2023 19:47:53 +0200 Subject: [PATCH] CI Job for Consensus specs (#8483) Consensus Specification Tests takes less than 8 minutes so I think they can be in a PR's own CI for whenever it is ready. for reference it is less than make test --- .github/workflows/test-integration-caplin.yml | 62 +++++++++++++++++++ cl/spectest/Makefile | 12 ++-- cl/spectest/wmake.ps1 | 37 +++++++++++ 3 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/test-integration-caplin.yml create mode 100644 cl/spectest/wmake.ps1 diff --git a/.github/workflows/test-integration-caplin.yml b/.github/workflows/test-integration-caplin.yml new file mode 100644 index 000000000..65e929a87 --- /dev/null +++ b/.github/workflows/test-integration-caplin.yml @@ -0,0 +1,62 @@ +name: Consensus specification tests +on: + push: + branches: + - devel + - alpha + - 'release/**' + pull_request: + branches: + - devel + - alpha + - 'release/**' + types: + - opened + - reopened + - synchronize + - ready_for_review + +jobs: + tests: + strategy: + matrix: + os: [ ubuntu-20.04, macos-11 ] # list of os: https://github.com/actions/virtual-environments + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + - name: Install dependencies on Linux + if: runner.os == 'Linux' + run: sudo apt update && sudo apt install build-essential + + - name: test-integration-caplin + run: cd cl/spectest && make tests && make mainnet + + tests-windows: + strategy: + matrix: + os: [ windows-2022 ] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - uses: actions/cache@v3 + with: + path: | + C:\ProgramData\chocolatey\lib\mingw + C:\ProgramData\chocolatey\lib\cmake + key: chocolatey-${{ matrix.os }} + - name: Install dependencies + run: | + choco upgrade mingw -y --no-progress --version 11.2.0.07112021 + choco install cmake -y --no-progress --version 3.23.1 + + - name: test-integration-caplin + run: cd ./cl/spectest/ && .\wmake.ps1 Tests Mainnet diff --git a/cl/spectest/Makefile b/cl/spectest/Makefile index 487b0598b..f4f5be196 100644 --- a/cl/spectest/Makefile +++ b/cl/spectest/Makefile @@ -2,8 +2,8 @@ tests: - git clone https://github.com/ethereum/consensus-spec-tests - cd consensus-spec-tests && git checkout 70dc28b18c71f3ae080c02f51bd3421e0b60609b && git lfs pull && cd .. + GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/ethereum/consensus-spec-tests + cd consensus-spec-tests && git checkout 70dc28b18c71f3ae080c02f51bd3421e0b60609b && git lfs pull --exclude=tests/general,tests/minimal && cd .. mv consensus-spec-tests/tests . rm -rf consensus-spec-tests rm -rf tests/minimal @@ -13,11 +13,7 @@ tests: rm -rf tests/mainnet/deneb clean: - rm -rf junit.xml - rm -rf test_report.html + rm -rf tests mainnet: - go test -tags=spectest -run=/mainnet -failfast -v - -run: - go test -v + CGO_CFLAGS=-D__BLST_PORTABLE__ go test -tags=spectest -run=/mainnet -failfast -v --timeout 30m diff --git a/cl/spectest/wmake.ps1 b/cl/spectest/wmake.ps1 new file mode 100644 index 000000000..ecc6269a7 --- /dev/null +++ b/cl/spectest/wmake.ps1 @@ -0,0 +1,37 @@ +# Clean Function +function Clean { + Remove-Item -Recurse -Force -Path .\tests +} + +# Tests Function +function Tests { + $env:GIT_LFS_SKIP_SMUDGE = "1" + $gitCloneCmd = "git clone https://github.com/ethereum/consensus-spec-tests" + $gitCheckoutCmd = "cd consensus-spec-tests; git checkout 70dc28b18c71f3ae080c02f51bd3421e0b60609b; git lfs pull --exclude=tests/general,tests/minimal; cd .." + + Invoke-Expression $gitCloneCmd + Invoke-Expression $gitCheckoutCmd + + Move-Item -Path ".\consensus-spec-tests\tests" -Destination ".\" -Force + Remove-Item -Path ".\consensus-spec-tests" -Recurse -Force + Remove-Item -Path ".\tests\minimal" -Recurse -Force + Remove-Item -Path ".\tests\mainnet\eip6110" -Recurse -Force + Remove-Item -Path ".\tests\mainnet\deneb" -Recurse -Force +} + +# Mainnet Function +function Mainnet { + $env:CGO_CFLAGS = "-D__BLST_PORTABLE__" + go test -tags=spectest -run="/mainnet" -failfast -v +} + +# Main Targets +if ($MyInvocation.BoundParameters["clean"]) { + Clean +} +elseif ($MyInvocation.BoundParameters["tests"]) { + Tests +} else { + Mainnet +} +