-
Notifications
You must be signed in to change notification settings - Fork 14
165 lines (139 loc) · 4.59 KB
/
release.yaml
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
name: Release Build
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+*
workflow_dispatch:
env:
SUBWASM_VERSION: 0.16.1
jobs:
checks-and-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
submodules: true
- name: Install Protoc
run: sudo apt -y install protobuf-compiler
- name: Install & display rust toolchain
run: rustup show
- name: Check targets are installed correctly
run: rustup target list --installed
- name: Check all features compilation
run: cargo check --verbose
- name: Run all tests
run: cargo test --verbose
native-linux:
needs: checks-and-tests
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
submodules: true
- name: Install Protoc
run: sudo apt -y install protobuf-compiler
- name: Install & display rust toolchain
run: |
rustup target add aarch64-unknown-linux-gnu
rustup show
- name: Check targets are installed correctly
run: rustup target list --installed
- name: Install zig
uses: korandoru/setup-zig@v1
with:
zig-version: "master"
- name: Install zigbuild
run: cargo install cargo-zigbuild
- name: Build optimized binary
run: |
cargo build --release --target x86_64-unknown-linux-gnu
cargo zigbuild --release --target aarch64-unknown-linux-gnu
- uses: actions/upload-artifact@master
with:
name: swanky-node-ubuntu-latest-x86_64
path: target/x86_64-unknown-linux-gnu/release/swanky-node
- uses: actions/upload-artifact@master
with:
name: swanky-node-ubuntu-latest-aarch64
path: target/aarch64-unknown-linux-gnu/release/swanky-node
native-macos:
needs: checks-and-tests
runs-on: macos-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
submodules: true
- name: Install Protoc
run: brew install protobuf
- name: Install & display rust toolchain
run: |
rustup target add aarch64-apple-darwin
rustup show
- name: Check targets are installed correctly
run: rustup target list --installed
- name: Build optimized binary
run: |
cargo build --release --target x86_64-apple-darwin
cargo build --release --target aarch64-apple-darwin
mkdir -p ./artifacts/swanky-node-mac/
lipo ./target/x86_64-apple-darwin/release/swanky-node ./target/aarch64-apple-darwin/release/swanky-node -create -output ./artifacts/swanky-node-mac/swanky-node
- uses: actions/upload-artifact@master
with:
name: swanky-node-macOS-latest-universal
path: artifacts/swanky-node-mac/swanky-node
publish-release-draft:
needs: [native-linux, native-macOS]
runs-on: ubuntu-latest
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Release Draft
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
body_path: .github/release-draft.md
draft: true
upload-binaries:
needs: publish-release-draft
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu]
arch: [aarch64, x86_64]
include:
- os: macOS
arch: universal
steps:
- name: Create download folder
run: |
mkdir -p ${{ matrix.os }}-${{ matrix.arch }}-bin
- name: Download pre-built collator binary
uses: actions/download-artifact@v3
with:
name: swanky-node-${{ matrix.os }}-latest-${{ matrix.arch }}
path: ${{ matrix.os }}-${{ matrix.arch }}-bin
- name: Make binary executable and tar gzip
run: |
cd ${{ matrix.os }}-${{ matrix.arch }}-bin
chmod +x swanky-node
tar zcvf swanky-node.tar.gz swanky-node
- name: Upload binary artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.publish-release-draft.outputs.upload_url }}
asset_path: ${{ matrix.os }}-${{ matrix.arch }}-bin/swanky-node.tar.gz
asset_name: swanky-node-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip