Actions on VM: 2nd Retry for tests, In-process, Framework 4.8? All th… #54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CPU Usage Tests Matrix | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ "master" ] | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| TestCpuUsageOnVm: | |
| name: On VM | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: 'x64-debian-10' | |
| - os: 'x64-debian-11' | |
| - os: 'x64-debian-12' | |
| - os: 'x64-debian-13' | |
| - os: 'x64-ubuntu-22.04' | |
| - os: 'x64-ubuntu-24.04' | |
| - os: 'arm64-debian-10' | |
| - os: 'arm64-debian-11' | |
| - os: 'arm64-debian-12' | |
| - os: 'arm64-debian-13' | |
| - os: 'arm64-ubuntu-14.04' | |
| - os: 'arm64-ubuntu-16.04' | |
| - os: 'arm64-ubuntu-18.04' | |
| - os: 'arm64-ubuntu-20.04' | |
| - os: 'arm64-ubuntu-22.04' | |
| - os: 'arm64-ubuntu-24.04' | |
| - os: 'armel-debian-8' | |
| - os: 'armel-debian-9' | |
| - os: 'armel-debian-10' | |
| - os: 'armel-debian-11' | |
| - os: 'armhf-debian-8' | |
| - os: 'armhf-debian-9' | |
| - os: 'armhf-debian-10' | |
| - os: 'armhf-debian-11' | |
| - os: 'armhf-debian-12' | |
| - os: 'armhf-ubuntu-14.04' | |
| - os: 'armhf-ubuntu-16.04' | |
| - os: 'armhf-ubuntu-18.04' | |
| - os: 'armhf-ubuntu-20.04' | |
| - os: 'armhf-ubuntu-22.04' | |
| - os: 'armhf-ubuntu-24.04' | |
| - os: 'i386-debian-10' | |
| - os: 'i386-debian-11' | |
| - os: 'i386-debian-12' | |
| runs-on: ubuntu-20.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Bootstrap (timeout and try-and-retry) | |
| run: | | |
| script=https://raw.githubusercontent.com/devizer/test-and-build/master/install-build-tools-bundle.sh; (wget -q -nv --no-check-certificate -O - $script 2>/dev/null || curl -ksSL $script) | bash > /dev/null | |
| dotnet --info | |
| Say "Installing timeout" | |
| try-and-retry sudo apt-get update -qq; | |
| try-and-retry sudo apt-get install bsdutils -y -qq; | |
| timeout --version | |
| - name: Build Tests | |
| run: | | |
| set -ue; set -o pipefail | |
| cd Universe.CpuUsage.Tests | |
| Reset-Target-Framework -fw net48 | |
| time try-and-retry dotnet build -c Release -f net48 -o "$HOME/Artifacts" >/dev/null | |
| - name: Pull VM | |
| run: | | |
| set -ue; set -o pipefail | |
| docker version | |
| try-and-retry docker pull "devizervlad/crossplatform-pipeline:${{ matrix.os }}" | |
| - name: Run Tests | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 12 | |
| max_attempts: 3 | |
| shell: bash | |
| retry_wait_seconds: 1 | |
| on_retry_command: 'docker rm -f VM 2>/dev/null || true' | |
| command: | | |
| set -ue; set -o pipefail | |
| cat << 'EOF' > "$HOME/Artifacts/lets-rock.sh" | |
| Say "STARTING TESTS"; | |
| free -m; | |
| nunit3-console --inprocess --workers=1 Universe.CpuUsage.Tests.dll | tee /job/PRECISION.LOG; | |
| Say "TESTS COMPLETED" | |
| EOF | |
| cat "$HOME/Artifacts/lets-rock.sh" | |
| timeout 666 docker run --privileged -e VM_MEM=1000M -e VM_CPUS=2 -e QEMU_TCG_ACCELERATOR=tcg --name VM --hostname VM --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined -t \ | |
| -v "$HOME/Artifacts":/job \ | |
| "devizervlad/crossplatform-pipeline:${{ matrix.os }}" \ | |
| bash -e lets-rock.sh | |
| - name: PREPARE Artifact | |
| run: | | |
| mkdir -p "${{ github.workspace }}/Artifact" | |
| cp -f $HOME/Artifacts/PRECISION.LOG "${{ github.workspace }}/Artifact/PRECISION on ${{ matrix.os }}.LOG" | |
| cat $HOME/Artifacts/PRECISION.LOG | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: 'Precision ${{ matrix.os }}' | |
| path: '${{ github.workspace }}/Artifact' | |
| TestCpuUsageonHost: | |
| name: On Host | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-2025 | |
| - os: windows-2022 | |
| - os: windows-2019 | |
| - os: ubuntu-20.04 | |
| - os: ubuntu-22.04 | |
| - os: ubuntu-24.04 | |
| - os: macos-13 | |
| - os: macos-14 | |
| - os: macos-15 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Environment | |
| run: 'printenv | sort' | |
| - name: Setup .NET Core | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0 | |
| - name: .NET Info | |
| run: | | |
| script=https://raw.githubusercontent.com/devizer/test-and-build/master/install-build-tools-bundle.sh; (wget -q -nv --no-check-certificate -O - $script 2>/dev/null || curl -ksSL $script) | bash > /dev/null | |
| dotnet --info | |
| - name: TEST full (and build) | |
| run: | | |
| set -eu; | |
| Say ".NET SDK LIST" | |
| dotnet --list-sdks | |
| if [[ "$(uname -s)" == Linux ]]; then | |
| Say "Linux Kernel: [$(uname -r 2>/dev/null)]" | |
| fi | |
| TARGET_FRAMEWORKS_TEST="${TARGET_FRAMEWORKS_TEST:-net8.0}" | |
| cd Universe.CpuUsage.Tests | |
| Say "Building $TARGET_FRAMEWORKS_TEST" | |
| sed -i -E 's|<TargetFrameworks>.*</TargetFrameworks>|<TargetFrameworks>'$TARGET_FRAMEWORKS_TEST'</TargetFrameworks>|' *.csproj | |
| time try-and-retry dotnet build -c Release -f $TARGET_FRAMEWORKS_TEST >/dev/null 2>&1 | |
| Say "Testing" | |
| dotnet test --no-build -c Release -f $TARGET_FRAMEWORKS_TEST | |
| - name: SHOW Precision Histogram | |
| run: | | |
| set -eu; | |
| Say "Linux Kernel: [$(uname -r 2>/dev/null)]" | |
| cd Universe.CpuUsage.Tests | |
| TARGET_FRAMEWORKS_TEST="${TARGET_FRAMEWORKS_TEST:-net8.0}" | |
| mkdir -p ../Artifact | |
| dotnet test --no-build -c Release -f $TARGET_FRAMEWORKS_TEST --filter "Name ~ Show_Precision_Histogram" | tee "../Artifact/PRECISION on ${{ matrix.os }}.LOG" & | |
| - name: Upload artifacts [${{ env.THEARTIFACTS_NATIVE }}] | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: 'Precision ${{ matrix.os }}' | |
| path: '${{ github.workspace }}/Artifact' | |
| Combine: | |
| name: Combine results in a single Artifact | |
| needs: [TestCpuUsageonHost, TestCpuUsageOnVm] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: '**' | |
| path: "${{ runner.temp }}/Combined" | |
| merge-multiple: true | |
| - name: Show Download Structure | |
| run: 'sudo apt-get update -qq; sudo apt-get install tree -y -qq; tree $RUNNER_TEMP' | |
| - name: Upload Combined System Info | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: 'Combined CPU Usage Tests' | |
| path: "${{ runner.temp }}/Combined" | |