summaryrefslogtreecommitdiff
path: root/.github/workflows/action.yml
blob: 35798815bdf39a93151a3e3ca7d66ee637240073 (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
199
name: GitHub Actions

on:
  push:
  pull_request:
  schedule:
    - cron: '0 0 1 * *'

jobs:
  build:
    strategy:
      matrix:
        name:
          [
            ubuntu-latest-gcc-autotools,
            ubuntu-latest-clang-autotools,
            ubuntu-latest-gcc-cmake,
            ubuntu-latest-clang-cmake,
            macos-latest-clang-autotools,
            macos-latest-clang-cmake,
            windows-latest-cmake,
            ubuntu-latest-gcc-autotools-64-bit-words,
            ubuntu-latest-clang-autotools-64-bit-words,
            ubuntu-latest-gcc-cmake-64-bit-words,
            ubuntu-latest-clang-cmake-64-bit-words,
            macos-latest-clang-autotools-64-bit-words,
            macos-latest-clang-cmake-64-bit-words
          ]
        include:
          - name: ubuntu-latest-gcc-autotools
            os: ubuntu-latest
            cc: gcc
            cxx: g++
            build-system: autotools
            configure-opts: ''

          - name: ubuntu-latest-clang-autotools
            os: ubuntu-latest
            cc: clang
            cxx: clang++
            build-system: autotools
            configure-opts: ''

          - name: ubuntu-latest-gcc-cmake
            os: ubuntu-latest
            cc: gcc
            cxx: g++
            build-system: cmake
            configure-opts: ''

          - name: ubuntu-latest-clang-cmake
            os: ubuntu-latest
            cc: clang
            cxx: clang++
            build-system: cmake
            configure-opts: ''

          - name: macos-latest-clang-autotools
            os: macos-latest
            cc: clang
            cxx: clang++
            build-system: autotools
            configure-opts: ''

          - name: macos-latest-clang-cmake
            os: macos-latest
            cc: clang
            cxx: clang++
            build-system: cmake
            configure-opts: ''

          - name: windows-latest-cmake
            os: windows-latest
            build-system: cmake
            configure-opts: ''

          - name: windows-latest-cmake-shared
            os: windows-latest
            build-system: cmake
            configure-opts: '-DBUILD_SHARED_LIBS=ON'

          - name: ubuntu-latest-gcc-autotools-64-bit-words
            os: ubuntu-latest
            cc: gcc
            cxx: g++
            build-system: autotools
            configure-opts: --enable-64-bit-words

          - name: ubuntu-latest-clang-autotools-64-bit-words
            os: ubuntu-latest
            cc: clang
            cxx: clang++
            build-system: autotools
            configure-opts: --enable-64-bit-words

          - name: ubuntu-latest-gcc-cmake-64-bit-words
            os: ubuntu-latest
            cc: gcc
            cxx: g++
            build-system: cmake
            configure-opts: -DENABLE_64_BIT_WORDS=ON

          - name: ubuntu-latest-clang-cmake-64-bit-words
            os: ubuntu-latest
            cc: clang
            cxx: clang++
            build-system: cmake
            configure-opts: -DENABLE_64_BIT_WORDS=ON

          - name: macos-latest-clang-autotools-64-bit-words
            os: macos-latest
            cc: clang
            cxx: clang++
            build-system: autotools
            configure-opts: --enable-64-bit-words

          - name: macos-latest-clang-cmake-64-bit-words
            os: macos-latest
            cc: clang
            cxx: clang++
            build-system: cmake
            configure-opts: -DENABLE_64_BIT_WORDS=ON

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

    steps:
      - uses: actions/checkout@v2

      - uses: actions/checkout@v2
        if: startsWith(matrix.build-system,'cmake')
        with:
          repository: xiph/ogg
          path: ./ogg

      - name: Install MacOS dependencies
        if: startsWith(matrix.os,'macos') && !startsWith(matrix.build-system,'cmake')
        run: |
          brew update
          brew install automake pkg-config libogg

      - name: Install Linux dependencies
        if: startsWith(matrix.os,'ubuntu')
        run: |
          sudo apt-get update
          sudo apt-get install -y libtool-bin libogg-dev doxygen libxml2-utils w3c-sgml-lib

      - name: Install Windows dependencies
        if: startsWith(matrix.os,'windows')
        run: |
          choco install busybox

      - name: Build with Autotools
        if: startsWith(matrix.build-system,'autotools')
        env:
          CC: ${{ matrix.cc }}
          CXX: ${{ matrix.cxx }}
        run: |
          ./autogen.sh
          ./configure ${{ matrix.configure-opts }}
          make
          make check

      - name: Prepare CMake build directory
        if: startsWith(matrix.build-system,'cmake')
        env:
          CC: ${{ matrix.cc }}
          CXX: ${{ matrix.cxx }}
        run: mkdir cmake-build

      - name: CMake generator
        if: startsWith(matrix.build-system,'cmake')
        env:
          CC: ${{ matrix.cc }}
          CXX: ${{ matrix.cxx }}
        working-directory: cmake-build
        run: cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ${{ matrix.configure-opts }} -DCMAKE_FIND_FRAMEWORK=NEVER

      - name: CMake build
        if: startsWith(matrix.build-system,'cmake')
        env:
          CC: ${{ matrix.cc }}
          CXX: ${{ matrix.cxx }}
        working-directory: cmake-build
        run: cmake --build . --config Release

      - name: CMake test
        if: startsWith(matrix.build-system,'cmake')
        env:
          CC: ${{ matrix.cc }}
          CXX: ${{ matrix.cxx }}
        working-directory: cmake-build
        run: ctest -V -C Release

      - name: Upload logs on failure
        uses: actions/upload-artifact@v2
        if: failure()
        with:
          name: flac-${{ github.sha }}-${{ github.run_id }}-logs
          path: ./**/*.log