-
Notifications
You must be signed in to change notification settings - Fork 11
158 lines (134 loc) · 6.02 KB
/
ci.yml
File metadata and controls
158 lines (134 loc) · 6.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
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
name: CI
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 5 1 * *'
jobs:
build:
name: ${{ matrix.arch }}-${{ matrix.type }}
runs-on: ${{ contains(matrix.arch, 'arm64') && 'windows-11-arm' || 'windows-2025' }}
# don't run pull requests from local branches twice
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
arch: [x64, arm64]
type: [Debug, Release]
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: MSYS
# make Windows packages like Clang available in MSYS
path-type: inherit
# install MSYS packages
install: make autoconf automake libtool pkg-config
- name: Remove Perl Strawberry installation
# C:\Strawberry contains various MinGW libraries and binaries like pkg-config
# that can get picked up by configure/CMake and don't necessarily behave
# correctly when not using a MinGW environment, and more specifically we cannot
# use MinGW gmake but must use MSYS make for correctly handling of Windows paths,
# so we delete everything that could mess up our builds
run: rmdir /S /Q C:\Strawberry
- name: Install Winget (arm64)
if: contains(matrix.arch, 'arm64')
run: |
function Install-AppxWithRetry($path) {
$maxAttempts = 5
for ($attempt = 1; $attempt -le $maxAttempts; $attempt++) {
try {
Add-AppxPackage -Path $path -ForceApplicationShutdown -ErrorAction Stop
return
} catch {
if ($attempt -eq $maxAttempts) {
throw
}
Write-Warning "Add-AppxPackage failed (attempt $attempt/$maxAttempts): $($_.Exception.Message)"
Start-Sleep -Seconds 5
}
}
}
$tempDir = Join-Path $env:TEMP "WingetDependencies"
$zipFilePath = Join-Path $env:TEMP "DesktopAppInstaller_Dependencies.zip"
$archDepsDir = Join-Path $tempDir "${{ matrix.arch }}" # Path to the arm64 or x64 folder inside the unzipped content
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
Write-Host "Downloading DesktopAppInstaller_Dependencies.zip to $zipFilePath..."
try {
Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.12.460/DesktopAppInstaller_Dependencies.zip -OutFile $zipFilePath -TimeoutSec 300
} catch {
Write-Error "Failed to download DesktopAppInstaller_Dependencies.zip: $($_.Exception.Message)"
exit 1
}
Write-Host "Extracting dependencies to $tempDir..."
try {
Expand-Archive -Path $zipFilePath -DestinationPath $tempDir -Force
} catch {
Write-Error "Failed to extract zip file: $($_.Exception.Message)"
exit 1
}
Write-Host "Installing dependencies from $archDepsDir..."
try {
# Get all .appx files in the arm64 directory
$appXFiles = Get-ChildItem -Path $archDepsDir -Filter "*.appx" -Recurse | Select-Object -ExpandProperty FullName
if ($appXFiles.Count -eq 0) {
Write-Warning "No .appx files found in $archDepsDir. This might indicate an issue with the downloaded package or path."
} else {
foreach ($appxFile in $appXFiles) {
Write-Host "Installing $appxFile..."
Install-AppxWithRetry $appxFile
}
}
} catch {
Write-Error "Failed to install AppX packages: $($_.Exception.Message)"
exit 1
}
Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.12.460/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile $env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Install-AppxWithRetry $env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
shell: pwsh
- name: Install Dependencies
run: |
winget install --accept-source-agreements --accept-package-agreements --source winget Ninja-build.Ninja ${{ matrix.arch == 'arm64' && '--architecture arm64' || '' }}
winget install --accept-source-agreements --accept-package-agreements --source winget NASM
- name: Install LLVM
if: contains(matrix.arch, 'arm64')
run: |
winget install --accept-source-agreements --accept-package-agreements LLVM.LLVM --architecture arm64
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build toolchain
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
:: use msys2.cmd from setup-msys2 as Bash shell, as it doesn't have msys2_shell.cmd used normally by build.bat
set "BASH=msys2 -c"
build.bat --type ${{ matrix.type }}
- name: Package release
run: |
tar -a -cf GNUstep-Windows-MSVC-${{matrix.arch}}-${{matrix.type}}.zip C:\GNUstep\${{matrix.arch}}\${{matrix.type}}
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
path: GNUstep-Windows-MSVC-${{matrix.arch}}-${{matrix.type}}.zip
name: GNUstep-Windows-MSVC-${{matrix.arch}}-${{matrix.type}}
prerelease:
needs: build
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Update GitHub prerelease
if: ${{ github.ref == 'refs/heads/master' }}
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: latest
prerelease: true
title: "Latest Build"
files: "**/GNUstep-Windows-MSVC-*.zip"