Skip to content

Merge pull request #160 from Wire-Network/feature/test-wasm-additiona… #321

Merge pull request #160 from Wire-Network/feature/test-wasm-additiona…

Merge pull request #160 from Wire-Network/feature/test-wasm-additiona… #321

Workflow file for this run

name: "Build & Test(Parallel ctest)"
on:
push:
branches:
- master
- "release/*"
pull_request:
branches:
- master
paths:
- 'libraries/**'
- 'programs/**'
- 'plugins/**'
- 'unittests/**'
- 'tests/**'
workflow_dispatch:
inputs:
override-cdt:
description: 'Override cdt target'
type: string
override-cdt-prerelease:
type: choice
description: Override cdt prelease
options:
- default
- true
- false
override-sys-system-contracts:
description: 'Override sys-system-contracts ref'
type: string
permissions:
packages: read
contents: read
defaults:
run:
shell: bash
jobs:
platform-cache:
name: Platform Cache
uses: Wire-Network/platform-cache-workflow/.github/workflows/platformcache.yaml@v1
permissions:
packages: write
contents: read
with:
runs-on: '["self-hosted", "enf-x86-beefy"]'
platform-files: |
.cicd/platforms
build-base:
name: Run Build Workflow
uses: ./.github/workflows/build_base.yaml
needs: [platform-cache]
secrets:
GH_TOKEN_DEV: ${{ secrets.GH_TOKEN_DEV }}
with:
platforms: ${{needs.platform-cache.outputs.platforms}}
platform-list: ${{needs.platform-cache.outputs.platform-list}}
v:
name: Discover Versions
runs-on: ubuntu-latest
outputs:
cdt-target: ${{steps.versions.outputs.cdt-target}}
cdt-prerelease: ${{steps.versions.outputs.cdt-prerelease}}
wire-system-contracts-ref: ${{steps.versions.outputs.wire-system-contracts-ref}}
steps:
- name: Setup wire-cdt and wire-system-contracts versions
id: versions
env:
GH_TOKEN: ${{secrets.GH_TOKEN_DEV}}
run: |
DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url))
echo cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '.wirecdt.target') >> $GITHUB_OUTPUT
echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '.wirecdt.prerelease') >> $GITHUB_OUTPUT
echo wire-system-contracts-ref=$(echo "$DEFAULTS_JSON" | jq -r '.wiresystemcontracts.ref') >> $GITHUB_OUTPUT
if [[ "${{inputs.override-cdt}}" != "" ]]; then
echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-cdt-prerelease}}" == +(true|false) ]]; then
echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-wire-system-contracts}}" != "" ]]; then
echo wire-system-contracts-ref=${{inputs.override-wire-system-contracts}} >> $GITHUB_OUTPUT
fi
package:
name: Build deb packages
needs: [platform-cache, build-base]
strategy:
fail-fast: false
matrix:
platform: [ubuntu24, ubsan, asan, asserton, gcc]
runs-on: ubuntu-latest
container: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.platform].image}}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download builddir
uses: actions/download-artifact@v4
with:
name: ${{matrix.platform}}-build
- name: Build packages
run: |
tar xzf build.tar.gz
cd build
cpack
../tools/tweak-deb.sh wire-sysio_*.deb
- name: Install dev package
if: matrix.platform != 'reproducible'
run: |
apt-get update && apt-get upgrade -y
apt-get install -y ./build/wire-sysio_*.deb
# - name: Test using TestHarness
# if: matrix.platform != 'reproducible'
# run: |
# python3 -c "import sys; sys.path.append('tests'); from TestHarness import Cluster; print('OK')"
- name: Upload dev package
uses: actions/upload-artifact@v4
if: matrix.platform != 'reproducible'
with:
name: wire-sysio-dev-${{matrix.platform}}-amd64
path: build/wire-sysio-dev*.deb
- name: Upload sysio package
uses: actions/upload-artifact@v4
if: matrix.platform == 'reproducible'
with:
name: sysio-deb-amd64
path: build/wire-sysio_*.deb
tests:
name: Tests (${{matrix.cfg.name}})
needs: [platform-cache, build-base]
strategy:
fail-fast: false
matrix:
include:
- cfg: {name: 'ubuntu24', base: 'ubuntu24', builddir: 'ubuntu24'}
- cfg: {name: 'ubsan', base: 'ubsan', builddir: 'ubsan'}
- cfg: {name: 'asan', base: 'asan', builddir: 'asan'}
- cfg: {name: 'asserton', base: 'asserton', builddir: 'asserton'}
- cfg: {name: 'gcc', base: 'gcc', builddir: 'gcc'}
runs-on: ["self-hosted", "enf-x86-beefy"]
container:
image: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.cfg.base].image}}
credentials:
username: dev-wire
password: ${{ secrets.GH_TOKEN_DEV }}
options: --security-opt seccomp=unconfined --mount type=bind,source=/var/lib/systemd/coredump,target=/cores
volumes:
- ${{ github.workspace }}:/__w/wire-sysio/wire-sysio
steps:
- name: Ensure writable workspace
run: |
echo "User is $USER"
echo "Fixing permissions on workspace for user $(whoami)"
sudo chown -R $USER:$USER "$GITHUB_WORKSPACE"
sudo chmod -R u+rwX "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
- name: Download builddir
uses: actions/download-artifact@v4
with:
name: ${{matrix.cfg.builddir}}-build
- name: Debug environment and workspace
run: |
echo "=== SYSTEM INFO ==="
whoami
id
hostname
echo
echo "=== ENVIRONMENT ==="
env | sort
echo
echo "=== DOCKER CONTEXT INFO ==="
docker context ls || true
echo "Current DOCKER_HOST: $DOCKER_HOST"
echo "Current DOCKER_CONTEXT: $DOCKER_CONTEXT"
echo
echo "=== GITHUB WORKSPACE ==="
echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
echo "Current directory: $PWD"
ls -la "$GITHUB_WORKSPACE" || true
echo
echo "=== PATHS & PERMISSIONS ==="
echo "--- /github ---"
ls -ld /github || true
echo "--- /github/home ---"
ls -ld /github/home || true
echo "--- Current workspace ---"
ls -ld "$GITHUB_WORKSPACE" || true
echo "--- ./build ---"
ls -ld build || true
ls -ld "$GITHUB_WORKSPACE/build" || true
echo "--- ./build/Testing ---"
ls -ld build/Testing || true
echo "--- ./build/Testing/Temporary ---"
ls -ld build/Testing/Temporary || true
echo
echo "=== FILE OWNERSHIP TOP 20 ==="
find "$GITHUB_WORKSPACE" -maxdepth 2 -type d -printf '%u:%g %p\n' 2>/dev/null | sort | uniq -c | sort -nr | head -n 20
echo
echo "=== MOUNTED FILESYSTEMS ==="
df -h
mount | grep "$GITHUB_WORKSPACE" || true
echo
echo "=== GIT CONFIG LOCATIONS ==="
git config --list --show-origin || true
echo
echo "=== CHECK WRITABILITY OF BUILD DIR ==="
touch build/debug_write_test 2>&1 || echo "❌ Cannot write to build/"
rm -f build/debug_write_test || true
- name: Run Parallel Tests
env:
DOCKER_HOST: ${{ env.DOCKER_HOST }}
DOCKER_CONTEXT: ${{ env.DOCKER_CONTEXT }}
run: |
# https://github.com/actions/runner/issues/2033
tar xzf build.tar.gz
sudo chown -R $(id -u):$(id -g) $PWD
cd build
ctest --output-on-failure -j $(nproc) -LE "(nonparallelizable_tests|long_running_tests)" --timeout 1000
- name: Upload core files from failed tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{matrix.cfg.name}}-tests-logs
if-no-files-found: warn
path: |
/cores
build/Testing/Temporary/
build/TestLogs/
- name: Check CPU Features
run: |
awk 'BEGIN {err = 1} /bmi2/ && /adx/ {err = 0} END {exit err}' /proc/cpuinfo
build/tools/fsgsbase-enabled
np-tests:
name: NP Tests (${{ matrix.cfg.name }})
needs: [platform-cache, build-base]
strategy:
fail-fast: false
matrix:
include:
- cfg: {name: 'ubuntu24', base: 'ubuntu24', builddir: 'ubuntu24'}
- cfg: {name: 'ubsan', base: 'ubsan', builddir: 'ubsan'}
- cfg: {name: 'asserton', base: 'asserton', builddir: 'asserton'}
- cfg: {name: 'gcc', base: 'gcc', builddir: 'gcc'}
runs-on: ["self-hosted", "enf-x86-midtier"]
steps:
- name: Create ephemeral Docker context
id: docker-context
run: |
set -euo pipefail
echo "Detected runner name: $RUNNER_NAME"
name="${RUNNER_NAME,,}"
[[ $name =~ runner-([0-9]+) ]] || { echo "No runner number in '$RUNNER_NAME'"; exit 1; }
num="${BASH_REMATCH[1]}"
sock="/run/docker-runners/docker-runner${num}.sock"
[[ -S "$sock" ]] || { echo "Socket not found: $sock"; exit 1; }
echo "Using Docker socket: $sock"
echo "DOCKER_HOST=unix://$sock" >> "$GITHUB_ENV"
ctx="job-${{ github.run_id }}-${{ github.job }}-${{ matrix.cfg.name }}"
sudo docker context inspect "$ctx" >/dev/null 2>&1 || \
sudo docker context create "$ctx" --docker "host=unix://$sock"
echo "DOCKER_CONTEXT=$ctx" >> "$GITHUB_ENV"
- name: Cleanup stale containers (safety)
run: |
echo "Removing old containers for context $DOCKER_CONTEXT..."
sudo docker --context "$DOCKER_CONTEXT" ps -aq | xargs -r sudo docker --context "$DOCKER_CONTEXT" rm -f || true
echo "Cleanup complete."
- name: Ensure writable workspace
run: |
echo "User is $USER"
echo "Fixing permissions on workspace for user $(whoami)"
sudo chown -R $USER:$USER "$GITHUB_WORKSPACE"
sudo chmod -R u+rwX "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
- name: Download builddir
uses: actions/download-artifact@v4
with:
name: ${{ matrix.cfg.builddir }}-build
- name: Run NP tests
uses: ./.github/actions/parallel-ctest-containers
env:
DOCKER_HOST: ${{ env.DOCKER_HOST }}
DOCKER_CONTEXT: ${{ env.DOCKER_CONTEXT }}
with:
container: ${{ fromJSON(needs.platform-cache.outputs.platforms)[matrix.cfg.base].image }}
error-log-paths: '["build/etc", "build/var", "build/sysio-ignition-wd", "build/TestLogs"]'
log-tarball-prefix: ${{ matrix.cfg.name }}
tests-label: nonparallelizable_tests
test-timeout: 1000
batch-size: '5'
- name: Export core dumps
if: failure()
env:
DOCKER_HOST: ${{ env.DOCKER_HOST }}
run: |
sudo docker --host $DOCKER_HOST run --rm \
--mount type=bind,source=/var/lib/systemd/coredump,target=/cores,readonly \
alpine sh -c 'tar -C /cores/ -c .' | tar x
- name: Upload logs from failed tests
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.cfg.name }}-np-logs
path: |
*-logs.tar.gz
core*.zst
compression-level: 0
- name: Cleanup Docker resources
if: always()
env:
DOCKER_CONTEXT: ${{ env.DOCKER_CONTEXT }}
run: |
echo "=== Cleaning up Docker resources ==="
JOB_PREFIX="base-${{ github.run_id }}-${{ github.job }}"
echo "Removing containers matching: $JOB_PREFIX*"
sudo docker --context "$DOCKER_CONTEXT" ps -aq --filter "name=$JOB_PREFIX" | \
xargs -r sudo docker --context "$DOCKER_CONTEXT" rm -f || true
echo "Removing base images matching: baseimage-${{ github.run_id }}-${{ github.job }}*"
sudo docker --context "$DOCKER_CONTEXT" images --format "{{.Repository}}:{{.Tag}}" | \
grep "baseimage-${{ github.run_id }}-${{ github.job }}" | \
xargs -r sudo docker --context "$DOCKER_CONTEXT" rmi -f || true
- name: Cleanup Docker context
if: always()
run: |
echo "Removing Docker context..."
sudo docker context rm -f "$DOCKER_CONTEXT" || true
lr-tests:
name: LR Tests (${{matrix.cfg.name}})
needs: [platform-cache, build-base]
strategy:
fail-fast: false
matrix:
include:
- cfg: {name: 'ubuntu24', base: 'ubuntu24', builddir: 'ubuntu24'}
- cfg: {name: 'ubsan', base: 'ubsan', builddir: 'ubsan'}
- cfg: {name: 'asserton', base: 'asserton', builddir: 'asserton'}
- cfg: {name: 'gcc', base: 'gcc', builddir: 'gcc'}
runs-on: ["self-hosted", "enf-x86-lowtier"]
steps:
- name: Create ephemeral Docker context
id: docker-context
run: |
set -euo pipefail
echo "Detected runner name: $RUNNER_NAME"
name="${RUNNER_NAME,,}"
[[ $name =~ runner-([0-9]+) ]] || { echo "No runner number in '$RUNNER_NAME'"; exit 1; }
num="${BASH_REMATCH[1]}"
sock="/run/docker-runners/docker-runner${num}.sock"
[[ -S "$sock" ]] || { echo "Socket not found: $sock"; exit 1; }
echo "Using Docker socket: $sock"
echo "DOCKER_HOST=unix://$sock" >> "$GITHUB_ENV"
ctx="job-${{ github.run_id }}-${{ github.job }}-${{ matrix.cfg.name }}"
sudo docker context inspect "$ctx" >/dev/null 2>&1 || \
sudo docker context create "$ctx" --docker "host=unix://$sock"
echo "DOCKER_CONTEXT=$ctx" >> "$GITHUB_ENV"
- name: Cleanup stale containers
run: |
echo "Removing old containers for context $DOCKER_CONTEXT..."
sudo docker --context "$DOCKER_CONTEXT" ps -aq | xargs -r sudo docker --context "$DOCKER_CONTEXT" rm -f || true
echo "Cleanup complete"
- uses: actions/checkout@v4
- name: Download builddir
uses: actions/download-artifact@v4
with:
name: ${{matrix.cfg.builddir}}-build
- name: Run tests in parallel containers
env:
DOCKER_HOST: ${{ env.DOCKER_HOST }}
DOCKER_CONTEXT: ${{ env.DOCKER_CONTEXT }}
uses: ./.github/actions/parallel-ctest-containers
with:
container: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.cfg.base].image}}
error-log-paths: '["build/etc", "build/var", "build/sysio-ignition-wd", "build/TestLogs", "build/PerformanceHarnessScenarioRunnerLogs"]'
log-tarball-prefix: ${{matrix.cfg.name}}
tests-label: long_running_tests
test-timeout: 2700
batch-size: '5'
- name: Export core dumps
if: failure()
env:
DOCKER_CONTEXT: ${{ env.DOCKER_CONTEXT }}
run: |
echo "Checking for core dumps..."
docker context ls
sudo docker --context "$DOCKER_CONTEXT" run --rm \
--mount type=bind,source=/var/lib/systemd/coredump,target=/cores \
alpine sh -c 'tar -C /cores/ -c .' | tar x || echo "No core dumps found"
- name: Upload logs from failed tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{matrix.cfg.name}}-lr-logs
path: |
*-logs.tar.gz
core*.zst
compression-level: 0
- name: Cleanup Docker resources
if: always()
env:
DOCKER_CONTEXT: ${{ env.DOCKER_CONTEXT }}
run: |
echo "=== Cleaning up Docker resources ==="
echo $DOCKER_CONTEXT
JOB_PREFIX="base-${{ github.run_id }}-${{ github.job }}"
echo "Removing containers matching: $JOB_PREFIX*"
sudo docker --context "$DOCKER_CONTEXT" ps -aq --filter "name=$JOB_PREFIX" | \
xargs -r sudo docker --context "$DOCKER_CONTEXT" rm -f || true
echo "Removing base images matching: baseimage-${{ github.run_id }}-${{ github.job }}*"
sudo docker --context "$DOCKER_CONTEXT" images --format "{{.Repository}}:{{.Tag}}" | \
grep "baseimage-${{ github.run_id }}-${{ github.job }}" | \
xargs -r sudo docker --context "$DOCKER_CONTEXT" rmi -f || true
- name: Cleanup Docker context
if: always()
run: |
echo "Removing Docker context: $DOCKER_CONTEXT"
sudo docker context rm -f "$DOCKER_CONTEXT" || true
# libtester-tests:
# name: libtester tests
# needs: [platform-cache, build-base, v, package]
# strategy:
# fail-fast: false
# matrix:
# platform: [ubuntu20, ubuntu22, ubuntu24]
# test: [build-tree, make-dev-install, deb-install]
# runs-on: ["self-hosted", "enf-x86-midtier"]
# container: ${{ matrix.test != 'deb-install' && fromJSON(needs.platform-cache.outputs.platforms)[matrix.platform].image || matrix.platform == 'ubuntu20' && 'ubuntu:focal' || 'ubuntu:jammy' }}
# env:
# DEBIAN_FRONTEND: noninteractive
# TZ: Etc/UTC
# steps:
# - name: Update Package Index & Upgrade Packages
# run: |
# apt-get update
# apt-get upgrade -y
# # wire-sysio
# - if: ${{ matrix.test != 'deb-install' }}
# name: Clone sysio
# uses: actions/checkout@v4
# with:
# submodules: recursive
# - if: ${{ matrix.test != 'deb-install' }}
# name: Download sysio builddir
# uses: actions/download-artifact@v4
# with:
# name: ${{matrix.platform}}-build
# - if: ${{ matrix.test != 'deb-install' }}
# name: Extract sysio build
# run: |
# zstdcat build.tar.zst | tar x
# - if: ${{ matrix.test == 'build-tree' }}
# name: Set sysio_DIR env var
# run: |
# echo "sysio_DIR=$PWD/build/lib/cmake/sysio" >> "$GITHUB_ENV"
# - if: ${{ matrix.test == 'make-dev-install' }}
# name: sysio dev-install
# run: |
# cmake --install build
# cmake --install build --component dev
# - if: ${{ matrix.test == 'make-dev-install' }}
# name: Delete sysio artifacts
# run: |
# rm -r *
# # - if: ${{ matrix.test == 'deb-install' }}
# # name: Download sysio-dev
# # uses: actions/download-artifact@v4
# # with:
# # name: sysio-dev-${{matrix.platform}}-amd64
# # - if: ${{ matrix.test == 'deb-install' }}
# # name: Install sysio-dev Package
# # run: |
# # apt-get install -y ./*.deb
# # rm ./*.deb
# # CDT
# # - name: Download cdt
# # uses: AntelopeIO/asset-artifact-download-action@v3
# # with:
# # owner: Wire-Network
# # repo: wire-cdt
# # file: 'cdt_.*amd64.deb'
# # target: '${{needs.v.outputs.cdt-target}}'
# # prereleases: ${{fromJSON(needs.v.outputs.cdt-prerelease)}}
# # artifact-name: cdt_ubuntu_package_amd64
# # - name: Install cdt Packages
# # run: |
# # apt-get install -y ./*.deb
# # rm ./*.deb
# # CDT
# - name: Download and Install wire-cdt
# run: |
# CDT_VERSION="${{needs.v.outputs.cdt-target}}"
# CDT_URL="https://github.com/Wire-Network/wire-cdt/releases/download/v${CDT_VERSION}/wire-cdt_${CDT_VERSION}_amd64.deb"
# wget -O wire-cdt.deb "$CDT_URL"
# apt-get install -y ./wire-cdt.deb
# rm ./wire-cdt.deb
# # Reference Contracts
# - name: checkout wire-system-contracts
# uses: actions/checkout@v4
# with:
# repository: Wire-Network/wire-system-contracts
# path: wire-system-contracts
# ref: '${{needs.v.outputs.wire-system-contracts-ref}}'
# - if: ${{ matrix.test == 'deb-install' }}
# name: Install wire-system-contracts deps
# run: |
# apt-get -y install cmake build-essential
# - name: Build & Test wire-system-contracts
# run: |
# cmake -S wire-system-contracts -B wire-system-contracts/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DSYSTEM_ENABLE_SYSIO_VERSION_CHECK=Off -DSYSTEM_ENABLE_CDT_VERSION_CHECK=Off
# cmake --build wire-system-contracts/build -- -j $(nproc)
# cd wire-system-contracts/build/tests
# ctest --output-on-failure -j $(nproc)
all-passing:
name: All Required Tests Passed
needs: [ tests, np-tests, lr-tests ]
if: always()
runs-on: ubuntu-latest
steps:
- name: Send Notification
if: always()
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BRANCH="${{ github.head_ref }}"
else
BRANCH="${{ github.ref_name }}"
fi
# Determine overall status
if [[ "${{ needs.tests.result }}" == "success" && \
"${{ needs.np-tests.result }}" == "success" && \
"${{ needs.lr-tests.result }}" == "success" ]]; then
STATUS="✅ SUCCESS"
COLOR="#00FF00"
else
STATUS="❌ FAILURE"
COLOR="#FF0000"
fi
# Build job status details
JOB_DETAILS=""
[[ "${{ needs.tests.result }}" != "success" ]] && JOB_DETAILS="${JOB_DETAILS}\n- **Tests**: ❌ ${{ needs.tests.result }}"
[[ "${{ needs.np-tests.result }}" != "success" ]] && JOB_DETAILS="${JOB_DETAILS}\n- **NP Tests**: ❌ ${{ needs.np-tests.result }}"
[[ "${{ needs.lr-tests.result }}" != "success" ]] && JOB_DETAILS="${JOB_DETAILS}\n- **LR Tests**: ❌ ${{ needs.lr-tests.result }}"
PR_INFO=""
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
PR_INFO="\n**PR**: [#${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }})"
fi
# Create message payload
PAYLOAD=$(cat <<EOF
{
"channel": "cicd-notifications",
"username": "GitHub Actions",
"icon_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"attachments": [{
"color": "$COLOR",
"title": "$STATUS: Build & Test Workflow",
"text": "**Repository**: ${{ github.repository }}\n**Branch**: $BRANCH${PR_INFO}\n**Commit**: [\`${GITHUB_SHA::7}\`](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})\n**Triggered by**: ${{ github.actor }}\n**Workflow Run**: [View Details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})${JOB_DETAILS}"
}]
}
EOF
)
curl -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"
- if: needs.tests.result != 'success' || needs.np-tests.result != 'success' || needs.lr-tests.result != 'success'
run: false