summaryrefslogtreecommitdiff
path: root/.github/workflows/ci_ubuntu.yml
blob: ead85ad4b82d48bb1c01d8d2fe0b920138c16c3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: CI Ubuntu

on:
  push:
    branches: [master, GD-*]
  pull_request:
    branches: [master, GD-*]

env:
  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  BUILD_TYPE: RELWITHDEBINFO

jobs:
  CI:
    runs-on: ${{ matrix.config.os }}
    strategy:
      fail-fast: false
      matrix:
        config:
          - {
              name: "Ubuntu Intel GCC",
              os: ubuntu-latest,
              cc: "gcc",
              cxx: "g++",
              cflags: "-msse2"
            }
          - {
              name: "Ubuntu Intel Clang",
              os: ubuntu-latest,
              cc: "clang-12",
              cxx: "clang-cpp-12"
            }
          - {
              name: "Ubuntu Graviton GCC",
              os: [self-hosted, Linux, ARM64, graviton],
              cc: "gcc",
              cxx: "g++",
              cflags: "-march=armv8.2-a+fp16+rcpc+dotprod+crypto+sve -mtune=neoverse-n1"
            }

    name: ${{ matrix.config.name }}
    defaults:
      run:
        shell: bash

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Update apt (Ubuntu)
        env:
          DEBIAN_FRONTEND: noninteractive
        run: sudo -E apt-get update -qq -o Acquire::Retries=3

      - name: Add libheif PPA (Ubuntu)
        run: |
          sudo add-apt-repository ppa:strukturag/libde265
          sudo add-apt-repository ppa:strukturag/libheif

      - name: install dependencies
        env:
          DEBIAN_FRONTEND: noninteractive
        run: sudo -E apt-get install --fix-missing -qq -o Acquire::Retries=3 cmake clang-12 gcc build-essential libjpeg-turbo8-dev libimagequant-dev libde265-dev libpng-dev libwebp-dev libtiff5-dev libx265-dev libheif-dev libfreetype-dev libheif-dev libavifile-0.7-dev libxpm-dev libraqm-dev dh-autoreconf ninja-build nasm meson

      - name: install AOM codec for libavif
        if: "!contains(matrix.config.name,'Ubuntu Graviton GCC')"
        run: |
          cd ${{github.temp }}
          git clone -b v3.1.2 --depth 1 https://aomedia.googlesource.com/aom
          cd aom
          mkdir build.libavif
          cd build.libavif
          cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0  -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
          ninja
          sudo ninja install

      - name: install dav1d codec for libavif
        run: |
          git clone -b 0.9.2 --depth 1 https://code.videolan.org/videolan/dav1d.git
          cd dav1d
          mkdir build
          cd build
          meson --buildtype release -Dprefix=/usr ..
          ninja
          sudo ninja install

      - name: install libyuv
        run: |
          cd ${{github.temp }}
          git clone https://chromium.googlesource.com/libyuv/libyuv/
          cd libyuv
          mkdir build
          cd build
          cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -B. ..
          make
          sudo make install

      - name: install libavif
        run: |
          cd ${{github.temp }}
          git clone https://github.com/AOMediaCodec/libavif.git
          cd libavif
          git checkout tags/v0.9.2
          mkdir build
          cd build
          cmake -DBUILD_SHARED_LIBS=1 -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_CODEC_LIBGAV1=0 -DAVIF_CODEC_RAV1E=0 -DAVIF_CODEC_SVT=0 -B. ..
          make
          sudo make install

      - name: Debug CC Env
        env:
          CC: ${{ matrix.config.cc }}
          CXX: ${{ matrix.config.cxx }}
          CFLAGS: ${{ matrix.config.cflags }}
        run: |
          echo ${{ matrix.config.cc }}
          echo ${{ matrix.config.cxx }}
          echo ${{ matrix.config.cflags }}

      - name: Configure CMake Clang
        if: contains(matrix.config.cc, 'clang')
        env:
          CC: ${{ matrix.config.cc }}
          CXX: ${{ matrix.config.cxx }}
          CFLAGS: ${{ matrix.config.cflags }}
        run:
          cmake -G "Unix Makefiles" -DENABLE_PNG=1 -DENABLE_FREETYPE=1 -DENABLE_JPEG=1 -DENABLE_WEBP=1
          -DENABLE_TIFF=1 -DENABLE_XPM=1 -DENABLE_GD_FORMATS=1 -DENABLE_HEIF=1 -DENABLE_RAQM=1 -DENABLE_AVIF=1
          -DBUILD_TEST=1 -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
          -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/cmake/modules/linux-clang.cmake

      - name: Configure CMake gcc
        if: contains(matrix.config.cc, 'gcc')
        env:
          CC: ${{ matrix.config.cc }}
          CXX: ${{ matrix.config.cxx }}
          CFLAGS: ${{ matrix.config.cflags }}
        run:
          cmake -DENABLE_PNG=1 -DENABLE_FREETYPE=1 -DENABLE_JPEG=1 -DENABLE_WEBP=1
          -DENABLE_TIFF=1 -DENABLE_XPM=1 -DENABLE_GD_FORMATS=1 -DENABLE_HEIF=1 -DENABLE_RAQM=1 -DENABLE_AVIF=1
          -DBUILD_TEST=1 -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

      - name: Build
        env:
          CC: ${{ matrix.config.cc }}
          CXX: ${{ matrix.config.cxx }}
          CFLAGS: ${{ matrix.config.cflags }}
        run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 4

      - name: Test
        if: contains(matrix.config.cc, 'gcc')
        working-directory: ${{github.workspace}}/build
        run: |
          export TMP=${{runner.temp}}
          echo "TMP=${{github.temp}}" >> $GITHUB_ENV
          echo "LSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/lsan.supp" >> $GITHUB_ENV
          CTEST_OUTPUT_ON_FAILURE=1 ctest -C ${{env.BUILD_TYPE}}

      - name: Configure CMake ASAN
        env:
          CC: ${{ matrix.config.cc }}
          CXX: ${{ matrix.config.cxx }}
          CFLAGS: ${{ matrix.config.cflags }}
        if: contains(matrix.config.cc, 'gcc')
        run:
          cmake -DENABLE_PNG=1 -DENABLE_FREETYPE=1 -DENABLE_JPEG=1 -DENABLE_WEBP=1
          -DENABLE_TIFF=1 -DENABLE_XPM=1 -DENABLE_GD_FORMATS=1 -DENABLE_HEIF=1 -DENABLE_AVIF=1
          -DBUILD_TEST=1 -B ${{github.workspace}}/buildasan -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

      - name: Build ASAN
        if: contains(matrix.config.cc, 'gcc')
        env:
          CC: ${{ matrix.config.cc }}
          CXX: ${{ matrix.config.cxx }}
          CFLAGS: "-march=armv8.2-a+fp16+rcpc+dotprod+crypto -mtune=neoverse-n1"
        run: cmake --build ${{github.workspace}}/buildasan --config ${{env.BUILD_TYPE}}

      - name: Test ASAN
        if: contains(matrix.config.cc, 'gcc')
        working-directory: ${{github.workspace}}/buildasan
        run: |
          export TMP=${{runner.temp}}
          echo "TMP=${{github.temp}}" >> $GITHUB_ENV
          CTEST_OUTPUT_ON_FAILURE=1 ctest -C ${{env.BUILD_TYPE}}

      - name: Configure and Make
        working-directory: ${{github.workspace}}/
        run: |
          ./bootstrap.sh
          ./configure --with-png --with-jpeg --with-ramq --with-heif --with-xpm --with-tiff --with-webp --with-liq --enable-gd --enable-gd-formats --with-zlib
          make
          make dist

      - name: Output Log
        run: |
          if test -f "/home/runner/work/libgd/libgd/build/Testing/Temporary/LastTest.log"; then
            cat /home/runner/work/libgd/libgd/build/Testing/Temporary/LastTest.log
          fi