This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
160 lines (144 loc) · 5.23 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
name: Release
# We have to use gtar on macOS because apple's tar is literally broken.
# Yes, I know how stupid that sounds. But it's true:
# https://github.com/actions/virtual-environments/issues/2619
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
rust: [ '1.60.0' ]
target: [ x86_64-apple-darwin, x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu ]
include:
- os: macos-latest
target: x86_64-apple-darwin
binary_path: target/release
name: macos
tar: gtar
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
binary_path: target/x86_64-unknown-linux-musl/release
name: linux
tar: tar
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_path: target/x86_64-unknown-linux-gnu/release
name: linux-gnu
tar: tar
steps:
- uses: actions/checkout@v2
- name: Setup environment variables
run: |
echo "SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "OPENSSL_STATIC=yes" >> $GITHUB_ENV
echo ICX_VERSION=$(cargo metadata | jq -r '.["packages"][] | select(.name == "icx-proxy")["version"]') >> $GITHUB_ENV
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
if: contains(matrix.os, 'macos')
- name: Linux build (musl)
uses: dfinity/rust-musl-action@master
with:
args: |
cargo install cargo-deb --target x86_64-unknown-linux-musl
rustup target add x86_64-unknown-linux-musl
RUSTFLAGS="--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" cargo deb --target x86_64-unknown-linux-musl -- --locked --features=skip_body_verification
if: contains(matrix.target, 'linux-musl')
- name: Linux build (gnu)
env:
RUSTFLAGS: --remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity
run: |
cargo build --locked --release --target x86_64-unknown-linux-gnu --features=skip_body_verification
cd ${{ matrix.binary_path }}
ldd icx-proxy
if: contains(matrix.target, 'linux-gnu')
- name: macOS build
env:
RUSTFLAGS: --remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity
run: |
cargo build --locked --release --features=skip_body_verification
cd target/release
otool -L icx-proxy
if: contains(matrix.os, 'macos')
- name: Create tarball of binaries
run: ${{ matrix.tar }} -zcC ${{ matrix.binary_path }} -f binaries.tar.gz icx-proxy
- name: Inspect input binary and tarball contents
run: |
hexdump -C ${{ matrix.binary_path }}/icx-proxy | head
hexdump -C ${{ matrix.binary_path }}/icx-proxy | tail
${{ matrix.binary_path }}/icx-proxy --help
ARCHIVE="$(pwd)/binaries.tar.gz"
cd "$(mktemp -d)"
${{ matrix.tar }} --version
${{ matrix.tar }} -xzvf "$ARCHIVE"
ls -l icx-proxy
hexdump -C icx-proxy | head
hexdump -C icx-proxy | tail
./icx-proxy --help
- name: Upload tarball artifact
uses: actions/upload-artifact@v2
with:
name: tarball-${{ matrix.name }}
path: binaries.tar.gz
- name: Copy deb artifact
run: cp target/x86_64-unknown-linux-musl/debian/icx-proxy_${{ env.ICX_VERSION }}_amd64.deb icx-proxy.deb
if: contains(matrix.target, 'linux-musl')
- name: Upload deb artifact
uses: actions/upload-artifact@v2
with:
name: deb-${{ matrix.name }}
path: icx-proxy.deb
if: contains(matrix.target, 'linux-musl')
upload:
runs-on: ${{ matrix.os }}
needs: [ build ]
strategy:
fail-fast: false
matrix:
rust: [ '1.60.0' ]
target: [ x86_64-apple-darwin, x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu ]
include:
- os: macos-latest
target: x86_64-apple-darwin
name: macos
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
name: linux
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
name: linux-gnu
steps:
- name: Setup environment variables
run: echo "SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Download tarball artifact
uses: actions/download-artifact@v2
with:
name: tarball-${{ matrix.name }}
- name: Download deb artifact
uses: actions/download-artifact@v2
with:
name: deb-${{ matrix.name }}
if: contains(matrix.target, 'linux-musl')
- name: Upload tarball
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: binaries.tar.gz
asset_name: binaries-${{ matrix.name }}.tar.gz
tag: rev-${{ env.SHA_SHORT }}
- name: Upload deb
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: icx-proxy.deb
tag: rev-${{ env.SHA_SHORT }}
if: contains(matrix.target, 'linux-musl')