-
-
Notifications
You must be signed in to change notification settings - Fork 4
187 lines (158 loc) · 5.89 KB
/
build.yml
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
178
179
180
181
182
183
184
185
186
187
###############################################################################
#
# Copyright 2024 Eppie(https://eppie.io)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###############################################################################
---
name: "Build solution"
run-name: >-
${{ github.event_name == 'schedule' && 'Build All' || '' }}
${{ github.event_name == 'workflow_dispatch' && format('Build: {0} ({1}) on {2} OS', github.event.inputs.framework, github.event.inputs.configuration, github.event.inputs.os ) || '' }}
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
framework:
type: choice
default: all
options:
- desktop
- wasm
- winui
- ios
- macos
- android
- uwp
- all
os:
type: choice
default: all
options:
- windows
- linux
- macos
- all
configuration:
type: choice
default: release
options:
- debug
- release
push:
branches:
- main
- release/**
pull_request:
branches:
- main
- release/**
schedule:
- cron: '0 0 * * *'
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build-config.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Initializing config keywords
shell: bash
run: |
keywords="autobuild"
if [[ ${{ github.event_name }} == 'schedule' ]]; then
keywords="all"
elif [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
keywords="${{ github.event.inputs.framework }},${{ github.event.inputs.os }}"
fi
echo "EPPIE_BUILD_CONFIG_KEYWORDS=$keywords" >> $GITHUB_ENV
- name: Select Build config
id: build-config
uses: finebits/github-actions/toolset/select-configuration@4a126d80a11c5fdc83ce884d3d23dffb30bc4495 # v2.0.0
with:
json-file: ./.github/configurations/build.json
keywords: ${{ env.EPPIE_BUILD_CONFIG_KEYWORDS }}
- name: Check configs
shell: bash
run: |
length=$( echo '${{ steps.build-config.outputs.config-json }}' | jq '. | length' )
if(( $length == 0 )); then
echo "::error::No suitable build configuration found"
exit 1
fi
build:
name: ${{ matrix.build.framework }} ${{ matrix.os }} '${{ matrix.build.project }}'
needs: prepare
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- name: Initializing configuration
shell: bash
run: |
configuration="${{ matrix.build.configuration }}"
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
configuration="${{ github.event.inputs.configuration }}"
fi
echo "EPPIE_BUILD_CONFIGURATION=$configuration" >> $GITHUB_ENV
- name: Support longpaths
if: ${{ runner.os == 'Windows'}}
run: git config --system core.longpaths true
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
submodules: recursive
- name: Install Prerequisites
uses: ./.github/actions/install-prerequisites
with:
uno-platform: ${{ matrix.prerequisites.uno-platform == 'true' }}
msbuild: ${{ matrix.prerequisites.msbuild == 'true' }}
- name: Restore via dotnet
if: matrix.restore.tool == 'dotnet'
shell: bash
run: |
project='${{ matrix.restore.project }}'
extra_options='${{ matrix.restore.extra }}'
dotnet restore $extra_options $project
- name: Restore via msbuild
if: matrix.restore.tool == 'msbuild' && runner.os == 'Windows'
shell: pwsh
run: |
$project='${{ matrix.restore.project }}'
$extra_options=$('${{ matrix.restore.extra }}' -split '\s+')
msbuild -target:Restore $extra_options $project
- name: Build via dotnet (${{ env.EPPIE_BUILD_CONFIGURATION }})
if: matrix.build.tool == 'dotnet'
shell: bash
run: |
project='${{ matrix.build.project }}'
configuration='${{ env.EPPIE_BUILD_CONFIGURATION }}'
extra_options='${{ matrix.build.extra }}'
framework='${{ matrix.build.framework }}'
framework_option=$([ "$framework" != "" ] && echo "--framework=$framework" || echo "")
dotnet build --configuration=$configuration $framework_option $extra_options $project
- name: Build via msbuild (${{ env.EPPIE_BUILD_CONFIGURATION }})
if: matrix.build.tool == 'msbuild' && runner.os == 'Windows'
shell: pwsh
run: |
$project='${{ matrix.build.project }}'
$configuration='${{ env.EPPIE_BUILD_CONFIGURATION }}'
$extra_options=$('${{ matrix.build.extra }}' -split '\s+')
$framework='${{ matrix.build.framework }}'
$framework_option=$( if($framework) {"-property:TargetFramework=$framework"} else {""} )
msbuild -target:Build -property:Configuration=$configuration $framework_option $extra_options $project