main.yml
1 name: CI 2 3 on: 4 pull_request: 5 push: 6 branches: 7 - master 8 9 jobs: 10 cmake-build-and-tests: 11 name: >- 12 CMake build + tests (${{ matrix.image_name }} ${{ matrix.cmake_flags }}) 13 runs-on: ${{ matrix.image_name }} 14 15 strategy: 16 fail-fast: false 17 matrix: 18 include: 19 # Do a regular and a no-libc build for each platform. 20 - image_name: macOS-latest 21 - image_name: macOS-latest 22 cmake_flags: -DZYAN_NO_LIBC=ON 23 skip_tests: yes 24 - image_name: windows-2022 25 - image_name: windows-2022 26 cmake_flags: -DZYAN_NO_LIBC=ON 27 skip_tests: yes 28 - image_name: ubuntu-22.04 29 - image_name: ubuntu-22.04 30 cmake_flags: -DZYAN_NO_LIBC=ON 31 skip_tests: yes 32 33 # Do a few more specialized configurations. 34 - image_name: ubuntu-22.04 35 cmake_flags: -DZYDIS_MINIMAL_MODE=ON -DZYDIS_FEATURE_ENCODER=OFF 36 skip_tests: yes 37 - image_name: windows-2022 38 cmake_flags: -TClangCL 39 40 steps: 41 - name: Checkout 42 uses: actions/checkout@v2 43 with: { submodules: recursive } 44 - name: Configuring 45 run: | 46 mkdir build 47 cd build 48 cmake -DZYAN_DEV_MODE=ON ${{ matrix.cmake_flags }} .. 49 - name: Building 50 run: | 51 cmake --build build --config Release 52 - name: Running regression tests (decoder) 53 run: | 54 cd tests 55 python3 regression.py test ../build/ZydisInfo 56 if: "matrix.image_name != 'windows-2022' && !matrix.skip_tests" 57 - name: Running regression tests (encoder) 58 run: | 59 cd tests 60 python3 regression_encoder.py ../build/ZydisFuzzReEncoding ../build/ZydisFuzzEncoder ../build/ZydisTestEncoderAbsolute 61 if: "matrix.image_name != 'windows-2022' && !matrix.skip_tests" 62 - name: Running regression tests 63 run: | 64 cd tests 65 python regression.py test ..\\build\\Release\\ZydisInfo.exe 66 if: "matrix.image_name == 'windows-2022' && !matrix.skip_tests" 67 68 msbuild-build: 69 name: MSBuild build (windows-2022) 70 runs-on: windows-2022 71 steps: 72 - name: Checkout 73 uses: actions/checkout@v2 74 with: { submodules: recursive } 75 - name: Add msbuild to PATH 76 uses: microsoft/setup-msbuild@v1.1.3 77 with: { vs-version: '[17,]' } 78 - name: Build user-mode 79 run: | 80 cd msvc 81 msbuild.exe Zydis.sln /m /t:Rebuild '/p:Configuration="Release MD";Platform=X64' 82 - name: Build kernel-mode 83 run: | 84 cd msvc 85 msbuild.exe Zydis.sln /m /t:Rebuild '/p:Configuration="Release Kernel";Platform=X64' 86 87 amalgamated: 88 name: Amalgamated build (Ubuntu 22.04) 89 runs-on: ubuntu-22.04 90 steps: 91 - name: Checkout 92 uses: actions/checkout@v2 93 with: { submodules: recursive } 94 - name: Amalgamating sources 95 run: | 96 ./assets/amalgamate.py 97 - name: Compiling library 98 run: | 99 cd amalgamated-dist 100 gcc -shared -I. -fPIC -olibzydis.so Zydis.c 101 102 fuzzing: 103 runs-on: ubuntu-22.04 104 strategy: 105 fail-fast: false 106 matrix: 107 sanitizer: [address, undefined, memory] 108 steps: 109 - name: Build Fuzzers (${{ matrix.sanitizer }}) 110 id: build 111 uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master 112 with: 113 oss-fuzz-project-name: zydis 114 dry-run: false 115 sanitizer: ${{ matrix.sanitizer }} 116 - name: Run Fuzzers (${{ matrix.sanitizer }}) 117 uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master 118 with: 119 oss-fuzz-project-name: zydis 120 fuzz-seconds: 600 121 dry-run: false 122 sanitizer: ${{ matrix.sanitizer }} 123 - name: Upload Crash 124 uses: actions/upload-artifact@v1 125 if: failure() && steps.build.outcome == 'success' 126 with: 127 name: ${{ matrix.sanitizer }}-artifacts 128 path: ./out/artifacts