forked from ikkentim/SampSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (96 loc) · 3.02 KB
/
Copy pathcomponent-native.yml
File metadata and controls
105 lines (96 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: CI - Native component
on:
workflow_call:
inputs:
source_ref:
description: Commit, branch, or tag to build
required: true
type: string
pull_request:
branches:
- main
- release/1.*
paths:
- .github/workflows/component-native.yml
- src/sampsharp-component/**
- external/**
- build.sh
permissions:
contents: read
jobs:
build:
name: Native ${{ matrix.platform }} ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- platform: linux
arch: x64
runner: ubuntu-24.04
cmake_arch: ""
- platform: linux
arch: arm64
runner: ubuntu-24.04-arm
cmake_arch: ""
- platform: windows
arch: x64
runner: windows-2025
cmake_arch: x64
- platform: macos
arch: x64
runner: macos-15-intel
cmake_arch: ""
- platform: macos
arch: arm64
runner: macos-15
cmake_arch: ""
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.source_ref || github.sha }}
clean: true
submodules: recursive
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Configure Unix build
if: runner.os != 'Windows'
shell: bash
run: >-
cmake -S src/sampsharp-component -B build/cmake/component
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.0
- name: Configure Windows build
if: runner.os == 'Windows'
shell: pwsh
run: >-
cmake -S src/sampsharp-component -B build/cmake/component
-A ${{ matrix.cmake_arch }}
- name: Build component
run: cmake --build build/cmake/component --config RelWithDebInfo --parallel
- name: Verify and stage component
shell: bash
env:
PLATFORM: ${{ matrix.platform }}
ARCH: ${{ matrix.arch }}
run: |
mkdir -p native-dist
component=$(find build/cmake/component/artifacts -maxdepth 1 -type f \
\( -name 'SampSharp.so' -o -name 'SampSharp.dll' -o -name 'SampSharp.dylib' \) \
-print -quit)
test -n "$component"
if [[ "$PLATFORM" == macos ]]; then
codesign --force --sign - --timestamp=none "$component"
codesign --verify --strict "$component"
fi
cp "$component" native-dist/
printf '{"platform":"%s","arch":"%s","source":"%s"}\n' \
"$PLATFORM" "$ARCH" "$(git rev-parse HEAD)" > native-dist/build-info.json
- uses: actions/upload-artifact@v7
with:
name: sampsharp-component-${{ matrix.platform }}-${{ matrix.arch }}
path: native-dist/
if-no-files-found: error
retention-days: ${{ github.event_name == 'pull_request' && 14 || 30 }}