1---
2name: macos
3
4on:
5  pull_request:
6    types: [opened, synchronize]
7    paths-ignore:
8      - '**.md'
9      - '.mailmap'
10      - 'ChangeLog*'
11      - 'whatsnew*'
12      - 'LICENSE'
13  push:
14    paths-ignore:
15      - '**.md'
16      - '.mailmap'
17      - 'ChangeLog*'
18      - 'whatsnew*'
19      - 'LICENSE'
20
21jobs:
22  cmake:
23    runs-on: ${{ matrix.os }}
24    if: "!contains(github.event.head_commit.message, 'ci skip')"
25    strategy:
26      fail-fast: false
27      matrix:
28        os: [macos-latest]
29        EVENT_MATRIX:
30          - NONE
31          - DISABLE_OPENSSL
32          - DISABLE_THREAD_SUPPORT
33          - DISABLE_DEBUG_MODE
34          - DISABLE_MM_REPLACEMENT
35          - TEST_EXPORT_STATIC
36          - TEST_EXPORT_SHARED
37          - OPENSSL_1_1
38
39    steps:
40      - uses: actions/checkout@v2.0.0
41
42      - name: Cache Build
43        uses: actions/cache@v1.1.0
44        with:
45          path: build
46          key: macos-10.15-cmake-${{ matrix.EVENT_MATRIX }}-v2
47
48      - name: Build And Test
49        shell: bash
50        run: |
51          if [ "${{ matrix.EVENT_MATRIX }}" == "OPENSSL_1_1" ]; then
52            export OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1
53          else
54            export OPENSSL_ROOT_DIR=/usr/local/opt/openssl
55          fi
56
57          if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then
58            EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON"
59
60          elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_THREAD_SUPPORT" ]; then
61            EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_THREAD_SUPPORT=ON"
62
63          elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_DEBUG_MODE" ]; then
64            EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_DEBUG_MODE=ON"
65
66          elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_MM_REPLACEMENT" ]; then
67            EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_MM_REPLACEMENT=ON"
68
69          elif [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_STATIC" ]; then
70            EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON"
71
72          elif [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_SHARED" ]; then
73            EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=SHARED -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON"
74
75          else
76            EVENT_CMAKE_OPTIONS=""
77          fi
78
79          #run build and test
80          JOBS=1
81          export CTEST_PARALLEL_LEVEL=$JOBS
82          export CTEST_OUTPUT_ON_FAILURE=1
83          mkdir -p build
84          cd build
85          echo [cmake]: cmake .. $EVENT_CMAKE_OPTIONS
86          cmake .. $EVENT_CMAKE_OPTIONS || (rm -rf * && cmake .. $EVENT_CMAKE_OPTIONS)
87          cmake --build .
88          if [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_STATIC" ]; then
89            sudo python3 ../test-export/test-export.py static
90          elif [ "${{ matrix.EVENT_MATRIX }}" == "TEST_EXPORT_SHARED" ]; then
91            sudo python3 ../test-export/test-export.py shared
92          else
93            cmake --build . --target verify
94          fi
95
96      - uses: actions/upload-artifact@v1
97        if: failure()
98        with:
99          name: ${{ matrix.os }}-cmake-${{ matrix.EVENT_MATRIX }}-build
100          path: build
101
102  autotools:
103    runs-on: ${{ matrix.os }}
104    if: "!contains(github.event.head_commit.message, 'ci skip')"
105    strategy:
106      fail-fast: false
107      matrix:
108        os: [macos-latest]
109        EVENT_MATRIX:
110          - NONE
111          - DISABLE_OPENSSL
112          - DISABLE_THREAD_SUPPORT
113          - DISABLE_DEBUG_MODE
114          - DISABLE_MM_REPLACEMENT
115          - OPENSSL_1_1
116
117    steps:
118      - uses: actions/checkout@v2.0.0
119
120      - name: Cache Build
121        uses: actions/cache@v1.1.0
122        with:
123          path: build
124          key: ${{ matrix.os }}-autotools-${{ matrix.EVENT_MATRIX }}-v2
125
126      - name: Install Depends
127        run: brew install autoconf automake libtool pkg-config
128
129      - name: Build And Test
130        shell: bash
131        run: |
132          if [ "${{ matrix.EVENT_MATRIX }}" == "OPENSSL_1_1" ]; then
133            export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig:$PKG_CONFIG_PATH"
134          else
135            export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH"
136          fi
137
138          if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then
139            EVENT_CONFIGURE_OPTIONS="--disable-openssl"
140
141          elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_THREAD_SUPPORT" ]; then
142            EVENT_CONFIGURE_OPTIONS="--disable-thread-support"
143
144          elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_DEBUG_MODE" ]; then
145            EVENT_CONFIGURE_OPTIONS="--disable-debug-mode"
146
147          elif [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_MM_REPLACEMENT" ]; then
148            EVENT_CONFIGURE_OPTIONS="--disable-malloc-replacement"
149
150          else
151            EVENT_CONFIGURE_OPTIONS=""
152          fi
153
154          #run build and test
155          JOBS=1
156          ./autogen.sh
157          mkdir -p build
158          cd build
159          echo [configure]: ../configure $EVENT_CONFIGURE_OPTIONS
160          ../configure $EVENT_CONFIGURE_OPTIONS
161          make
162          make -j $JOBS verify
163
164      - uses: actions/upload-artifact@v1
165        if: failure()
166        with:
167          name: ${{ matrix.os }}-autotools-${{ matrix.EVENT_MATRIX }}-build
168          path: build
169