-
Notifications
You must be signed in to change notification settings - Fork 2
116 lines (96 loc) · 3.4 KB
/
build.yml
File metadata and controls
116 lines (96 loc) · 3.4 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
name: Build (Windows)
on:
push:
branches: [ "master", "main" ]
pull_request:
branches: [ "master", "main" ]
workflow_dispatch:
jobs:
build:
# Guard: if this workflow ever gets merged upstream (e.g. HoareLea),
# it will show as "skipped" there and won't break their CI.
if: github.repository_owner == 'SAM-BIM'
runs-on: windows-2022
env:
MSBUILDDISABLENODEREUSE: "1"
ORG_NAME: "SAM-BIM"
# >>> CHANGE THIS PER REPO <<<
# Examples: SAM, SAM_gbXML, SAM_GEM, SAM_Tas, ...
REPO_NAME: "SAM_SQL"
steps:
- name: Checkout this repo
uses: actions/checkout@v4
with:
fetch-depth: 0
path: ${{ env.REPO_NAME }}
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x"
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Clone dependency repos (siblings)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$org = '${{ env.ORG_NAME }}'
$repo = '${{ env.REPO_NAME }}'
# >>> ADJUST BUILD ORDER HERE IF NEEDED <<<
# Keep the current repo LAST.
$buildOrder = @(
'SAM'
$repo
)
# Clone everything except the last one (already checked out by Actions)
$deps = $buildOrder[0..($buildOrder.Count-2)]
foreach ($r in $deps) {
if (Test-Path $r) { continue }
Write-Host "Cloning https://github.com/$org/$r.git"
git clone --depth 1 "https://github.com/$org/$r.git" $r
}
# Ensure ReferencePath exists even before SAM_Windows builds
New-Item -ItemType Directory -Force -Path "SAM_Windows\build" | Out-Null
- name: Restore + Rebuild in order (CI props like SAM_Deploy)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$repo = '${{ env.REPO_NAME }}'
$windowsRef = (Resolve-Path 'SAM_Windows\build').Path
# IMPORTANT: keep these as an ARRAY of args (do NOT join into one string)
$common = @(
'/m:1'
'/nr:false'
'/v:m'
'/p:Configuration=Release'
'/p:UseSharedCompilation=false'
'/p:RunPostBuildEvent=OnOutputUpdated'
"/p:ReferencePath=$windowsRef"
)
# If you really want Platform, use QUOTED Any CPU:
# $common += '/p:Platform="Any CPU"'
# Same build order as above (keep repo LAST)
$buildOrder = @(
'SAM'
$repo
)
# Convert build order -> solution paths (robust: first .sln in each folder)
$solutions = foreach ($r in $buildOrder) {
$sln = Get-ChildItem -Path $r -Filter *.sln -File | Select-Object -First 1
if (-not $sln) { throw "No .sln found under: $r" }
$sln.FullName
}
foreach ($sln in $solutions) {
Write-Host "==> Restore: $sln"
& msbuild $sln /t:Restore @common
}
foreach ($sln in $solutions) {
Write-Host "==> Rebuild: $sln"
& msbuild $sln /t:Rebuild @common
}
- name: Upload build folders (optional)
uses: actions/upload-artifact@v4
with:
name: ${{ env.REPO_NAME }}-build-folders
path: |
**\build\*
if-no-files-found: warn