2026-05-19 11:45:20 +04:00

42 lines
1.3 KiB
YAML

name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Nim
uses: jiro4989/setup-nim-action@v2
with:
nim-version: "2.2.10"
- name: Install dependencies
run: nimble setup -y
- name: Unit tests
# same reason as integration tests: nimble exits with code 0 even on failure.
run: |
cmake -B vendor/libplum/build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF vendor/libplum
cmake --build vendor/libplum/build
cp vendor/libplum/build/libplum.a vendor/libplum/libplum.a
nim c -o:tests/test_plum tests/test_plum.nim
./tests/test_plum
- name: Integration tests
# we call docker directly instead of nimble testIntegration because nimble
# exits with code 0 even when exec() fails, which would make CI pass on failure.
run: |
docker build -t libplum -f tests/Dockerfile .
docker run --rm --cap-add=NET_ADMIN -e TEST_MINIUPNP_PCP=1 libplum
docker run --rm --cap-add=NET_ADMIN -e TEST_MINIUPNP_UPNP=1 libplum
docker run --rm --cap-add=NET_ADMIN -e TEST_MINIUPNP_NATPMP=1 libplum