2026-05-04 14:21:10 +02:00

253 lines
7.4 KiB
YAML

name: PR Tests
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
paths:
- "src/**"
- "tests/**"
- "vendor/**"
- "requirements.txt"
- "pytest.ini"
- ".github/workflows/pr_tests.yml"
push:
branches: [master]
paths:
- "vendor/**"
workflow_dispatch:
inputs:
run_full_suite:
description: "Run the full test suite (18 shards)"
required: false
default: false
type: boolean
jobs:
build:
name: Build liblogosdelivery
runs-on: ubuntu-latest
timeout-minutes: 45
if: >-
github.event.action != 'labeled' ||
github.event.label.name == 'full-test'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Compute cache key
id: cache-key
run: |
BINDINGS_HASH=$(git rev-parse HEAD:vendor/logos-delivery-python-bindings)
DELIVERY_HASH=$(git -C vendor/logos-delivery-python-bindings rev-parse HEAD:vendor/logos-delivery)
echo "key=liblogosdelivery-${{ runner.os }}-nim2.2.4-${BINDINGS_HASH}-${DELIVERY_HASH}" >> "$GITHUB_OUTPUT"
- name: Cache liblogosdelivery.so
id: cache-lib
uses: actions/cache@v4
with:
path: vendor/logos-delivery-python-bindings/lib/liblogosdelivery.so
key: ${{ steps.cache-key.outputs.key }}
- name: Remove unwanted software
if: steps.cache-lib.outputs.cache-hit != 'true'
uses: ./.github/actions/prune-vm
- name: Install system deps
if: steps.cache-lib.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y \
util-linux \
iproute2 \
sudo \
ca-certificates \
curl \
make \
gcc \
g++
- name: Install Nim 2.2.4
if: steps.cache-lib.outputs.cache-hit != 'true'
run: |
set -euo pipefail
curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y
echo "$HOME/.nimble/bin" >> "$GITHUB_PATH"
export PATH="$HOME/.nimble/bin:$PATH"
choosenim 2.2.4
nim --version
nimble --version
- name: Build liblogosdelivery.so
if: steps.cache-lib.outputs.cache-hit != 'true'
run: |
set -euo pipefail
export PATH="$HOME/.nimble/bin:$PATH"
BINDINGS_DIR="$(pwd)/vendor/logos-delivery-python-bindings"
DELIVERY_DIR="$BINDINGS_DIR/vendor/logos-delivery"
mkdir -p "$BINDINGS_DIR/lib"
cd "$DELIVERY_DIR"
ln -sf waku.nimble waku.nims
nimble install -y
make setup
make liblogosdelivery
SO_PATH="$(find . -type f -name 'liblogosdelivery.so' | head -n 1)"
if [ -z "$SO_PATH" ]; then
echo "liblogosdelivery.so was not built"
exit 1
fi
cp "$SO_PATH" "$BINDINGS_DIR/lib/liblogosdelivery.so"
echo "Built library:"
ls -l "$BINDINGS_DIR/lib/liblogosdelivery.so"
- name: Upload library artifact
uses: actions/upload-artifact@v4
with:
name: liblogosdelivery
path: vendor/logos-delivery-python-bindings/lib/liblogosdelivery.so
retention-days: 1
wrapper-tests:
name: Wrapper Tests
runs-on: ubuntu-latest
needs: [build]
timeout-minutes: 45
if: >-
github.event_name != 'push' &&
(github.event.action != 'labeled' || github.event.label.name == 'full-test')
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: "pip"
- run: pip install -r requirements.txt
- name: Download liblogosdelivery.so
uses: actions/download-artifact@v4
with:
name: liblogosdelivery
path: vendor/logos-delivery-python-bindings/lib/
- name: Run wrapper tests - basic life cycle
env:
PYTHONPATH: ${{ github.workspace }}/vendor/logos-delivery-python-bindings/waku
run: |
pytest tests/wrappers_tests/test_basic_life_cycle.py \
-m "not docker_required" \
--reruns 2 \
--junit-xml=wrapper-results-basic.xml || true
- name: Run wrapper tests - send e2e part 1
env:
PYTHONPATH: ${{ github.workspace }}/vendor/logos-delivery-python-bindings/waku
run: |
pytest tests/wrappers_tests/test_send_e2e_part1.py \
-m "not docker_required" \
--reruns 2 \
--junit-xml=wrapper-results-send-part1.xml || true
- name: Run wrapper tests - send e2e part 2
env:
PYTHONPATH: ${{ github.workspace }}/vendor/logos-delivery-python-bindings/waku
run: |
pytest tests/wrappers_tests/test_send_e2e_part2.py \
-m "not docker_required" \
--reruns 2 \
--junit-xml=wrapper-results-send-part2.xml || true
- name: Test Report
if: always()
uses: dorny/test-reporter@95058abb17504553158e70e2c058fe1fda4392c2
with:
name: Wrapper Test Results
path: wrapper-results-*.xml
reporter: java-junit
use-actions-summary: "true"
smoke-tests:
name: Smoke Tests
runs-on: ubuntu-latest
needs: [build]
timeout-minutes: 30
if: >-
github.event_name != 'push' &&
(github.event.action != 'labeled' || github.event.label.name == 'full-test')
env:
NODE_1: "wakuorg/nwaku:latest"
NODE_2: "wakuorg/nwaku:latest"
ADDITIONAL_NODES: "wakuorg/nwaku:latest,wakuorg/nwaku:latest,wakuorg/nwaku:latest"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: "pip"
- run: pip install -r requirements.txt
- name: Download liblogosdelivery.so
uses: actions/download-artifact@v4
with:
name: liblogosdelivery
path: vendor/logos-delivery-python-bindings/lib/
- name: Run smoke tests
env:
PYTHONPATH: ${{ github.workspace }}/vendor/logos-delivery-python-bindings/waku
run: |
pytest -m "smoke and not docker_required" \
--ignore=vendor/logos-delivery-python-bindings/tests \
--ignore=tests/wrappers_tests \
--reruns 1 \
-n 4 \
--dist=loadgroup \
--junit-xml=smoke-results.xml || true
- name: Test Report
if: always()
uses: dorny/test-reporter@95058abb17504553158e70e2c058fe1fda4392c2
with:
name: Smoke Test Results
path: smoke-results.xml
reporter: java-junit
use-actions-summary: "true"
full-suite:
name: Full Suite
if: >-
github.event_name != 'push' &&
(contains(github.event.pull_request.labels.*.name, 'full-test') ||
github.event.inputs.run_full_suite == 'true')
uses: ./.github/workflows/test_common.yml
secrets: inherit
with:
node1: "wakuorg/nwaku:latest"
node2: "wakuorg/nwaku:latest"
additional_nodes: "wakuorg/nwaku:latest,wakuorg/nwaku:latest,wakuorg/nwaku:latest"
caller: "pr"
deploy_allure: false
send_discord: false