-
Notifications
You must be signed in to change notification settings - Fork 1
193 lines (166 loc) · 5.52 KB
/
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
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Release
on:
push:
tags:
- 'v*'
env:
PROJECT_NAME: "nmbuflowtorch"
BUILD_TYPE: Release
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC",
artifact_ext: '.zip',
os: windows-latest,
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
}
- {
name: "Ubuntu Latest GCC",
artifact_ext: '.tar.gz',
os: ubuntu-latest,
cc: "gcc",
cxx: "g++",
}
- {
name: "macOS Latest Clang",
artifact_ext: '.tar.gz',
os: macos-latest,
cc: "clang",
cxx: "clang++",
}
steps:
- name: set version name (Windows)
id: version_win
if: ${{ runner.os == 'Windows' }}
run: |
$TAG = (${env:GITHUB_REF} -replace 'refs/tags/', '')
echo "::set-output name=name::$TAG"
- name: set version name
id: version
if: ${{ runner.os != 'Windows' }}
run: echo ::set-output name=name::${GITHUB_REF#refs/tags/}
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: cache dependencies
uses: actions/cache@v2
id: cache
with:
path: ${{ github.HOME }}/.local
key: ${{ runner.os }}-dependencies
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: install GoogleTest
if: ${{ steps.cache.output.cache-hit != 'true' }}
run: |
cd ..
git clone https://github.com/google/googletest.git --branch release-1.10.0
cd googletest
cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/.local" -Dgtest_force_shared_crt=1
cmake --build build --config Release
cmake --build build --target install --config Release
cd ../nmbuflowtorch
- name: configure
run: cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/.local"
- name: build
run: cmake --build build --config "$env:BUILD_TYPE" -j4
- name: run tests
run: |
cd build
ctest -C "$env:BUILD_TYPE" -VV
# for a release not containing directly the source code, replace the files archived
# with the actual files needed (i.e. *.lib/*.a and *.h(pp))
- name: generate archive (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
rmdir -r -fo build
7z a -tzip $HOME/artifact.zip *
- name: generate archive
if: ${{ runner.os != 'Windows' }}
run: |
rm -rf build
tar -cvzf $HOME/artifact.tar.gz .
- name: upload artifacts
uses: actions/upload-artifact@v2
if: ${{ runner.os == 'Windows' }}
with:
name: ${{ runner.os }}-${{ steps.version_win.outputs.name }}
path: '~/artifact.*'
- name: upload artifacts
uses: actions/upload-artifact@v2
if: ${{ runner.os != 'Windows' }}
with:
name: ${{ runner.os }}-${{ steps.version.outputs.name }}
path: '~/artifact.*'
release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: set version name
id: version
run: echo ::set-output name=name::${GITHUB_REF#refs/tags/}
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.version.outputs.name }}
# if needed, you can set the release body here
#body: "Release notes"
draft: false
prerelease: false
- name: download artifact
uses: actions/download-artifact@v2
with:
name: "Linux-${{ steps.version.outputs.name }}"
path: ./
- name: upload ubuntu release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifact.tar.gz"
asset_name: "${{ env.PROJECT_NAME }}-Linux-${{ steps.version.outputs.name }}.tar.gz"
asset_content_type: application/x-tar
- name: download artifact
uses: actions/download-artifact@v2
with:
name: "Windows-${{ steps.version.outputs.name }}"
path: ./
- name: upload windows release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifact.zip"
asset_name: "${{ env.PROJECT_NAME }}-Windows-${{ steps.version.outputs.name }}.zip"
asset_content_type: application/zip
- name: download artifact
uses: actions/download-artifact@v2
with:
name: "macOS-${{ steps.version.outputs.name }}"
path: ./
- name: upload macos release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "./artifact.tar.gz"
asset_name: "${{ env.PROJECT_NAME }}-macOS-${{ steps.version.outputs.name }}.tar.gz"
asset_content_type: application/x-tar