]> wimlib.net Git - wimlib/blob - .github/workflows/ci.yml
ci.yml: use actions/checkout@v4 and actions/upload-artifact@v4
[wimlib] / .github / workflows / ci.yml
1 name: CI
2 on: [pull_request, push]
3 env:
4   DEF_CFLAGS: -O2 -g -Wall -Werror
5   DEPENDENCIES: autoconf automake libtool pkgconf libfuse3-dev fuse3 ntfs-3g-dev ntfs-3g
6
7 jobs:
8   gcc-build-and-test:
9     name: Build and test with gcc
10     runs-on: ubuntu-latest
11     steps:
12     - uses: actions/checkout@v4
13     - name: Install dependencies
14       run: |
15         sudo apt-get update
16         sudo apt-get install -y $DEPENDENCIES
17     - run: ./bootstrap
18     - run: ./configure CC=gcc CFLAGS="$DEF_CFLAGS"
19     - run: make -j8 check V=1
20     - run: make -j8 install V=1 DESTDIR=$PWD/installdir
21     - run: make -j8 uninstall V=1 DESTDIR=$PWD/installdir
22     - uses: actions/upload-artifact@v4
23       if: failure()
24       with:
25         name: gcc-test-logs
26         path: tests/*.log
27
28   clang-build-and-test:
29     name: Build and test with clang
30     runs-on: ubuntu-latest
31     steps:
32     - uses: actions/checkout@v4
33     - name: Install dependencies
34       run: |
35         sudo apt-get update
36         sudo apt-get install -y clang $DEPENDENCIES
37     - run: ./bootstrap
38     - run: ./configure CC=clang CFLAGS="$DEF_CFLAGS"
39     - run: make -j8 check V=1
40     - run: make -j8 install V=1 DESTDIR=$PWD/installdir
41     - run: make -j8 uninstall V=1 DESTDIR=$PWD/installdir
42     - uses: actions/upload-artifact@v4
43       if: failure()
44       with:
45         name: clang-test-logs
46         path: tests/*.log
47
48   i386-build-and-test:
49     name: Build and test with gcc -m32
50     runs-on: ubuntu-latest
51     steps:
52     - uses: actions/checkout@v4
53     - name: Install dependencies
54       run: |
55         sudo dpkg --add-architecture i386
56         sudo apt-get update
57         sudo apt-get install -y gcc-multilib $DEPENDENCIES
58     - run: ./bootstrap
59     - run: ./configure CC=gcc CFLAGS="-m32 $DEF_CFLAGS" --without-fuse --without-ntfs-3g
60     - run: make -j8 check V=1
61     - run: make -j8 install V=1 DESTDIR=$PWD/installdir
62     - run: make -j8 uninstall V=1 DESTDIR=$PWD/installdir
63     - uses: actions/upload-artifact@v4
64       if: failure()
65       with:
66         name: i386-test-logs
67         path: tests/*.log
68
69   asan-build-and-test:
70     name: Build and test with ASAN enabled
71     runs-on: ubuntu-latest
72     steps:
73     - uses: actions/checkout@v4
74     - name: Install dependencies
75       run: |
76         sudo apt-get update
77         sudo apt-get install -y clang $DEPENDENCIES
78     - run: ./bootstrap
79     - run: ./configure CC=clang CFLAGS="$DEF_CFLAGS -fsanitize=address -fno-sanitize-recover=address"
80     - run: make -j8 check V=1
81     - uses: actions/upload-artifact@v4
82       if: failure()
83       with:
84         name: asan-test-logs
85         path: tests/*.log
86
87   ubsan-build-and-test:
88     name: Build and test with UBSAN enabled
89     runs-on: ubuntu-latest
90     steps:
91     - uses: actions/checkout@v4
92     - name: Install dependencies
93       run: |
94         sudo apt-get update
95         sudo apt-get install -y clang $DEPENDENCIES
96     - run: ./bootstrap
97     - run: ./configure CC=clang CFLAGS="$DEF_CFLAGS -fsanitize=undefined -fno-sanitize-recover=undefined"
98     - run: make -j8 check V=1
99     - uses: actions/upload-artifact@v4
100       if: failure()
101       with:
102         name: ubsan-test-logs
103         path: tests/*.log
104
105   run-shellcheck:
106     name: Run shellcheck
107     runs-on: ubuntu-latest
108     steps:
109     - uses: actions/checkout@v4
110     - name: Install dependencies
111       run: |
112         sudo apt-get update
113         sudo apt-get install -y shellcheck
114     - name: Run shellcheck
115       run: shellcheck tools/*.sh tools/*/*.sh
116
117   macos-build-and-test:
118     name: Build and test on macOS
119     runs-on: macos-latest
120     steps:
121     - uses: actions/checkout@v4
122     - name: Install dependencies
123       run: |
124         brew install autoconf automake libtool pkg-config
125     - run: ./bootstrap
126     - run: ./configure CFLAGS="$DEF_CFLAGS" --without-fuse --without-ntfs-3g
127     - run: make -j8 check V=1
128     - run: make -j8 install DESTDIR=$PWD/installdir
129     - run: make -j8 uninstall DESTDIR=$PWD/installdir
130     - uses: actions/upload-artifact@v4
131       if: failure()
132       with:
133         name: macos-test-logs
134         path: tests/*.log
135
136   windows-build:
137     name: Build on Windows
138     runs-on: windows-latest
139     strategy:
140       matrix:
141         include:
142         - { msystem: MINGW32, cc_pkg: mingw-w64-i686-gcc }
143         - { msystem: MINGW64, cc_pkg: mingw-w64-x86_64-gcc }
144         - { msystem: CLANG32, cc_pkg: mingw-w64-clang-i686-clang }
145         - { msystem: CLANG64, cc_pkg: mingw-w64-clang-x86_64-clang }
146         - { msystem: CLANGARM64, options: --install-prerequisites }
147     defaults:
148       run:
149         shell: msys2 {0}
150     steps:
151     - uses: actions/checkout@v4
152       with:
153         fetch-depth: 0  # Need tags for tools/get-version-number.sh
154     - uses: msys2/setup-msys2@v2
155       with:
156         msystem: ${{matrix.msystem}}
157         update: true
158         install: >
159           autoconf
160           automake
161           git
162           libtool
163           make
164           ${{matrix.cc_pkg}}
165           pkgconf
166     - run: CFLAGS="$DEF_CFLAGS" ./tools/windows-build.sh ${{matrix.options}}
167     - uses: actions/upload-artifact@v4
168       with:
169         name: windows-${{matrix.msystem}}-bin
170         path: wimlib-*-bin
171
172   win32-test-imagex-capture-and-apply:
173     name: Run win32-test-imagex-capture_and_apply.bat
174     runs-on: windows-latest
175     defaults:
176       run:
177         shell: msys2 {0}
178     steps:
179     - uses: actions/checkout@v4
180       with:
181         fetch-depth: 0  # Need tags for tools/get-version-number.sh
182     - uses: msys2/setup-msys2@v2
183       with:
184         msystem: MINGW64
185         update: true
186         install: >
187           autoconf
188           automake
189           git
190           libtool
191           make
192           mingw-w64-x86_64-gcc
193           pkgconf
194     - run: tests/win32-test-imagex-capture_and_apply.sh
195
196   fuzz-with-libFuzzer:
197     name: Fuzz with libFuzzer (${{matrix.target}} ${{matrix.sanitizer}})
198     strategy:
199       matrix:
200         include:
201         - target: wim
202           sanitizer:
203         - target: wim
204           sanitizer: --asan --ubsan
205         - target: encoding
206           sanitizer: --asan --ubsan
207         - target: xmlproc
208           sanitizer:
209         - target: xmlproc
210           sanitizer: --asan --ubsan
211         - target: xml_windows
212           sanitizer: --asan --ubsan
213         - target: compress
214           sanitizer:
215         - target: compress
216           sanitizer: --asan --ubsan
217         - target: decompress
218           sanitizer:
219         - target: decompress
220           sanitizer: --asan --ubsan
221     runs-on: ubuntu-latest
222     steps:
223     - uses: actions/checkout@v4
224     - name: Install dependencies
225       run: |
226         sudo apt-get update
227         sudo apt-get install -y clang $DEPENDENCIES
228     - run: ./bootstrap
229     - name: Fuzz
230       run: |
231         tools/libFuzzer/fuzz.sh --time=120 ${{matrix.sanitizer}} \
232             ${{matrix.target}}
233
234   fuzz-with-wlfuzz-linux:
235     name: Fuzz with wlfuzz (Linux, ${{matrix.sanitizer}})
236     strategy:
237       matrix:
238         include:
239         - sanitizer: none
240           cflags:
241         - sanitizer: ASAN
242           cflags: -fsanitize=address -fno-sanitize-recover=address
243         - sanitizer: UBSAN
244           cflags: -fsanitize=undefined -fno-sanitize-recover=undefined
245     runs-on: ubuntu-latest
246     steps:
247     - uses: actions/checkout@v4
248     - name: Install dependencies
249       run: |
250         sudo apt-get update
251         sudo apt-get install -y clang $DEPENDENCIES
252     - run: ./bootstrap
253     - run: ./configure --enable-test-support CC=clang CFLAGS="$DEF_CFLAGS ${{matrix.cflags}}"
254     - run: make -j8 tests/wlfuzz
255     - run: TMPDIR=$PWD/tmp.wlfuzz tests/wlfuzz 120
256
257   fuzz-with-wlfuzz-windows:
258     name: Fuzz with wlfuzz (Windows)
259     runs-on: windows-latest
260     defaults:
261       run:
262         shell: msys2 {0}
263     steps:
264     - uses: actions/checkout@v4
265       with:
266         fetch-depth: 0  # Need tags for tools/get-version-number.sh
267     - uses: msys2/setup-msys2@v2
268       with:
269         msystem: MINGW64
270         update: true
271         install: >
272           autoconf
273           automake
274           git
275           libtool
276           make
277           mingw-w64-x86_64-gcc
278           pkgconf
279     - run: CFLAGS="$DEF_CFLAGS" ./tools/windows-build.sh -- --enable-test-support
280     - run: make tests/wlfuzz.exe
281     - run: TMPDIR=$PWD/tmp.wlfuzz tests/wlfuzz 120