|
| 1 | +name: build and test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: Build and run tests |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + - os: ubuntu-latest |
| 18 | + cc: gcc |
| 19 | + - os: macos-latest |
| 20 | + cc: clang |
| 21 | + - os: windows-latest |
| 22 | + cc: clang |
| 23 | + - os: windows-latest |
| 24 | + cc: cl |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Install build and test dependencies (Linux) |
| 29 | + if: startsWith(matrix.os, 'ubuntu') |
| 30 | + run: | |
| 31 | + export DEBIAN_FRONTEND=noninteractive |
| 32 | + export DEBCONF_NONINTERACTIVE_SEEN=true |
| 33 | + sudo apt-get update |
| 34 | + sudo apt-get install -y --no-install-suggests --no-install-recommends \ |
| 35 | + build-essential \ |
| 36 | + check \ |
| 37 | + clang \ |
| 38 | + llvm \ |
| 39 | + meson \ |
| 40 | + pkg-config \ |
| 41 | + uthash-dev \ |
| 42 | + valgrind |
| 43 | + sudo apt-get clean |
| 44 | +
|
| 45 | + - name: Install build and test dependencies (macOS) |
| 46 | + if: startsWith(matrix.os, 'macos') |
| 47 | + run: brew install check meson uthash |
| 48 | + |
| 49 | + - name: Install build and test dependencies (Windows) |
| 50 | + if: startsWith(matrix.os, 'windows') |
| 51 | + run: pip install meson ninja |
| 52 | + |
| 53 | + - name: Build and install library |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + export CC=${{ matrix.cc }} |
| 57 | + sudo= |
| 58 | + case "${{ matrix.os }}" in |
| 59 | + ubuntu*) |
| 60 | + sudo=sudo |
| 61 | + ;; |
| 62 | + windows*) |
| 63 | + case "${{ matrix.cc }}" in |
| 64 | + cl) |
| 65 | + # ignore CK_DIAGNOSTIC_POP warnings in check |
| 66 | + setup_args="--vsenv -Dcheck:werror=false" |
| 67 | + ;; |
| 68 | + clang) |
| 69 | + # Ignore unused parameter warnings from check.h |
| 70 | + export CFLAGS=-Wno-unused-parameter |
| 71 | + # https://github.com/mesonbuild/meson/issues/10022 |
| 72 | + export CC_LD=lld-link |
| 73 | + ;; |
| 74 | + esac |
| 75 | + ;; |
| 76 | + esac |
| 77 | + meson setup builddir --werror $setup_args |
| 78 | + DEBUG_DICT=1 meson compile -C builddir |
| 79 | + $sudo meson install -C builddir |
| 80 | +
|
| 81 | + - name: Run unit tests |
| 82 | + # Don't run tests for private copy of Check |
| 83 | + run: meson test -C builddir --suite libdicom |
| 84 | + |
| 85 | + - name: Print unit test logs |
| 86 | + if: always() |
| 87 | + run: cat builddir/meson-logs/testlog.txt |
| 88 | + |
| 89 | + - name: Run valgrind |
| 90 | + if: startsWith(matrix.os, 'ubuntu') |
| 91 | + run: | |
| 92 | + valgrind --leak-check=full dcm-dump ./data/test_files/sm_image.dcm > /dev/null |
0 commit comments