]> wimlib.net Git - wimlib/blob - .github/workflows/ci.yml
tools: make all shell scripts have the .sh extension
[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 libfuse-dev 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@v3
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@v3
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@v3
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@v3
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@v3
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@v3
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@v3
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@v3
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@v3
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@v3
100       if: failure()
101       with:
102         name: ubsan-test-logs
103         path: tests/*.log
104
105   macos-build-and-test:
106     name: Build and test on macOS
107     runs-on: macos-latest
108     steps:
109     - uses: actions/checkout@v3
110     - name: Install dependencies
111       run: |
112         brew install autoconf automake libtool pkg-config
113     - run: ./bootstrap
114     - run: ./configure CFLAGS="$DEF_CFLAGS" --without-fuse --without-ntfs-3g
115     - run: make -j8 check V=1
116     - run: make -j8 install DESTDIR=$PWD/installdir
117     - run: make -j8 uninstall DESTDIR=$PWD/installdir
118     - uses: actions/upload-artifact@v3
119       if: failure()
120       with:
121         name: macos-test-logs
122         path: tests/*.log
123
124   windows-build:
125     name: Build on Windows
126     runs-on: windows-latest
127     strategy:
128       matrix:
129         include:
130         - { msystem: MINGW32, cc_pkg: mingw-w64-i686-gcc }
131         - { msystem: MINGW64, cc_pkg: mingw-w64-x86_64-gcc }
132         - { msystem: CLANG32, cc_pkg: mingw-w64-clang-i686-clang }
133         - { msystem: CLANG64, cc_pkg: mingw-w64-clang-x86_64-clang }
134         - { msystem: CLANGARM64, options: --install-prerequisites }
135     defaults:
136       run:
137         shell: msys2 {0}
138     steps:
139     - uses: actions/checkout@v3
140       with:
141         fetch-depth: 0  # Need tags for tools/get-version-number.sh
142     - uses: msys2/setup-msys2@v2
143       with:
144         msystem: ${{matrix.msystem}}
145         update: true
146         install: >
147           autoconf
148           automake
149           git
150           libtool
151           make
152           ${{matrix.cc_pkg}}
153           pkgconf
154     - run: CFLAGS="$DEF_CFLAGS" ./tools/windows-build.sh ${{matrix.options}}
155     - uses: actions/upload-artifact@v3
156       with:
157         name: windows-${{matrix.msystem}}-bin
158         path: wimlib-*-bin
159
160   fuzz-with-libFuzzer:
161     name: Fuzz with libFuzzer (${{matrix.target}} ${{matrix.sanitizer}})
162     strategy:
163       matrix:
164         include:
165         - target: wim
166           sanitizer:
167         - target: wim
168           sanitizer: --asan --ubsan
169         - target: xml
170           sanitizer:
171         - target: xml
172           sanitizer: --asan --ubsan
173         - target: compress
174           sanitizer:
175         - target: compress
176           sanitizer: --asan --ubsan
177         - target: decompress
178           sanitizer:
179         - target: decompress
180           sanitizer: --asan --ubsan
181     runs-on: ubuntu-latest
182     steps:
183     - uses: actions/checkout@v3
184     - name: Install dependencies
185       run: |
186         sudo apt-get update
187         sudo apt-get install -y clang $DEPENDENCIES
188     - run: ./bootstrap
189     - name: Fuzz
190       run: |
191         tools/libFuzzer/fuzz.sh --time=120 ${{matrix.sanitizer}} \
192             ${{matrix.target}}