Skip to content

Commit

Permalink
CI: Add workflow file.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunflower2333 committed Jul 1, 2024
1 parent 5cbc13d commit 3201435
Showing 1 changed file with 117 additions and 0 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# 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.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: Build patcher for multi platforms.

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# 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.
fail-fast: false

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x64, arm64]
build_type: [Release]
c_compiler: [clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: clang
exclude:
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
- os: macos-latest
c_compiler: cl

steps:
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo >> $GITHUB_ENV
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build Patcher.
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target DualBootKernelPatcher

- name: Upload Windows x64 Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.arch == 'x64' && matrix.os == 'windows-latest' }}
with:
name: DualBootKernelPatcher-Windows-x64
path: ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*

- name: Upload Linux x64 Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' }}
with:
name: DualBootKernelPatcher-Linux-x64
path: ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*

- name: Upload MacOS x64 Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.arch == 'x64' && matrix.os == 'macos-latest' }}
with:
name: DualBootKernelPatcher-MacOS-x64
path: ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*

- name: Upload Windows arm64 Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.arch == 'arm64' && matrix.os == 'windows-latest' }}
with:
name: DualBootKernelPatcher-Windows-arm64
path: ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*

- name: Upload Linux arm64 Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.arch == 'arm64' && matrix.os == 'ubuntu-latest' }}
with:
name: DualBootKernelPatcher-Linux-arm64
path: ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*

- name: Upload MacOS arm64 Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.arch == 'arm64' && matrix.os == 'macos-latest' }}
with:
name: DualBootKernelPatcher-MacOS-arm64
path: ${{ steps.strings.outputs.build-output-dir }}/DualBootKernelPatcher*

- name: Build shellcodes.
if: ${{ matrix.arch == 'arm64' && matrix.os == 'ubuntu-latest' }}
run: |
sudo apt install binutils-aarch64-linux-gnu
cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target all
- name: Upload ShellCode Artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.arch == 'arm64' && matrix.os == 'ubuntu-latest' }}
with:
name: Shellcodes
path: ${{ steps.strings.outputs.build-output-dir }}/ShellCode/*.bin

0 comments on commit 3201435

Please sign in to comment.