Skip to content

Commit

Permalink
Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
maluoi committed Mar 18, 2024
1 parent 2b94554 commit 2e5d7de
Show file tree
Hide file tree
Showing 2 changed files with 243 additions and 0 deletions.
152 changes: 152 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Build Package
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build'
type: string
required: true
workflow_call:
inputs:
branch:
description: 'Branch to build'
type: string
required: true

permissions:
contents: write
actions: write

jobs:

###########################################

build-windows:
runs-on: windows-latest
env:
CPM_SOURCE_CACHE: .deps_cache

steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- uses: lukka/get-cmake@v3.26.3

- name: Get Cache
uses: actions/cache@v3
with:
key: DependencyCache
path: |
.deps_cache
- name: Build Native Win32 x64
run: |
cmake --preset Win32_x64_Release
cmake --build --preset Win32_x64_Release
mkdir -p bin/distribute/win32_x64
copy bin/intermediate/Win32_x64_Release/Release/skshaderc.exe bin/distribute/win32_x64/skshaderc.exe
- name: Build Native Win32 Arm64
run: |
cmake --preset Win32_Arm64_Release
cmake --build --preset Win32_Arm64_Release
mkdir -p bin/distribute/win32_arm64
copy bin/intermediate/Win32_Arm64_Release/Release/skshaderc.exe bin/distribute/win32_arm64/skshaderc.exe
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: binaries
path: bin/distribute/

###########################################

build-linux:
runs-on: ubuntu-20.04
env:
CPM_SOURCE_CACHE: .deps_cache

steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- uses: lukka/get-cmake@v3.26.3

- name: Get Cache
uses: actions/cache@v3
with:
key: DependencyCache
path: |
.deps_cache
- name: Install Prerequisites
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: Build Native Linux x64
run: |
cmake --preset Linux_x64_Release
cmake --build --preset Linux_x64_Release
mkdir -p bin/distribute/linux_x64
copy bin/intermediate/Linux_x64_Release/skshaderc_exe bin/distribute/linux_x64/skshaderc
- name: Install Arm64 Prerequisites
run: |
sudo cp ./tools/docker/arm-cross-compile-sources-focal.list /etc/apt/sources.list.d/
sudo sed -i "s/deb mirror/deb [arch=amd64] mirror/g" /etc/apt/sources.list
sudo dpkg --add-architecture arm64
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu lld:arm64
- name: Build Linux Arm64
run: |
cmake --preset Linux_Arm64_Release
cmake --build --preset Linux_Arm64_Release
mkdir -p bin/distribute/linux_arm64
copy bin/intermediate/Linux_Arm64_Release/skshaderc_exe bin/distribute/linux_arm64/skshaderc
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: binaries
path: bin/distribute/

###########################################

build-mac:
runs-on: macos-latest
env:
CPM_SOURCE_CACHE: .deps_cache

steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- uses: lukka/get-cmake@v3.26.3

- name: Get Cache
uses: actions/cache@v3
with:
key: DependencyCache
path: |
.deps_cache
- name: Build Native Linux x64
run: |
cmake --preset Linux_x64_Release
cmake --build --preset Linux_x64_Release
mkdir -p bin/distribute/mac_arm64
copy bin/intermediate/Linux_Arm64_Release/Release/skshaderc_exe bin/distribute/mac_arm64/skshaderc
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: binaries
path: bin/distribute/
91 changes: 91 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"patch": 0
},
"configurePresets": [
{
"name": "Win32",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS_RELEASE": "/O1 /GL /Gy",
"CMAKE_C_FLAGS_RELEASE": "/O1 /GL /Gy",
"CMAKE_EXE_LINKER_FLAGS": "/LTCG /INCREMENTAL:NO",
"CMAKE_SHARED_LINKER_FLAGS": "/LTCG /INCREMENTAL:NO",
"CMAKE_STATIC_LINKER_FLAGS": "/LTCG",
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "TRUE"
}
},
{
"name": "skshaderc_Win32_x64_Release",
"inherits": "Win32",
"description": "Release build for Win32 x64",
"hidden": false,
"binaryDir": "${sourceDir}/bin/intermediate/Win32_x64"
},
{
"name": "skshaderc_Win32_Arm64_Release",
"inherits": "Win32",
"description": "Release build for Win32 Arm64",
"hidden": false,
"architecture": "ARM64",
"binaryDir": "${sourceDir}/bin/intermediate/Win32_Arm64"
},
{
"name": "Linux",
"description": "Build for Linux",
"hidden": true,
"generator": "Ninja",
"cacheVariables": {
"CMAKE_SYSTEM_NAME": "Linux",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_LINKER": "lld",
"CMAKE_EXE_LINKER_FLAGS": "-fuse-ld=lld",
"CMAKE_SHARED_LINKER_FLAGS": "-fuse-ld=lld",
"CMAKE_MODULE_LINKER_FLAGS": "-fuse-ld=lld"
}
},
{
"name": "skshaderc_Linux_x64_Release",
"description": "Release build for Linux x64",
"hidden": false,
"inherits": "Linux",
"binaryDir": "${sourceDir}/bin/intermediate/Linux_x64_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "skshaderc_Linux_Arm64_Release",
"description": "Release build for Linux Arm64",
"hidden": false,
"inherits": "Linux",
"binaryDir": "${sourceDir}/bin/intermediate/Linux_ARM64_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_AR": "/usr/bin/aarch64-linux-gnu-ar",
"CMAKE_LINKER": "/usr/bin/aarch64-linux-gnu-ld",
"CMAKE_OBJCOPY": "/usr/bin/aarch64-linux-gnu-objcopy",
"CMAKE_RANLIB": "/usr/bin/aarch64-linux-gnu-ranlib",
"CMAKE_SIZE": "/usr/bin/aarch64-linux-gnu-size",
"CMAKE_STRIP": "/usr/bin/aarch64-linux-gnu-strip",
"CMAKE_C_COMPILER": "aarch64-linux-gnu-gcc",
"CMAKE_CXX_COMPILER": "aarch64-linux-gnu-g++",
"CMAKE_SYSTEM_PROCESSOR": "arm64",
"CMAKE_EXE_LINKER_FLAGS": null,
"CMAKE_SHARED_LINKER_FLAGS": null,
"CMAKE_MODULE_LINKER_FLAGS": null
}
}
],
"buildPresets": [
{ "name":"skshaderc_Win32_x64_Release", "targets": ["sk_gpu_header", "skshaderc"], "configuration":"Release", "configurePreset":"Win32_x64_Release", "jobs":24},
{ "name":"skshaderc_Win32_Arm64_Release", "targets": ["sk_gpu_header", "skshaderc"], "configuration":"Release", "configurePreset":"Win32_Arm64_Release", "jobs":24},
{ "name":"skshaderc_Linux_x64_Release", "targets": ["sk_gpu_header", "skshaderc"], "configuration":"MinSizeRelease", "configurePreset":"Linux_x64_Release", "jobs":24},
{ "name":"skshaderc_Linux_Arm64_Release", "targets": ["sk_gpu_header", "skshaderc"], "configuration":"MinSizeRelease", "configurePreset":"Linux_Arm64_Release", "jobs":24}
]
}

0 comments on commit 2e5d7de

Please sign in to comment.