-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (143 loc) · 5 KB
/
rust.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
on:
push:
branches:
- master
tags:
- "*"
env:
WIN64_TRIPLET: "x86_64-pc-windows-msvc"
LINUX64_TRIPLET: "x86_64-unknown-linux-musl"
MAC64_TRIPLET: "x86_64-apple-darwin"
jobs:
build:
strategy:
matrix:
os:
- "windows-2019"
- "ubuntu-18.04"
- "macos-latest"
binname:
- "lsx"
- "lsx.exe"
triplet:
- "x86_64-pc-windows-msvc"
- "x86_64-unknown-linux-musl"
- "x86_64-apple-darwin"
exclude:
- os: "windows-2019"
binname: "lsx"
- os: "ubuntu-18.04"
binname: "lsx.exe"
- os: "macos-latest"
binname: "lsx.exe"
- os: "windows-2019"
triplet: "x86_64-unknown-linux-musl"
- os: "windows-2019"
triplet: "x86_64-apple-darwin"
- os: "ubuntu-18.04"
triplet: "x86_64-pc-windows-msvc"
- os: "ubuntu-18.04"
triplet: "x86_64-apple-darwin"
- os: "macos-latest"
triplet: "x86_64-pc-windows-msvc"
- os: "macos-latest"
triplet: "x86_64-unknown-linux-musl"
runs-on: "${{ matrix.os }}"
name: "build binary"
steps:
- name: "installing musl tools"
run: "sudo apt-get install -y musl-dev musl-tools"
if: matrix.os == 'ubuntu-18.04'
- name: "checkout-repo"
uses: "actions/checkout@v2"
- name: "ensure toolchain"
run: rustup target add ${{ matrix.triplet }}
- name: "build-release-binary"
run: cargo build --release --target=${{ matrix.triplet }}
- name: "strip-binary"
run: "strip target/${{ matrix.triplet }}/release/${{ matrix.binname }}"
if: matrix.os == 'ubuntu-18.04'
- name: "collect-binary"
uses: "actions/upload-artifact@v1"
with:
name: "bin-${{ matrix.triplet }}"
path: "target/${{ matrix.triplet }}/release/${{ matrix.binname }}"
- name: "collect-pdb"
uses: "actions/upload-artifact@v1"
with:
name: "pdb-${{ matrix.triplet }}"
path: "target/${{matrix.triplet}}/release/lsx.pdb"
if: matrix.os == 'windows-2019'
release:
runs-on: "ubuntu-18.04"
name: "release binary"
if: startsWith(github.ref, 'refs/tags')
needs: build
steps:
- uses: actions/checkout@v2
- name: "downloading windows binary"
uses: actions/download-artifact@v1
with:
name: "bin-${{ env.WIN64_TRIPLET }}"
path: "bin-${{ env.WIN64_TRIPLET }}"
- name: "downloading windows pdb"
uses: actions/download-artifact@v1
with:
name: "pdb-${{ env.WIN64_TRIPLET }}"
path: "pdb-${{ env.WIN64_TRIPLET }}"
- name: "downloading linux binary"
uses: actions/download-artifact@v1
with:
name: "bin-${{ env.LINUX64_TRIPLET }}"
path: "bin-${{ env.LINUX64_TRIPLET }}"
- name: "downloading mac binary"
uses: actions/download-artifact@v1
with:
name: "bin-${{ env.MAC64_TRIPLET }}"
path: "bin-${{ env.MAC64_TRIPLET }}"
- name: "creating github release"
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
draft: true
prerelease: false
release_name: "Release ${{github.ref}}"
tag_name: "${{github.ref}}"
- name: "uploading 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: "bin-${{ env.WIN64_TRIPLET }}/lsx.exe"
asset_name: lsx.exe-${{ env.WIN64_TRIPLET }}
asset_content_type: application/octet-binary
- name: "uploading windows pdb 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: "pdb-${{ env.WIN64_TRIPLET }}/lsx.pdb"
asset_name: lsx.pdb
asset_content_type: application/octet-binary
- name: "uploading linux 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: "bin-${{ env.LINUX64_TRIPLET }}/lsx"
asset_name: lsx-${{ env.LINUX64_TRIPLET }}
asset_content_type: application/octet-binary
- name: "uploading mac 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: "bin-${{ env.MAC64_TRIPLET }}/lsx"
asset_name: lsx-${{ env.MAC64_TRIPLET }}
asset_content_type: application/octet-binary