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    env:
34      DEVNULLRIGHTS: 1
35      READFROMBLOCKDEVICE: 1
36    steps:
37    - uses: actions/checkout@v2
38    - name: make test
39      run: make test
40
41  check-32bit: # designed to catch https://github.com/facebook/zstd/issues/2428
42    runs-on: ubuntu-latest
43    steps:
44    - uses: actions/checkout@v2
45    - name: make check on 32-bit
46      run: |
47        sudo apt update
48        APT_PACKAGES="gcc-multilib" make apt-install
49        CFLAGS="-m32 -O1 -fstack-protector" make check V=1
50
51  gcc-7-libzstd:
52    runs-on: ubuntu-latest
53    steps:
54    - uses: actions/checkout@v2
55    - name: gcc-7 + libzstdmt compilation
56      run: |
57        make gcc7install
58        CC=gcc-7 CFLAGS=-Werror make -j all
59        make clean
60        LDFLAGS=-Wl,--no-undefined make -C lib libzstd-mt
61
62    # candidate test (to check) : underlink test
63    # LDFLAGS=-Wl,--no-undefined : will make the linker fail if dll is underlinked
64
65  gcc-8-asan-ubsan-testzstd:
66    runs-on: ubuntu-latest
67    steps:
68    - uses: actions/checkout@v2
69    - name: gcc-8 + ASan + UBSan + Test Zstd
70      run: |
71        make gcc8install
72        CC=gcc-8 CFLAGS="-Werror" make -j all
73        make clean
74        CC=gcc-8 make -j uasan-test-zstd </dev/null V=1
75
76  gcc-asan-ubsan-testzstd-32bit:
77    runs-on: ubuntu-latest
78    steps:
79    - uses: actions/checkout@v2
80    - name: ASan + UBSan + Test Zstd, 32bit mode
81      run: |
82        make libc6install
83        CFLAGS="-Werror -m32" make -j all32
84        make clean
85        make -j uasan-test-zstd32 V=1
86
87  clang-msan-testzstd:
88    runs-on: ubuntu-latest
89    steps:
90    - uses: actions/checkout@v2
91    - name: clang + MSan + Test Zstd
92      run: |
93        sudo apt-get update
94        sudo apt-get install clang
95        CC=clang make msan-test-zstd HAVE_ZLIB=0 HAVE_LZ4=0 HAVE_LZMA=0 V=1
96
97    # Note : external libraries must be turned off when using MSAN tests,
98    # because they are not msan-instrumented,
99    # so any data coming from these libraries is always considered "uninitialized"
100
101  cmake-build-and-test-check:
102    runs-on: ubuntu-latest
103    steps:
104    - uses: actions/checkout@v2
105    - name: cmake build and test check
106      run: |
107        FUZZERTEST=-T1mn ZSTREAM_TESTTIME=-T1mn make cmakebuild
108        cp -r ./ "../zstd source"
109        cd "../zstd source"
110        FUZZERTEST=-T1mn ZSTREAM_TESTTIME=-T1mn make cmakebuild
111
112  gcc-8-asan-ubsan-fuzz:
113    runs-on: ubuntu-latest
114    steps:
115    - uses: actions/checkout@v2
116    - name: gcc-8 + ASan + UBSan + Fuzz Test
117      run: |
118        make gcc8install
119        CC=gcc-8 FUZZER_FLAGS="--long-tests" make clean uasan-fuzztest
120
121  gcc-asan-ubsan-fuzz32:
122    runs-on: ubuntu-latest
123    steps:
124    - uses: actions/checkout@v2
125    - name: ASan + UBSan + Fuzz Test 32bit
126      run: |
127        make libc6install
128        CFLAGS="-O2 -m32" FUZZER_FLAGS="--long-tests" make uasan-fuzztest
129
130  clang-msan-fuzz:
131    runs-on: ubuntu-latest
132    steps:
133    - uses: actions/checkout@v2
134    - name: clang + MSan + Fuzz Test
135      run: |
136        sudo apt-get update
137        sudo apt-get install clang
138        CC=clang FUZZER_FLAGS="--long-tests" make clean msan-fuzztest
139
140  asan-ubsan-msan-regression:
141    runs-on: ubuntu-latest
142    steps:
143    - uses: actions/checkout@v2
144    - name: ASan + UBSan + MSan + Regression Test
145      run: |
146        make -j uasanregressiontest
147        make clean
148        make -j msanregressiontest
149
150  cpp-gnu90-c99-compatibility:
151    runs-on: ubuntu-latest
152    steps:
153    - uses: actions/checkout@v2
154    - name: C++, gnu90 and c99 compatibility
155      run: |
156        make cxxtest
157        make clean
158        make gnu90build
159        make clean
160        make c99build
161        make clean
162        make travis-install   # just ensures `make install` works
163
164  mingw-cross-compilation:
165    runs-on: ubuntu-latest
166    steps:
167    - uses: actions/checkout@v2
168    - name: mingw cross-compilation
169      run: |
170        # sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix; (doesn't work)
171        sudo apt-get install gcc-mingw-w64
172        CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CFLAGS="-Werror -O1" make zstd
173
174# TODO: Broken test - fix and uncomment
175#  armbuild:
176#    runs-on: ubuntu-16.04 # doesn't work on latest
177#    steps:
178#    - uses: actions/checkout@v2
179#    - name: ARM Build Test
180#      run: |
181#        make arminstall
182#        make armbuild
183
184# TODO: Broken test - fix and uncomment
185#  armfuzz:
186#    runs-on: ubuntu-16.04 # doesn't work on latest
187#    steps:
188#    - uses: actions/checkout@v2
189#    - name: Qemu ARM emulation + Fuzz Test
190#      run: |
191#        make arminstall
192#        make armfuzz
193
194  bourne-shell:
195    runs-on: ubuntu-latest
196    steps:
197    - uses: actions/checkout@v2
198    - name: Bourne shell compatibility (shellcheck)
199      run: |
200        wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz
201        tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz
202        shellcheck-v0.7.1/shellcheck --shell=sh --severity=warning --exclude=SC2010 tests/playTests.sh
203
204# For reference : icc tests
205# icc tests are currently failing on Github Actions, likely to issues during installation stage
206# To be fixed later
207#
208#  icc:
209#    name: icc-check
210#    runs-on: ubuntu-latest
211#    steps:
212#    - name: install icc
213#      run: |
214#        export DEBIAN_FRONTEND=noninteractive
215#        sudo apt-get -qqq update
216#        sudo apt-get install -y wget build-essential pkg-config cmake ca-certificates gnupg
217#        sudo wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
218#        sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
219#        sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
220#        sudo apt-get update
221#        sudo apt-get install -y intel-basekit intel-hpckit
222#    - uses: actions/checkout@v2
223#    - name: make check
224#      run: |
225#        make CC=/opt/intel/oneapi/compiler/latest/linux/bin/intel64/icc check
226