-
-
Notifications
You must be signed in to change notification settings - Fork 38
161 lines (142 loc) · 4.8 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
name: CI
on: [push]
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
cargo-release:
if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-test')
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
- name: Install cargo release command
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-release
- name: Run cargo login
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CARGO_TOKEN }}
- name: Publish crates
uses: actions-rs/cargo@v1
with:
command: release
args: --no-dev-version --skip-push --skip-tag --no-confirm
github-release:
if: startsWith(github.ref, 'refs/tags/')
needs: [test]
strategy:
matrix:
target:
# Linux build notes:
# While musl targets are not as supported as gnu, those are most relevant to users,
# which want to download binaries from github, as glibc has compatibility issues
# with older distros
# Tier 1
- i686-pc-windows-msvc
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
# Tier 2
- aarch64-apple-darwin
- aarch64-unknown-linux-musl
- i686-unknown-linux-musl
- x86_64-unknown-linux-musl
include:
# Linux
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
bin: jrsonnet
name: jrsonnet-linux-aarch64
- target: i686-unknown-linux-musl
os: ubuntu-latest
bin: jrsonnet
name: jrsonnet-linux-i686
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
bin: jrsonnet
name: jrsonnet-linux-amd64
# Windows
- target: i686-pc-windows-msvc
os: windows-latest
bin: jrsonnet.exe
name: jrsonnet-windows-i686.exe
- target: x86_64-pc-windows-msvc
os: windows-latest
bin: jrsonnet.exe
name: jrsonnet-windows-amd64.exe
# Apple
- target: aarch64-apple-darwin
os: macOS-latest
bin: jrsonnet
name: jrsonnet-darwin-aarch64
- target: x86_64-apple-darwin
os: macOS-latest
bin: jrsonnet
name: jrsonnet-darwin-amd64
runs-on: ${{ matrix.os }}
steps:
- name: Fetch apt repo updates
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
run: sudo apt update
- uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
with:
target: ${{ matrix.target }}
- name: Checkout
uses: actions/checkout@v2
- name: Add experimental flags
if: ${{ endsWith(github.ref, '-test' )}}
run: echo 'EXPERIMENTAL_FLAGS=--features=experimental' >> $GITHUB_ENV
- name: Linux x86 cross compiler
if: ${{ startsWith(matrix.target, 'i686-unknown-linux-') }}
run: sudo apt install gcc-multilib
- name: ARM cross compiler
if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
uses: actions-rs/cargo@v1
with:
command: install
args: cross
- name: ARM gcc
if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
run: sudo apt install gcc-aarch64-linux-gnu
- name: Musl gcc
if: ${{ endsWith(matrix.target, '-musl') }}
run: sudo apt install musl musl-tools
- name: Run cross build
if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
shell: bash
run: cross build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
- name: Run build
if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}
uses: actions-rs/cargo@v1
with:
command: build
args: --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
- name: Package
shell: bash
run: |
cd target/${{ matrix.target }}/release
cp ${{ matrix.bin }} ../../../${{ matrix.name }}
cd -
- name: Generate SHA-256
run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256
- name: Publish
uses: softprops/action-gh-release@v1
with:
draft: true
files: "jrsonnet*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}