1+ # This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2+ # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3+ name : Build patcher for multi platforms.
4+
5+ on :
6+ push :
7+ branches : [ "main" ]
8+ pull_request :
9+ branches : [ "main" ]
10+
11+ jobs :
12+ build :
13+ runs-on : ${{ matrix.os }}
14+
15+ strategy :
16+ # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
17+ fail-fast : false
18+
19+ # Set up a matrix to run the following 3 configurations:
20+ # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
21+ # 2. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
22+ #
23+ # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
24+ matrix :
25+ os : [ubuntu-latest, windows-latest, macos-latest]
26+ arch : [x64, arm64]
27+ build_type : [Release]
28+ c_compiler : [clang, cl]
29+ include :
30+ - os : windows-latest
31+ c_compiler : cl
32+ cpp_compiler : cl
33+ - os : ubuntu-latest
34+ c_compiler : clang
35+ exclude :
36+ - os : windows-latest
37+ c_compiler : clang
38+ - os : ubuntu-latest
39+ c_compiler : cl
40+ - os : macos-latest
41+ c_compiler : cl
42+
43+ steps :
44+ - uses : actions/checkout@v4
45+
46+ - name : Set reusable strings
47+ id : strings
48+ shell : bash
49+ run : |
50+ echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
51+ echo >> $GITHUB_ENV
52+
53+ - name : Configure CMake
54+ run : >
55+ cmake -B ${{ steps.strings.outputs.build-output-dir }}
56+ -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
57+ -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
58+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
59+ -S ${{ github.workspace }}
60+
61+ - name : Build Patcher.
62+ run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target DualBootKernelPatcher
63+
64+ - name : Upload Windows x64 Artifact
65+ uses : actions/upload-artifact@v4
66+ if : ${{ matrix.arch == 'x64' && matrix.os == 'windows-latest' }}
67+ with :
68+ name : DualBootKernelPatcher-Windows-x64
69+ path : ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*
70+
71+ - name : Upload Linux x64 Artifact
72+ uses : actions/upload-artifact@v4
73+ if : ${{ matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' }}
74+ with :
75+ name : DualBootKernelPatcher-Linux-x64
76+ path : ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*
77+
78+ - name : Upload MacOS x64 Artifact
79+ uses : actions/upload-artifact@v4
80+ if : ${{ matrix.arch == 'x64' && matrix.os == 'macos-latest' }}
81+ with :
82+ name : DualBootKernelPatcher-MacOS-x64
83+ path : ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*
84+
85+ - name : Upload Windows arm64 Artifact
86+ uses : actions/upload-artifact@v4
87+ if : ${{ matrix.arch == 'arm64' && matrix.os == 'windows-latest' }}
88+ with :
89+ name : DualBootKernelPatcher-Windows-arm64
90+ path : ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*
91+
92+ - name : Upload Linux arm64 Artifact
93+ uses : actions/upload-artifact@v4
94+ if : ${{ matrix.arch == 'arm64' && matrix.os == 'ubuntu-latest' }}
95+ with :
96+ name : DualBootKernelPatcher-Linux-arm64
97+ path : ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*
98+
99+ - name : Upload MacOS arm64 Artifact
100+ uses : actions/upload-artifact@v4
101+ if : ${{ matrix.arch == 'arm64' && matrix.os == 'macos-latest' }}
102+ with :
103+ name : DualBootKernelPatcher-MacOS-arm64
104+ path : ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*
105+
106+ - name : Build shellcodes.
107+ if : ${{ matrix.arch == 'arm64' && matrix.os == 'ubuntu-latest' }}
108+ run : |
109+ sudo apt install binutils-aarch64-linux-gnu
110+ cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target all
111+
112+ - name : Upload ShellCode Artifact
113+ uses : actions/upload-artifact@v4
114+ if : ${{ matrix.arch == 'arm64' && matrix.os == 'ubuntu-latest' }}
115+ with :
116+ name : Shellcodes
117+ path : ${{ steps.strings.outputs.build-output-dir }}/ShellCode/*.bin
0 commit comments