ci: check runner for parallel integration tests and use value from vars

This commit is contained in:
Slava 2025-02-21 18:23:08 +02:00 committed by Eric
parent ff62751cce
commit 14d4dfae38
No known key found for this signature in database
2 changed files with 48 additions and 7 deletions

View File

@ -43,6 +43,46 @@ jobs:
nim_version: ${{ matrix.nim_version }}
coverage: false
- name: Check runner resources for parallel integration tests
run: |
echo "Determining runner"
case "${{ matrix.os }}" in
linux) CPU=$(nproc --all)
RAM=$(awk '/MemTotal/ {print int($2 / 1024 / 1024 + 0.5)}' /proc/meminfo)
;;
macos) CPU=$(sysctl -n hw.ncpu)
RAM=$(sysctl -n hw.memsize | awk '{print $0/1073741824}')
sysctl -n hw.ncpu
;;
windows) CPU=$NUMBER_OF_PROCESSORS
RAM=$(systeminfo | awk '/Total Physical Memory:/ { gsub(/,/,"."); print int($4 + 0.5) }')
;;
*) CPU=2
RAM=8
echo "Unknown runner"
;;
esac
echo "CPU=${CPU}" >> $GITHUB_ENV
echo "RAM=${RAM}" >> $GITHUB_ENV
echo "TYPE=${RUNNER_ENVIRONMENT}" >> $GITHUB_ENV
# Set PARALLEL=1 if the runner has enough resources
if [[ ("${{ matrix.os }}" == "linux" || "${{ matrix.os }}" == "windows") && "${CPU}" -ge 16 ]]; then
echo "PARALLEL=1" >> $GITHUB_ENV
elif [[ "${{ matrix.os }}" == "macos" && "${CPU}" -ge 6 ]]; then
echo "PARALLEL=1" >> $GITHUB_ENV
else
echo "PARALLEL=0" >> $GITHUB_ENV
fi
- name: Show runner information
run: |
echo "OS: ${{ matrix.os }}"
echo "CPU: ${{ env.CPU }}"
echo "RAM: ${{ env.RAM }} GB"
echo "TYPE: ${{ env.TYPE }}"
echo "PARALLEL: ${{ env.PARALLEL }}"
## Part 1 Tests ##
- name: Unit tests
if: matrix.tests == 'unittest' || matrix.tests == 'all'
@ -55,7 +95,7 @@ jobs:
node-version: 22
- name: Install Ethereum node dependencies
if: matrix.tests == 'contract' || matrix.tests == 'integration' || matrix.tests == 'integration-parallel' || matrix.tests == 'tools' || matrix.tests == 'all'
if: matrix.tests == 'contract' || matrix.tests == 'integration' || matrix.tests == 'tools' || matrix.tests == 'all'
working-directory: vendor/codex-contracts-eth
env:
MSYS2_PATH_TYPE: inherit
@ -82,15 +122,11 @@ jobs:
if: matrix.tests == 'integration' || matrix.tests == 'all'
env:
CODEX_INTEGRATION_TEST_INCLUDES: ${{ matrix.includes }}
run: make -j${ncpu} PARALLEL=0 testIntegration
- name: Parallel integration tests
if: matrix.tests == 'integration-parallel'
run: make -j${ncpu} DEBUG=${{ runner.debug }} testIntegration
run: make -j${ncpu} PARALLEL=${{ env.PARALLEL }} DEBUG=${{ runner.debug }} testIntegration
- name: Upload integration tests log files
uses: actions/upload-artifact@v4
if: (matrix.tests == 'integration' || matrix.tests == 'integration-parallel' || matrix.tests == 'all') && always()
if: (matrix.tests == 'integration' || matrix.tests == 'all') && always()
with:
name: ${{ matrix.os }}-${{ matrix.cpu }}-${{ matrix.nim_version }}-${{ matrix.job_number }}-integration-tests-logs
path: tests/integration/logs/

View File

@ -10,6 +10,10 @@ on:
env:
cache_nonce: 0 # Allows for easily busting actions/cache caches
nim_version: v2.2.4
builder_integration_from_vars: true
builder_integration_linux: runner-node-01-linux-03-eu-hel1
builder_integration_macos: macos-14-large
builder_integration_windows: windows-latest-amd64-32vcpu
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
@ -18,6 +22,7 @@ concurrency:
jobs:
matrix:
name: Compute matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}