-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (49 loc) · 2.09 KB
/
Copy pathrust.yml
File metadata and controls
59 lines (49 loc) · 2.09 KB
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
---
name: "Rust CI"
on:
workflow_call:
inputs:
extra_build_dependencies:
description: "Additional system dependencies to install"
default: ""
required: false
type: string
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install additional dependencies
if: inputs.extra_build_dependencies != ''
run: |
sudo apt install -y ${{ inputs.extra_build_dependencies }}
- name: Prepare login for private repos
uses: famedly/backend-build-workflows/.github/actions/rust-prepare@main
with:
gitlab_ssh: ${{ secrets.CI_SSH_PRIVATE_KEY}}
- name: Prepare dependencies
run: |
rustup update stable
sudo apt install -y musl-dev musl-tools
rustup target add x86_64-unknown-linux-musl
cargo install cargo-auditable
- name: Extract crate information
id: crate_metadata
run: |
cargo metadata --no-deps --format-version 1 | jq -r '[.packages[0].targets[] | select(.kind == ["bin"]) | .name ] | [.[] | {name: ., target:["x86_64-unknown-linux-musl"][]}] | [.[] | .name + "-" + .target ] | join(" ") | "binary_targets=" + .' | tee -a $GITHUB_OUTPUT
cargo metadata --no-deps --format-version 1 | jq -r '[.packages[0].targets[] | select(.kind == ["bin"]) | .name ] | [.[] | {name: ., target:["x86_64-unknown-linux-musl"][]}] | [.[] | "cp ./target/" + .target + "/release/" + .name + " " + .name + "-" + .target ] | join("; ") | "binary_copies=" + .' | tee -a $GITHUB_OUTPUT
- name: Clippy
run: cargo clippy
- name: Build
continue-on-error: true
run: |
cargo auditable build --release --target x86_64-unknown-linux-musl
sh -c "${{ steps.crate_metadata.outputs.binary_copies }}"
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create ${{ github.ref_name }} ${{ steps.crate_metadata.outputs.binary_targets }}
if: github.ref_type == 'tag'