-
Notifications
You must be signed in to change notification settings - Fork 6
147 lines (124 loc) · 3.89 KB
/
windows.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
name: Windows
on:
push:
branches: [modernize]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
build:
runs-on: windows-latest
permissions:
contents: read
outputs:
is_release: ${{ steps.export.outputs.is_release }}
git_describe: ${{ steps.export.outputs.git_describe }}
strategy:
#fail-fast: false
matrix:
include:
- name: Windows x64
platform: x64
arch: amd64
preset: windows-x64-release
- name: Windows x64-avx2
platform: x64
arch: amd64
name_postfix: "-avx2"
preset: windows-x64-avx2-release
- name: Windows x86
platform: x86
arch: amd64_x86
preset: windows-x86-release
- name: Windows ARM64
platform: arm64
arch: amd64_arm64
preset: windows-arm64-release
steps:
- name: Fetch repo
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Get cmake and ninja
uses: lukka/get-cmake@latest
- name: Find MSVC (on Windows)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.arch}}
- name: Export Environment
id: export
shell: pwsh
run: .\.github\scripts\windows-environment.ps1 '${{matrix.platform}}${{matrix.name_postfix}}'
- name: Restore artifacts, or setup vcpkg (do not install any package)
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: external/vcpkg/vcpkg
vcpkgJsonGlob: external/vcpkg/config/vcpkg.json
prependedCacheKey: "Windows/${{ matrix.platform }}${{ matrix.name_postfix }}"
- name: Configure
shell: cmd
run: |
cmake -G Ninja --preset "${{matrix.preset}}" "-DTARGET_MSI_NAME=%PROJECT_OUTPUT_NAME%" -S "%PROJECT_SOURCE%" -B "${{env.PROJECT_BUILD}}"
- name: Compile
shell: cmd
working-directory: "${{ env.PROJECT_BUILD }}"
run: |
cmake --build .
- name: Block cache on failure
if: ${{ failure() || cancelled() }}
shell: bash
run: echo "RUNVCPKG_NO_CACHE=1" >> $GITHUB_ENV
- name: Test
shell: cmd
if: matrix.platform != 'arm64'
working-directory: "${{ env.PROJECT_BUILD }}"
run: |
cmake --build . --target test
- name: Build Installer
shell: cmd
working-directory: "${{ env.PROJECT_BUILD }}"
run: |
cpack -G ZIP -v
- name: Upload Binaries Artifact
uses: actions/upload-artifact@v4
with:
name: ${{env.PROJECT_ZIP_NAME}}
path: ${{env.PROJECT_ZIP}}
#- name: Upload Installer Artifact
#uses: actions/upload-artifact@v4
#with:
#name: Setup ${{env.PROJECT_OUTPUT_NAME}}
#path: ${{env.PROJECT_INSTALLER}}
release:
needs: build
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Collect artifacts
uses: actions/download-artifact@v4
with:
path: .
- name: Create Prerelease
if: contains(github.ref, 'modernize')
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: latest-windows
title: "Latest CI/canary Windows dunelegacy ${{needs.build.outputs.git_describe}}"
draft: false
prerelease: true
files: |
**/*.zip
- name: Create Release
if: needs.build.outputs.is_release == 'True'
uses: softprops/action-gh-release@v1
with:
name: "Windows dunelegacy ${{needs.build.outputs.git_describe}}"
files: |
**/*.zip
draft: true
prerelease: false