summaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: d51fc84d2c29324804759b83346289003e232fda (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
name: build

on: [push, pull_request]

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-22.04, macos-11]
        compiler: [gcc, clang]
        crypto: [openssl, gnutls]
        bittorrent: [with-bt, without-bt]
        exclude:
        - os: macos-11
          crypto: gnutls
        - crypto: openssl
          bittorrent: without-bt

    runs-on: ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v3
    - name: Linux setup
      if: runner.os == 'Linux'
      run: |
        sudo apt-get install \
          g++-12 \
          clang-15 \
          autoconf \
          automake \
          autotools-dev \
          autopoint \
          libtool \
          pkg-config \
          libssl-dev \
          libgnutls28-dev \
          libc-ares-dev \
          zlib1g-dev \
          libsqlite3-dev \
          libssh2-1-dev \
          libcppunit-dev
    - name: MacOS setup
      if: runner.os == 'macOS'
      run: |
        brew install cppunit gettext openssl libssh2 c-ares sqlite3 \
          autoconf automake pkg-config libtool
    - name: Setup clang (Linux)
      if: runner.os == 'Linux' && matrix.compiler == 'clang'
      run: |
        echo 'CC=clang-15' >> $GITHUB_ENV
        echo 'CXX=clang++-15' >> $GITHUB_ENV
    - name: Setup clang (MacOS)
      if: runner.os == 'macOS' && matrix.compiler == 'clang'
      run: |
        echo 'CC=clang' >> $GITHUB_ENV
        echo 'CXX=clang++' >> $GITHUB_ENV
    - name: Setup gcc (Linux)
      if: runner.os == 'Linux' && matrix.compiler == 'gcc'
      run: |
        echo 'CC=gcc-12' >> $GITHUB_ENV
        echo 'CXX=g++-12' >> $GITHUB_ENV
    - name: Setup gcc (MacOS)
      if: runner.os == 'macOS' && matrix.compiler == 'gcc'
      run: |
        echo 'CC=gcc' >> $GITHUB_ENV
        echo 'CXX=g++' >> $GITHUB_ENV
    - name: Libtool
      run: |
        autoreconf -i
    - name: Setup compiler flags
      run: |
        asanflags="-fsanitize=address,undefined -fno-sanitize-recover=undefined"

        CPPFLAGS="$asanflags -g3"
        LDFLAGS="$asanflags"

        echo 'CPPFLAGS='"$CPPFLAGS" >> $GITHUB_ENV
        echo 'LDFLAGS='"$LDFLAGS" >> $GITHUB_ENV
    - name: Disable BitTorrent
      if: matrix.bittorrent == 'without-bt'
      run: |
        FEATURE_FLAGS="$FEATURE_FLAGS --disable-bittorrent"

        echo 'FEATURE_FLAGS='"$FEATURE_FLAGS" >> $GITHUB_ENV
    - name: Configure autotools (Linux, gnutls)
      if: runner.os == 'Linux' && matrix.crypto == 'gnutls'
      run: |
        ./configure --with-gnutls --without-openssl $FEATURE_FLAGS
    - name: Configure autotools (Linux, openssl)
      if: runner.os == 'Linux' && matrix.crypto == 'openssl'
      run: |
        ./configure --without-gnutls --with-openssl $FEATURE_FLAGS
    - name: Configure autotools (macOS)
      if: runner.os == 'macOS'
      run: |
        ./configure \
          --without-openssl --without-gnutls --with-appletls \
          --disable-nls
    - name: Build aria2
      run: |
        make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)" check