-
Notifications
You must be signed in to change notification settings - Fork 5
146 lines (120 loc) · 4.18 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
name: Release
on:
push:
tags:
- 'v*.*.*'
env:
TPE_HPO_BIN: 'tpe_hyperparameter_optm'
SERVING_BIN: 'serving'
EVALUATOR_BIN: 'evaluator'
RELEASE_NAME: 'Serenade'
WINDOWS_TARGET: x86_64-pc-windows-msvc.Zip
MACOS_TARGET: x86_64-apple-darwin.tar.gz
LINUX_AMD64_TARGET: x86_64-unknown-linux-musl.tar.gz
LINUX_ARM64_TARGET: aarch64-unknown-linux-musl.tar.gz
jobs:
linuxCI:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
- name: Build
run: cargo build --all --release
- name: Test
run: cargo test
- name: Release binaries
shell: bash
run: |
cd target/release
tar czvf ../../${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }} ${{ env.TPE_HPO_BIN }} ${{ env.SERVING_BIN }} ${{ env.EVALUATOR_BIN }}
cd -
- name: Publish linux release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release crate
uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
macCI:
if: startsWith(github.ref, 'refs/tags/')
runs-on: macos-latest
steps:
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
default: true
override: true
- name: Build
run: cargo build --all --release
- name: Release binaries
shell: bash
run: |
cd target/release
tar czvf ../../${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }} ${{ env.TPE_HPO_BIN }} ${{ env.SERVING_BIN }} ${{ env.EVALUATOR_BIN }}
cd -
- name: Publish mac release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
winCI:
if: startsWith(github.ref, 'refs/tags/')
runs-on: windows-latest
steps:
- name: Install 7Zip PowerShell Module
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose
- id: get_version
uses: battila7/get-version-action@v2
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
- name: Build
run: cargo build --all --release
- name: Release binaries
shell: powershell
run: |
$compress = @{
Path = "D:\a\serenade\serenade\target\release\${{ env.TPE_HPO_BIN }}.exe", "D:\a\serenade\serenade\target\release\${{ env.SERVING_BIN }}.exe", "D:\a\serenade\serenade\target\release\${{ env.EVALUATOR_BIN }}.exe"
CompressionLevel = "Fastest"
DestinationPath = ".\${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.version }}-${{ env.WINDOWS_TARGET }}"
}
Compress-Archive @compress
- name: Publish win release
uses: softprops/action-gh-release@v1
with:
files: .\${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.version }}-${{ env.WINDOWS_TARGET }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}