-
Notifications
You must be signed in to change notification settings - Fork 7
149 lines (125 loc) · 3.8 KB
/
build-binary.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
name: Build Binary
on:
workflow_dispatch:
inputs:
features:
description: "List of features to enable"
required: false
default: ""
push:
branches:
- "main"
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "tests/fixtures/**"
- "static/**"
- ".sqlx/**"
env:
RETENTION_DAYS: 90
jobs:
build_binaries:
name: Build and upload
runs-on: ubuntu-22.04
timeout-minutes: 45
concurrency:
group: ${{ github.workflow }}-{{ github.run_id }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.84
- name: Rust Cache
uses: Swatinem/rust-cache@v2
id: cache-cargo
with:
prefix-key: ${{ runner.os }}-v3-cargo
shared-key: artifact
cache-provider: "github"
save-if: ${{ github.ref_name == 'main' && github.event_name == 'push' }}
- name: Install protoc
run: sudo apt-get install -y protobuf-compiler
- name: Install libsasl2-dev libssl-dev
run: sudo apt-get update && sudo apt install -y build-essential pkg-config libssl-dev libsasl2-dev
name: Build Binary
on:
workflow_dispatch:
inputs:
features:
description: "List of features to enable"
required: false
default: ""
push:
branches:
- "main"
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "tests/fixtures/**"
- "static/**"
- ".sqlx/**"
env:
RETENTION_DAYS: 90
jobs:
build_binaries:
name: Build and upload
runs-on: ubuntu-22.04
timeout-minutes: 45
concurrency:
group: ${{ github.workflow }}-{{ github.run_id }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.84
- name: Rust Cache
uses: Swatinem/rust-cache@v2
id: cache-cargo
with:
prefix-key: ${{ runner.os }}-v3-cargo
shared-key: artifact
cache-provider: "github"
save-if: ${{ github.ref_name == 'main' && github.event_name == 'push' }}
- name: Install protoc
run: sudo apt-get install -y protobuf-compiler
- name: Install libsasl2-dev libssl-dev
run: sudo apt-get update && sudo apt install -y build-essential pkg-config libssl-dev libsasl2-dev
- name: Build binaries
run: |
cargo build --release \
--bin stratus \
--features "$FEATURES"
env:
CARGO_PROFILE_RELEASE_DEBUG: 1
TRACING_LOG_FORMAT: json
NO_COLOR: 1
FEATURES: "${{ github.event.inputs.features || 'default' }}"
- name: Generate checksums
run: |
cd target/release
sha256sum stratus > ../../checksums.txt
- name: Upload stratus
uses: actions/upload-artifact@v4
id: upload-str
with:
name: stratus-${{ github.sha }}
path: target/release/stratus
if-no-files-found: error
retention-days: ${{ env.RETENTION_DAYS }}
- name: Upload checksums
uses: actions/upload-artifact@v4
with:
name: checksums-${{ github.sha }}
path: checksums.txt
if-no-files-found: error
retention-days: ${{ env.RETENTION_DAYS }}
- name: Print outputs
run: |
echo "Artifact ID: ${{ steps.upload-str.outputs.artifact-id }} (stratus)"
echo "Artifact URL: ${{ steps.upload-str.outputs.artifact-url }} (stratus)"