-
Notifications
You must be signed in to change notification settings - Fork 2
163 lines (141 loc) · 5.31 KB
/
.ci.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
name: CI Build Matrix
on:
push:
tags:
- "*"
branches:
- "*"
pull_request:
env:
REPO_NAME: tennisbowling/openexecution
jobs:
build:
name: Build Release
strategy:
matrix:
arch: [x86_64-unknown-linux-gnu,
x86_64-apple-darwin,
x86_64-windows]
include:
- arch: x86_64-unknown-linux-gnu
platform: ubuntu-latest
- arch: x86_64-apple-darwin
platform: macos-latest
- arch: x86_64-windows
platform: windows-2019
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Build toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
# ==============================
# Windows dependencies
# ==============================
- uses: KyleMayes/install-llvm-action@v1
if: startsWith(matrix.arch, 'x86_64-windows')
with:
version: "13.0"
directory: ${{ runner.temp }}/llvm
- name: Set LIBCLANG_PATH
if: startsWith(matrix.arch, 'x86_64-windows')
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
# run tests
- name: Run tests
run: cargo test --all
# ==============================
# Build
# ==============================
- name: Build EB for x86_64-unknown-linux-gnu
if: matrix.arch == 'x86_64-unknown-linux-gnu'
run: cargo install --path . --force --locked --profile highperf
- name: Build EB for x86_64-apple-darwin
if: matrix.arch == 'x86_64-apple-darwin'
run: cargo install --path . --force --locked --profile highperf
- name: Build EB for Windows
if: matrix.arch == 'x86_64-windows'
run: cargo install --path . --force --locked --profile highperf
- name: Zip binary
if: startsWith(matrix.arch, 'x86_64-windows') != true
run: |
mkdir artifacts
mv ~/.cargo/bin/openexecution ./artifacts
cd artifacts
tar -czf openexecution-${{ github.ref_name }}-${{ matrix.arch }}.tar.gz openexecution
mv *.tar.gz ..
- name: Zip binary Windows
if: startsWith(matrix.arch, 'x86_64-windows')
run: |
mkdir artifacts
move $env:USERPROFILE/.cargo/bin/openexecution.exe ./artifacts
cd artifacts
tar -czf openexecution-${{ github.ref_name }}-${{ matrix.arch }}.tar.gz openexecution.exe
move *tar.gz ..
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: openexecution-${{ github.ref_name }}-${{ matrix.arch }}.tar.gz
path: openexecution-${{ github.ref_name }}-${{ matrix.arch }}.tar.gz
release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.read_changelog.outputs.changelog }}
draft: false
prerelease: false
- name: Store Release url
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
- uses: actions/upload-artifact@v2
with:
path: ./upload_url
name: upload_url
publish:
if: contains(github.ref, 'tags/v')
name: ${{ matrix.config.name }}
strategy:
matrix:
arch: [x86_64-unknown-linux-gnu,
x86_64-apple-darwin,
x86_64-windows]
runs-on: ubuntu-latest
needs: release
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: openexecution-${{ github.ref_name }}-${{ matrix.arch }}.tar.gz
path: ./
- name: Download URL
uses: actions/download-artifact@v2
with:
name: upload_url
path: ./
- id: set_upload_url
run: |
upload_url=`cat ./upload_url`
echo ::set-output name=upload_url::$upload_url
ls
- name: Upload to Release
id: upload_to_release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: ./openexecution-${{ github.ref_name }}-${{ matrix.arch }}.tar.gz
asset_name: openexecution-${{ github.ref_name }}-${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip