1name: generic-dev
2
3on:
4  pull_request:
5    branches: [ dev, release, actionsTest ]
6
7jobs:
8
9# Dev PR jobs that still have to be migrated from travis
10#
11# versionTag (only on release tags)
12# valgrindTest (keeps failing for some reason. need investigation)
13# staticAnalyze (need trusty so need self-hosted)
14# pcc-fuzz: (need trusty so need self-hosted)
15# min-decomp-macros (flakey)
16#
17# setting up self-hosted is pretty straightforward, but
18# I need admins permissions to the repo for that it looks like
19# So I'm tabling that for now
20#
21# The release branch exclusive jobs will be in a separate
22# workflow file (the osx tests and meson build that is)
23
24  benchmarking:
25    runs-on: ubuntu-latest
26    steps:
27    - uses: actions/checkout@v2
28    - name: make benchmarking
29      run: make benchmarking
30
31  test:
32    runs-on: ubuntu-latest
33    steps:
34    - uses: actions/checkout@v2
35    - name: make test
36      run: make test
37
38  check-32bit: # designed to catch https://github.com/facebook/zstd/issues/2428
39    runs-on: ubuntu-latest
40    steps:
41    - uses: actions/checkout@v2
42    - name: make check on 32-bit
43      run: |
44        sudo apt update
45        APT_PACKAGES="gcc-multilib" make apt-install
46        CFLAGS="-m32 -O1 -fstack-protector" make check V=1
47
48  gcc-7-libzstd:
49    runs-on: ubuntu-latest
50    steps:
51    - uses: actions/checkout@v2
52    - name: gcc-7 + libzstdmt compilation
53      run: |
54        make gcc7install
55        CC=gcc-7 CFLAGS=-Werror make -j all
56        make clean
57        LDFLAGS=-Wl,--no-undefined make -C lib libzstd-mt
58        make -C tests zbufftest-dll
59
60    # candidate test (to check) : underlink test
61    # LDFLAGS=-Wl,--no-undefined : will make the linker fail if dll is underlinked
62    # zbufftest-dll : test that a user program can link to multi-threaded libzstd without specifying -pthread
63
64  gcc-8-asan-ubsan-testzstd:
65    runs-on: ubuntu-16.04 # fails on 18.04
66    steps:
67    - uses: actions/checkout@v2
68    - name: gcc-8 + ASan + UBSan + Test Zstd
69      run: |
70        make gcc8install
71        CC=gcc-8 CFLAGS="-Werror" make -j all
72        make clean
73        CC=gcc-8 make -j uasan-test-zstd </dev/null V=1
74
75  gcc-asan-ubsan-testzstd-32bit:
76    runs-on: ubuntu-latest
77    steps:
78    - uses: actions/checkout@v2
79    - name: ASan + UBSan + Test Zstd, 32bit mode
80      run: |
81        make libc6install
82        CFLAGS="-Werror -m32" make -j all32
83        make clean
84        make -j uasan-test-zstd32 V=1
85
86  clang-msan-testzstd:
87    runs-on: ubuntu-latest
88    steps:
89    - uses: actions/checkout@v2
90    - name: clang + MSan + Test Zstd
91      run: |
92        sudo apt-get update
93        sudo apt-get install clang
94        CC=clang make msan-test-zstd HAVE_ZLIB=0 HAVE_LZ4=0 HAVE_LZMA=0 V=1
95
96    # Note : external libraries must be turned off when using MSAN tests,
97    # because they are not msan-instrumented,
98    # so any data coming from these libraries is always considered "uninitialized"
99
100  cmake-build-and-test-check:
101    runs-on: ubuntu-latest
102    steps:
103    - uses: actions/checkout@v2
104    - name: cmake build and test check
105      run: |
106        FUZZERTEST=-T1mn ZSTREAM_TESTTIME=-T1mn make cmakebuild
107        cp -r ./ "../zstd source"
108        cd "../zstd source"
109        FUZZERTEST=-T1mn ZSTREAM_TESTTIME=-T1mn make cmakebuild
110
111  gcc-8-asan-ubsan-fuzz:
112    runs-on: ubuntu-latest
113    steps:
114    - uses: actions/checkout@v2
115    - name: gcc-8 + ASan + UBSan + Fuzz Test
116      run: |
117        make gcc8install
118        CC=gcc-8 FUZZER_FLAGS="--long-tests" make clean uasan-fuzztest
119
120  gcc-asan-ubsan-fuzz32:
121    runs-on: ubuntu-latest
122    steps:
123    - uses: actions/checkout@v2
124    - name: ASan + UBSan + Fuzz Test 32bit
125      run: |
126        make libc6install
127        CFLAGS="-O2 -m32" FUZZER_FLAGS="--long-tests" make uasan-fuzztest
128
129  asan-ubsan-msan-regression:
130    runs-on: ubuntu-latest
131    steps:
132    - uses: actions/checkout@v2
133    - name: ASan + UBSan + MSan + Regression Test
134      run: |
135        make -j uasanregressiontest
136        make clean
137        make -j msanregressiontest
138
139  cpp-gnu90-c99-compatibility:
140    runs-on: ubuntu-latest
141    steps:
142    - uses: actions/checkout@v2
143    - name: C++, gnu90 and c99 compatibility
144      run: |
145        make cxxtest
146        make clean
147        make gnu90build
148        make clean
149        make c99build
150        make clean
151        make travis-install   # just ensures `make install` works
152
153  mingw-cross-compilation:
154    runs-on: ubuntu-latest
155    steps:
156    - uses: actions/checkout@v2
157    - name: mingw cross-compilation
158      run: |
159        # sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix; (doesn't work)
160        sudo apt-get install gcc-mingw-w64
161        CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CFLAGS="-Werror -O1" make zstd
162
163# TODO: Broken test - fix and uncomment
164#  armbuild:
165#    runs-on: ubuntu-16.04 # doesn't work on latest
166#    steps:
167#    - uses: actions/checkout@v2
168#    - name: ARM Build Test
169#      run: |
170#        make arminstall
171#        make armbuild
172
173# TODO: Broken test - fix and uncomment
174#  armfuzz:
175#    runs-on: ubuntu-16.04 # doesn't work on latest
176#    steps:
177#    - uses: actions/checkout@v2
178#    - name: Qemu ARM emulation + Fuzz Test
179#      run: |
180#        make arminstall
181#        make armfuzz
182
183  bourne-shell:
184    runs-on: ubuntu-latest
185    steps:
186    - uses: actions/checkout@v2
187    - name: Bourne shell compatibility (shellcheck)
188      run: |
189        wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz
190        tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz
191        shellcheck-v0.7.1/shellcheck --shell=sh --severity=warning --exclude=SC2010 tests/playTests.sh
192
193# For reference : icc tests
194# icc tests are currently failing on Github Actions, likely to issues during installation stage
195# To be fixed later
196#
197#  icc:
198#    name: icc-check
199#    runs-on: ubuntu-latest
200#    steps:
201#    - name: install icc
202#      run: |
203#        export DEBIAN_FRONTEND=noninteractive
204#        sudo apt-get -qqq update
205#        sudo apt-get install -y wget build-essential pkg-config cmake ca-certificates gnupg
206#        sudo wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
207#        sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
208#        sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
209#        sudo apt-get update
210#        sudo apt-get install -y intel-basekit intel-hpckit
211#    - uses: actions/checkout@v2
212#    - name: make check
213#      run: |
214#        make CC=/opt/intel/oneapi/compiler/latest/linux/bin/intel64/icc check
215