forked from BeanCheeseBurrito/Flecs.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (153 loc) · 5.97 KB
/
Copy pathci.yml
File metadata and controls
177 lines (153 loc) · 5.97 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: CI
on:
push:
pull_request:
workflow_dispatch:
inputs:
push-packages:
description: 'Push nuget packages'
required: true
default: false
type: boolean
use-auto-generated-version:
description: 'Use auto-generated version'
required: true
default: true
type: boolean
nuget-registry:
description: 'NuGet registry'
required: true
default: 'GitHub'
type: choice
options:
- GitHub
- NuGet
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
packages: write
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Set Version Suffix
shell: bash
run: |
if [ '${{ github.event.inputs.use-auto-generated-version }}' != 'false' ]; then
echo "FlecsVersionSuffix=build.$(git rev-list --count HEAD)" >> $GITHUB_ENV
fi
- name: Setup IOS SDK
if: matrix.os == 'macos-13'
shell: bash
run: |
IOS_SDK=$(xcrun --sdk iphoneos --show-sdk-path)
IOS_SIMULATOR_SDK=$(xcrun --sdk iphonesimulator --show-sdk-path)
echo "IOS_SDK=$IOS_SDK" >> $GITHUB_ENV
echo "IOS_SIMULATOR_SDK=$IOS_SIMULATOR_SDK" >> $GITHUB_ENV
- name: Setup Emscripten SDK
if: matrix.os == 'macos-13'
uses: mymindstorm/setup-emsdk@v14
with:
actions-cache-folder: 'emsdk-cache'
- name: Setup Android NDK
if: matrix.os == 'macos-13'
uses: nttld/setup-ndk@v1
with:
ndk-version: r25c
link-to-sdk: true
- name: Set Android NDK variables
if: matrix.os == 'macos-13'
shell: bash
run: |
echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV
- name: Restore Dependencies
shell: bash
run: dotnet restore
- name: Generate Bindings
shell: bash
run: dotnet run --project src/Flecs.NET.Bindgen
- name: Build Projects
shell: bash
run: |
dotnet build -c Debug
dotnet build -c Release
- name: Build Natives
shell: bash
if: matrix.os == 'macos-13'
working-directory: src/Flecs.NET.Native
run: |
dotnet build -c Debug -r linux-x64
dotnet build -c Debug -r linux-arm64
dotnet build -c Debug -r osx-x64
dotnet build -c Debug -r osx-arm64
dotnet build -c Debug -r win-x64
dotnet build -c Debug -r win-arm64
dotnet build -c Debug -r browser-wasm
dotnet build -c Debug -r iossimulator-x64
dotnet build -c Debug -r iossimulator-arm64
dotnet build -c Debug -r ios-arm64
dotnet build -c Debug -r android-arm64
dotnet build -c Debug -r android-x64
dotnet build -c Release -r linux-x64
dotnet build -c Release -r linux-arm64
dotnet build -c Release -r osx-x64
dotnet build -c Release -r osx-arm64
dotnet build -c Release -r win-x64
dotnet build -c Release -r win-arm64
dotnet build -c Release -r browser-wasm
dotnet build -c Release -r iossimulator-x64
dotnet build -c Release -r iossimulator-arm64
dotnet build -c Release -r ios-arm64
dotnet build -c Release -r android-arm64
dotnet build -c Release -r android-x64
- name: Run Tests
shell: bash
run: dotnet test -p:SkipNatives=true
- name: Pack Nuget Packages
shell: bash
run: |
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix -p:SkipNatives=true -p:BuildSelectorPackage=true
if [ '${{ github.event.inputs.nuget-registry }}' == 'NuGet' ]; then
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix -p:SkipNatives=true -c Debug
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix -p:SkipNatives=true -c Release
else
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix --property:FlecsPackPdb=true -p:SkipNatives=true -c Debug
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix --property:FlecsPackPdb=true -p:SkipNatives=true -c Release
fi
- name: Upload Artifacts
if: matrix.os == 'macos-13'
uses: actions/upload-artifact@v4
with:
name: Nuget Packages
path: |
src/**/Flecs.NET.*.nupkg
src/**/Flecs.NET.*.snupkg
- name: Push NuGet Packages
if: >
matrix.os == 'macos-13' &&
github.repository_owner == 'BeanCheeseBurrito' &&
(
(github.event_name == 'workflow_dispatch' && github.event.inputs.push-packages == 'true') ||
(github.event_name == 'push' && github.ref == 'refs/heads/main')
)
shell: bash
run: |
if [ '${{ github.event_name }}' == 'workflow_dispatch' ]; then
if [ '${{ github.event.inputs.nuget-registry }}' == 'NuGet' ]; then
dotnet nuget push src/**/Flecs.NET.*.nupkg --skip-duplicate --api-key '${{ secrets.NUGET_ACCESS_TOKEN }}' --source 'https://api.nuget.org/v3/index.json'
elif [ '${{ github.event.inputs.nuget-registry }}' == 'GitHub' ]; then
dotnet nuget push src/**/Flecs.NET.*.nupkg --skip-duplicate --api-key '${{ secrets.GITHUB_TOKEN }}' --source 'https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json'
fi
elif [ '${{ github.ref }}' == 'refs/heads/main' ]; then
dotnet nuget push src/**/Flecs.NET.*.nupkg --skip-duplicate --api-key '${{ secrets.GITHUB_TOKEN }}' --source 'https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json'
fi