@@ -3,13 +3,109 @@ name: Pre-Release
33on : [push]
44
55jobs :
6- release :
7- name : Create draft release
6+ lib- release :
7+ name : pyroscope-main
88 runs-on : ubuntu-latest
9- if : " startsWith(github.ref, 'refs/tags/')"
9+ if : " startsWith(github.ref, 'refs/tags/lib-')"
10+ continue-on-error : true
1011 steps :
1112 -
uses :
" marvinpinto/[email protected] " 1213 with :
1314 repo_token : " ${{ secrets.GITHUB_TOKEN }}"
15+ automatic_release_tag : " ${{ github.ref_name }}"
16+ title : " pyroscope-${{ github.ref_name }}"
1417 draft : true
1518 prerelease : false
19+ cli-release :
20+ name : pyroscope-cli
21+ runs-on : ubuntu-latest
22+ if : " startsWith(github.ref, 'refs/tags/cli-')"
23+ steps :
24+ -
uses :
" marvinpinto/[email protected] " 25+ with :
26+ repo_token : " ${{ secrets.GITHUB_TOKEN }}"
27+ automatic_release_tag : " ${{ github.ref_name }}"
28+ title : " pyroscope-${{ github.ref_name }}"
29+ draft : true
30+ prerelease : false
31+ cli-artifacts :
32+ name : pyroscope-cli - build aritifacts
33+ needs : ['cli-release']
34+ runs-on : ${{ matrix.os }}
35+ env :
36+ # For some builds, we use cross to test on 32-bit and big-endian
37+ # systems.
38+ CARGO : cargo
39+ # When CARGO is set to CROSS, this is set to `--target matrix.target`.
40+ TARGET_FLAGS : " "
41+ # When CARGO is set to CROSS, TARGET_DIR includes matrix.target.
42+ TARGET_DIR : ./target
43+ # Emit backtraces on panics.
44+ RUST_BACKTRACE : 1
45+ strategy :
46+ matrix :
47+ build : [linux, linux-arm, macos]
48+ include :
49+ - build : linux
50+ os : ubuntu-18.04
51+ rust : stable
52+ target : x86_64-unknown-linux-musl
53+ - build : linux-arm
54+ os : ubuntu-18.04
55+ rust : stable
56+ target : arm-unknown-linux-gnueabihf
57+ - build : macos
58+ os : macos-latest
59+ rust : stable
60+ target : x86_64-apple-darwin
61+ steps :
62+ - name : Checkout repository
63+ uses : actions/checkout@v2
64+
65+ - name : Install Rust
66+ uses : actions-rs/toolchain@v1
67+ with :
68+ toolchain : ${{ matrix.rust }}
69+ profile : minimal
70+ override : true
71+ target : ${{ matrix.target }}
72+
73+ - name : Use Cross
74+ shell : bash
75+ run : |
76+ cargo install cross
77+ echo "CARGO=cross" >> $GITHUB_ENV
78+ echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
79+ echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
80+
81+ - name : Show command used for Cargo
82+ run : |
83+ echo "cargo command is: ${{ env.CARGO }}"
84+ echo "target flag is: ${{ env.TARGET_FLAGS }}"
85+ echo "target dir is: ${{ env.TARGET_DIR }}"
86+
87+ - name : Build release binary
88+ run : ${{ env.CARGO }} build --manifest-path pyroscope_cli/Cargo.toml --verbose --release ${{ env.TARGET_FLAGS }}
89+
90+ - name : Strip release binary (linux and macos)
91+ if : matrix.build == 'linux' || matrix.build == 'macos'
92+ run : strip "pyroscope_cli/target/${{ matrix.target }}/release/pyroscope-cli"
93+
94+ - name : Strip release binary (arm)
95+ if : matrix.build == 'linux-arm'
96+ run : |
97+ docker run --rm -v \
98+ "$PWD/target:/target:Z" \
99+ rustembedded/cross:arm-unknown-linux-gnueabihf \
100+ arm-linux-gnueabihf-strip \
101+ /target/arm-unknown-linux-gnueabihf/release/pyroscope-cli
102+
103+ - name : Upload release archive
104+ 105+ env :
106+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
107+ with :
108+ upload_url : ${{ needs.create-release.outputs.upload_url }}
109+ asset_path : " pyroscope_cli/target/${{ matrix.target }}/release/pyroscope-cli"
110+ asset_name : " pyroscope-cli"
111+ asset_content_type : application/octet-stream
0 commit comments