-
Notifications
You must be signed in to change notification settings - Fork 2
154 lines (126 loc) · 5.07 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
name: build
on:
push:
branches-ignore:
- 'develop'
- 'master'
- 'unkotim'
tags:
- 'tim*'
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:
jobs:
build:
strategy:
matrix:
arch: ['x86', 'x64']
simd: ['sse42', 'avx', 'avx2', 'avx512']
runs-on: windows-latest
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v3
with:
path: timidity41
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
shell: bash
working-directory: timidity41
- name: Run "git describe"
run: echo "TIM41_DESCRIBE=$(git describe --first-parent)" >> $GITHUB_ENV
shell: bash
working-directory: timidity41
- name: Cache toolchain (x86)
id: cache-toolchain-mingw32
if: ${{ matrix.arch == 'x86' }}
uses: actions/cache@v3
with:
path: mingw32
key: v2023-08-08/gcc-13.2.0_i686-win32-dwarf-ucrt
- name: Install toolchain (x86)
if: ${{ matrix.arch == 'x86' && steps.cache-toolchain-mingw32.outputs.cache-hit != 'true' }}
run: |
curl.exe -L -O https://github.com/starg2/mingw64-builds-GHA/releases/download/v2023-08-08/gcc-13.2.0_i686-win32-dwarf-ucrt.zip
7z e gcc-13.2.0_i686-win32-dwarf-ucrt.zip i686-13.2.0-release-win32-dwarf-ucrt-rt_v12.7z
7z x i686-13.2.0-release-win32-dwarf-ucrt-rt_v12.7z
- name: Cache toolchain (x64)
id: cache-toolchain-mingw64
if: ${{ matrix.arch == 'x64' }}
uses: actions/cache@v3
with:
path: mingw64
key: v2023-08-08/gcc-13.2.0_x86_64-win32-seh-ucrt
- name: Install toolchain (x64)
if: ${{ matrix.arch == 'x64' && steps.cache-toolchain-mingw64.outputs.cache-hit != 'true' }}
run: |
curl.exe -L -O https://github.com/starg2/mingw64-builds-GHA/releases/download/v2023-08-08/gcc-13.2.0_x86_64-win32-seh-ucrt.zip
7z e gcc-13.2.0_x86_64-win32-seh-ucrt.zip x86_64-13.2.0-release-win32-seh-ucrt-rt_v12.7z
7z x x86_64-13.2.0-release-win32-seh-ucrt-rt_v12.7z
- name: Set Toolchain Path
run: |
"TOOLCHAINDIR=$($env:GITHUB_WORKSPACE -replace '\\', '/')/$(if ('${{ matrix.arch }}' -eq 'x86') { 'mingw32' } else { 'mingw64' })" >> $env:GITHUB_ENV
"TOOLCHAINDIR_W=$env:GITHUB_WORKSPACE\$(if ('${{ matrix.arch }}' -eq 'x86') { 'mingw32' } else { 'mingw64' })" >> $env:GITHUB_ENV
- name: Add PATH
run: |
$vsdir = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
"$vsdir\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin" >> $env:GITHUB_PATH
"$vsdir\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja" >> $env:GITHUB_PATH
"$env:TOOLCHAINDIR_W\bin" >> $env:GITHUB_PATH
- name: Configure
run: >-
cmake
-G Ninja
-DCMAKE_C_COMPILER="$env:TOOLCHAINDIR/bin/gcc.exe"
-DCMAKE_CXX_COMPILER="$env:TOOLCHAINDIR/bin/g++.exe"
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX="$($env:GITHUB_WORKSPACE -replace '\\', '/')/timidity41/inst"
-DTIM41_X86_SIMD_LEVEL="$('${{ matrix.simd }}'.ToUpperInvariant())"
-S timidity41
-B timidity41/build
- name: Build
run: ninja -C timidity41\build
- name: Install
run: ninja -C timidity41\build install
- name: Install runtime DLLs
run: >-
robocopy
"$env:TOOLCHAINDIR_W\bin"
timidity41\inst\bin
libgcc_s*.dll libstdc++*.dll
; if ($LASTEXITCODE -le 1) { $LASTEXITCODE = 0 }
- name: Create release archive
run: |
robocopy timidity41\inst "$env:TIM41_DESCRIBE-${{ matrix.arch }}-${{ matrix.simd }}" /E /XD lib; if ($LASTEXITCODE -le 1) { $LASTEXITCODE = 0 }
robocopy "$env:TOOLCHAINDIR_W\licenses\mingw-w64" "$env:TIM41_DESCRIBE-${{ matrix.arch }}-${{ matrix.simd }}" COPYING.MinGW-w64-runtime.txt; if ($LASTEXITCODE -le 1) { $LASTEXITCODE = 0 }
7z a "$env:TIM41_DESCRIBE-${{ matrix.arch }}-${{ matrix.simd }}.zip" "$env:TIM41_DESCRIBE-${{ matrix.arch }}-${{ matrix.simd }}"
- uses: actions/upload-artifact@v3
with:
name: timidity41-${{ matrix.arch }}-${{ matrix.simd }}
path: ${{ env.TIM41_DESCRIBE }}-${{ matrix.arch }}-${{ matrix.simd }}.zip
release:
if: ${{ startsWith(github.ref, 'refs/tags/tim41') }}
needs: build
runs-on: ubuntu-latest
defaults:
run:
shell: bash
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
with:
path: artifact
- name: Move artifacts
run: mv artifact/timidity41-*/*.zip .
- name: Generate release name
run: echo "RELEASE_NAME=$GITHUB_REF_NAME" | sed 's/tim/TiMidity++ 41 version /' >> $GITHUB_ENV
- uses: softprops/action-gh-release@v1
with:
name: ${{ env.RELEASE_NAME }}
files: '*.zip'