-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (100 loc) · 3.22 KB
/
cmake-release.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
name: CMake-release
on:
push:
tags:
- 'v*'
env:
BUILD_TYPE: Release
permissions:
contents: read
actions: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
instructions:
- avx
- avx2
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup MinGW
if: matrix.os == 'windows-latest'
run: |
choco install mingw -y -libwinpthread
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Configure CMake
run: |
if ("${{ matrix.os }}" -eq "windows-latest") {
$env:PATH += ";C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin"
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DAVX2=${{ matrix.instructions == 'avx2' && 'ON' || 'OFF' }} -G "MinGW Makefiles"
} else {
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DAVX2=${{ matrix.instructions == 'avx2' && 'ON' || 'OFF' }}
}
shell: pwsh
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
- name: Prepare binary
run: |
if ("${{ matrix.instructions }}" -eq "avx"){
if ("${{ matrix.os }}" -eq "windows-latest") {
cp ${{github.workspace}}\build\bin\chat.exe chat.exe
mv chat.exe chat-windows-latest-avx.exe
} else {
cp ${{github.workspace}}/build/bin/chat chat
mv chat chat-${{ matrix.os }}-${{ matrix.instructions }}
}
} else {
if ("${{ matrix.os }}" -eq "windows-latest") {
cp ${{github.workspace}}\build\bin\chat.exe chat.exe
mv chat.exe chat-windows-latest-avx2.exe
} else {
cp ${{github.workspace}}/build/bin/chat chat
mv chat chat-${{ matrix.os }}-${{ matrix.instructions }}
}
}
shell: pwsh
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: chat-${{ matrix.os }}-${{ matrix.instructions }}
path: chat-${{ matrix.os }}-${{ matrix.instructions }}*
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_KEY }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Upload artifacts
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_KEY }}
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
files: |
artifacts/**/*