mirror of
https://github.com/status-im/nim-codex.git
synced 2025-02-23 16:08:40 +00:00
ci: detect if runner is ready for integration-parallel tests
This commit is contained in:
parent
992f7bcabe
commit
0990d560a7
47
.github/workflows/ci-reusable.yml
vendored
47
.github/workflows/ci-reusable.yml
vendored
@ -17,6 +17,7 @@ env:
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJson(inputs.matrix) }}
|
||||
|
||||
@ -42,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'
|
||||
@ -76,12 +117,12 @@ jobs:
|
||||
|
||||
## Part 3 Tests ##
|
||||
- name: Integration tests
|
||||
if: matrix.tests == 'integration' || matrix.tests == 'all'
|
||||
if: (matrix.tests == 'integration' || matrix.tests == 'all') && matrix.tests != 'integration-parallel'
|
||||
run: make -j${ncpu} PARALLEL=0 testIntegration
|
||||
|
||||
- name: Parallel integration tests
|
||||
if: matrix.tests == 'integration-parallel'
|
||||
run: make -j${ncpu} DEBUG=${{ runner.debug }} testIntegration
|
||||
if: (matrix.tests == 'integration-parallel' || matrix.tests == 'all') && matrix.tests != 'integration'
|
||||
run: make -j${ncpu} PARALLEL=${{ env.PARALLEL }} DEBUG=${{ runner.debug }} testIntegration
|
||||
|
||||
- name: Upload integration tests log files
|
||||
uses: actions/upload-artifact@v4
|
||||
|
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
@ -27,10 +27,15 @@ jobs:
|
||||
uses: fabiocaccamo/create-matrix-action@v5
|
||||
with:
|
||||
matrix: |
|
||||
os {linux}, cpu {amd64}, builder {runner-node-01-linux-03-eu-hel1}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
|
||||
os {macos}, cpu {amd64}, builder {macos-14-large}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
|
||||
os {windows}, cpu {amd64}, builder {windows-latest-amd64-32vcpu}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {msys2}
|
||||
|
||||
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
|
||||
os {linux}, cpu {arm64}, builder {ubuntu-24.04-arm}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
|
||||
os {linux}, cpu {amd64}, builder {ubuntu-latest-amd64-16vcpu}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
|
||||
os {macos}, cpu {amd64}, builder {macos-13}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
|
||||
os {macos}, cpu {amd64}, builder {macos-latest}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
|
||||
os {macos}, cpu {amd64}, builder {macos-14-large}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
|
||||
os {macos}, cpu {amd64}, builder {macos-14-xlarge}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
|
||||
os {windows}, cpu {amd64}, builder {windows-latest}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {msys2}
|
||||
os {windows}, cpu {amd64}, builder {windows-latest-amd64-16vcpu}, tests {integration-parallel}, nim_version {${{ env.nim_version }}}, shell {msys2}
|
||||
|
||||
build:
|
||||
needs: matrix
|
||||
|
Loading…
x
Reference in New Issue
Block a user