-
Notifications
You must be signed in to change notification settings - Fork 2
165 lines (142 loc) · 4.36 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Windows
on:
workflow_dispatch:
push:
paths:
- '**'
- 'examples/**'
- '.github/workflows/windows.yml'
branches: [ "main", "dev" ]
pull_request:
paths:
- '**'
- 'examples/**'
- '.github/workflows/windows.yml'
branches: [ "main", "dev" ]
release:
types: [published]
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: windows-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
compiler: [mingw-w64, msvc16]
bits: [64]
include:
- compiler: mingw-w64
bits: 64
ARCH: "x86_64"
WINDRES_ARCH: pe-x86-64
- compiler: msvc16
bits: 64
ARCH: "x86_64"
WINDRES_ARCH: pe-x86-64
env:
RELEASE_NAME: sili-dev_win${{ matrix.bits }}_${{ matrix.compiler }}
GNUTARGET: default
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "RELEASE_NAME=sili-${{ github.event.release.tag_name }}_win${{ matrix.bits }}_${{ matrix.compiler }}" >> $GITHUB_ENV
shell: cmd
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
dir
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
cd ../../../sili
# Setup MSBuild.exe path if required
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
if: matrix.compiler == 'msvc16'
- name: Add MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Build app for release
run: |
set "vs_path=%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
- name: Tests (MinGW-w64 64-bit)
run: |
make compile_tests CC=${{ matrix.ARCH }}-w64-mingw32-gcc
shell: cmd
if: |
matrix.compiler == 'mingw-w64' &&
matrix.bits == 64
- name: Tests (MSVC16 64-bit)
run: |
make compile_tests CC=cl.exe
shell: cmd
if: |
matrix.compiler == 'msvc16' &&
matrix.bits == 64
- name: Examples (MinGW-w64 64-bit)
run: |
make compile_examples CC=${{ matrix.ARCH }}-w64-mingw32-gcc
shell: cmd
if: |
matrix.compiler == 'mingw-w64' &&
matrix.bits == 64
- name: Examples (MSVC16 64-bit)
run: |
make compile_examples CC=cl.exe
shell: cmd
if: |
matrix.compiler == 'msvc16' &&
matrix.bits == 64
- name: Build Library (MSVC16 64-bit)
run: |
windres.exe --version
make static CC=cl.exe AR=lib
make dynamic CC=cl.exe
copy /Y .\build\libsili.dll .\build\${{ env.RELEASE_NAME }}\lib
shell: cmd
if: |
matrix.compiler == 'msvc16' &&
matrix.bits == 64
- name: Build Library (MinGW-w64 64-bit)
run: |
${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version
windres.exe --version
dir C:\msys64\mingw64\bin
make static CC=${{ matrix.ARCH }}-w64-mingw32-gcc
make dynamic CC=${{ matrix.ARCH }}-w64-mingw32-gcc
copy /Y .\build\libsili.dll .\build\${{ env.RELEASE_NAME }}\lib
shell: cmd
if: |
matrix.compiler == 'mingw-w64' &&
matrix.bits == 64
- name: Generate Artifacts
run: |
copy /Y .\sili.h .\build\${{ env.RELEASE_NAME }}\include
xcopy .\deps .\build\${{ env.RELEASE_NAME }}\include /E /I /Y
copy /Y .\libsili.a .\build\${{ env.RELEASE_NAME }}\lib
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
cd build
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
dir
shell: cmd
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_NAME }}.zip
path: ./build/${{ env.RELEASE_NAME }}.zip
- name: Upload Artifact to Release
uses: softprops/action-gh-release@v1
with:
files: ./build/${{ env.RELEASE_NAME }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'release' && github.event.action == 'published'