Skip to content

Commit

Permalink
build(ci): macos arm64 (#134)
Browse files Browse the repository at this point in the history
Co-authored-by: xensik <xensik@pm.me>
  • Loading branch information
diamante0018 and xensik committed Jun 25, 2023
1 parent 4973cec commit 3ac5ce5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 54 deletions.
75 changes: 28 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ concurrency:
cancel-in-progress: true

jobs:
build-win:
build-windows:
name: Build Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
configuration:
- debug
config:
- release
arch:
- x86
Expand All @@ -35,7 +34,7 @@ jobs:
platform: x64
steps:
- name: Check out files
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
with:
submodules: true
fetch-depth: 0
Expand All @@ -55,40 +54,30 @@ jobs:
- name: Set up problem matching
uses: ammaraskar/msvc-problem-matcher@master

- name: Build ${{matrix.configuration}} ${{matrix.arch}} binaries
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=${{matrix.platform}} build/gsc-tool.sln
- name: Build ${{matrix.arch}} ${{matrix.config}} binaries
run: msbuild /m /v:minimal /p:Configuration=${{matrix.config}} /p:Platform=${{matrix.platform}} build/gsc-tool.sln

- name: Upload ${{matrix.configuration}} ${{matrix.arch}} binaries
- name: Upload ${{matrix.arch}} ${{matrix.config}} binaries
uses: actions/upload-artifact@v3.1.2
with:
name: Windows ${{matrix.configuration}} ${{matrix.arch}} binaries
name: windows-${{matrix.arch}}-${{matrix.config}}
path: |
build/bin/${{matrix.arch}}/${{matrix.configuration}}/gsc-tool.exe
build/bin/${{matrix.arch}}/${{matrix.config}}/gsc-tool.exe
build-mac:
build-macos:
name: Build macOS
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
configuration:
- debug
config:
- release
arch:
- x64
- ARM64
include:
- configuration: debug
config: debug
- configuration: release
config: release
- arch: x64
platform: x64
- arch: ARM64
platform: arm64
- arm64
steps:
- name: Check out files
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
with:
submodules: true
fetch-depth: 0
Expand All @@ -105,39 +94,31 @@ jobs:
- name: Set up problem matching
uses: ammaraskar/gcc-problem-matcher@master

- name: Build ${{matrix.configuration}} ${{matrix.arch}} binaries
- name: Build ${{matrix.arch}} ${{matrix.config}} binaries
run: |
pushd build
make config=${{matrix.config}}_${{matrix.platform}} -j$(sysctl -n hw.logicalcpu)
make config=${{matrix.config}}_${{matrix.arch}} -j$(sysctl -n hw.logicalcpu)
- name: Upload ${{matrix.configuration}} ${{matrix.arch}} binaries
- name: Upload ${{matrix.arch}} ${{matrix.config}} binaries
uses: actions/upload-artifact@v3.1.2
with:
name: macOS ${{matrix.configuration}} ${{matrix.arch}} binaries
name: macos-${{matrix.arch}}-${{matrix.config}}
path: |
build/bin/${{matrix.platform}}/${{matrix.configuration}}/gsc-tool
build/bin/${{matrix.arch}}/${{matrix.config}}/gsc-tool
build-lin:
build-linux:
name: Build Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
configuration:
- debug
config:
- release
arch:
- x64
include:
- configuration: debug
config: debug
- configuration: release
config: release
- arch: x64
platform: x64
steps:
- name: Check out files
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
with:
submodules: true
fetch-depth: 0
Expand All @@ -157,34 +138,34 @@ jobs:
- name: Set up problem matching
uses: ammaraskar/gcc-problem-matcher@master

- name: Build ${{matrix.configuration}} ${{matrix.arch}} binaries
- name: Build ${{matrix.arch}} ${{matrix.config}} binaries
run: |
pushd build
make config=${{matrix.config}}_${{matrix.arch}} -j$(nproc)
env:
CC: clang
CXX: clang++

- name: Upload ${{matrix.configuration}} ${{matrix.arch}} binaries
- name: Upload ${{matrix.arch}} ${{matrix.config}} binaries
uses: actions/upload-artifact@v3.1.2
with:
name: Linux ${{matrix.configuration}} ${{matrix.arch}} binaries
name: linux-${{matrix.arch}}-${{matrix.config}}
path: |
build/bin/${{matrix.platform}}/${{matrix.configuration}}/gsc-tool
build/bin/${{matrix.arch}}/${{matrix.config}}/gsc-tool
deploy:
name: Deploy Release
runs-on: ubuntu-latest
needs: [ build-win, build-mac, build-lin ]
needs: [ build-windows, build-macos, build-linux ]
if: startsWith(github.ref, 'refs/tags/') && (github.event.base_ref == 'refs/heads/prod' || github.event.base_ref == 'refs/heads/dev')
steps:
- name: Check out files
uses: actions/checkout@v3
uses: actions/checkout@v3.5.3

- name: Download Binaries
uses: actions/download-artifact@v3
uses: actions/download-artifact@v3.0.2
with:
name: Windows release x64 binaries
name: windows-x64-release

- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
Expand Down
17 changes: 10 additions & 7 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ workspace "gsc-tool"

configurations { "debug", "release" }

if os.istarget("darwin") then
if os.istarget("linux") or os.istarget("darwin") then
platforms { "x64", "arm64" }
else
platforms { "x86", "x64" }
platforms { "x86", "x64", "arm64" }
end

filter "platforms:x86"
Expand Down Expand Up @@ -116,10 +116,6 @@ workspace "gsc-tool"
systemversion "latest"
filter {}

filter { "system:macosx" }
systemversion "12.0"
filter {}

symbols "On"
staticruntime "On"
warnings "Extra"
Expand All @@ -129,9 +125,16 @@ workspace "gsc-tool"
linkoptions "-pthread"
end

if os.istarget("darwin") then
filter "platforms:arm64"
buildoptions "-arch arm64"
linkoptions "-arch arm64"
filter {}
end

filter "configurations:release"
optimize "Full"
defines { "NDEBUG" }
defines "NDEBUG"
flags { "FatalCompileWarnings" }
filter {}

Expand Down

0 comments on commit 3ac5ce5

Please sign in to comment.