-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (72 loc) · 2.67 KB
/
deploy-node.yml
File metadata and controls
91 lines (72 loc) · 2.67 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
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
name: Deploy Node Daemon
on:
push:
branches: [main]
paths:
- 'crates/**'
- 'packages/contract/proto/**'
- 'Cargo.toml'
- 'Cargo.lock'
workflow_dispatch:
concurrency:
group: deploy-node
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Test & Lint Rust
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
- name: Install protobuf compiler and musl tools
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler musl-tools
- name: Test sandchest-agent
run: cargo test -p sandchest-agent
- name: Test sandchest-node
run: cargo test -p sandchest-node
- run: cargo clippy --workspace -- -D warnings
build-and-upload:
name: Build & Upload to R2
needs: check
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install protobuf compiler and musl tools
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler musl-tools
- name: Build release binary (static musl)
run: cargo build --release --package sandchest-node --target x86_64-unknown-linux-musl
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: sandchest-node-${{ github.sha }}
path: target/x86_64-unknown-linux-musl/release/sandchest-node
retention-days: 30
- name: Upload binary to R2
env:
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
run: |
aws s3 cp target/x86_64-unknown-linux-musl/release/sandchest-node \
"s3://${{ secrets.R2_BUCKET }}/binaries/sandchest-node/${{ github.sha }}/sandchest-node" \
--endpoint-url "${{ secrets.R2_ENDPOINT }}"
aws s3 cp target/x86_64-unknown-linux-musl/release/sandchest-node \
"s3://${{ secrets.R2_BUCKET }}/binaries/sandchest-node/latest/sandchest-node" \
--endpoint-url "${{ secrets.R2_ENDPOINT }}"
# Deployment to individual nodes is handled via the admin app's
# "Deploy Daemon" button, which pulls the binary from R2.
# No direct SSH needed — scales to any number of servers.