Skip to content

Commit cd1fc92

Browse files
committed
chore : add step to install protoc
1 parent ec8f6be commit cd1fc92

File tree

3 files changed

+116
-54
lines changed

3 files changed

+116
-54
lines changed

.github/workflows/build-crates.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Build yellowstone-vixen crates
2+
# This workflow uses github runners.
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
# This may be adjusted to whatever suits best your runners config.
8+
# Current config will build on manual trigger or pull-request (each push)
9+
on:
10+
# pull_request can be removed, to save minutes on github runners
11+
pull_request:
12+
workflow_dispatch:
13+
push:
14+
branches:
15+
- 'main'
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
20+
jobs:
21+
build:
22+
# This can be also be runned on self-hosted github runners
23+
runs-on: ubuntu-22.04
24+
25+
steps:
26+
- name: checkout repo
27+
uses: actions/checkout@v4
28+
29+
# This step can be omited, to save storage space on the organization account
30+
# Build process will take longer
31+
- name: Cache Build Dependencies
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
~/.cargo/bin/
36+
~/.cargo/registry/index/
37+
~/.cargo/registry/cache/
38+
~/.cargo/git/db/
39+
yellowstone-vixen/target/
40+
key: cargo-${{ hashFiles('**/Cargo.lock') }}-0001
41+
42+
# Cache Rust Nightly Toolchain
43+
- name: Cache Rust Nightly
44+
id: cache-rust-nightly
45+
uses: actions/cache@v4
46+
with:
47+
path: ~/.rustup
48+
key: rust-nightly-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}
49+
50+
- name: Install Rust Nightly if Not Cached
51+
if: steps.cache-rust-nightly.outputs.cache-hit != 'true'
52+
uses: actions-rs/toolchain@v1
53+
with:
54+
toolchain: nightly
55+
override: true
56+
components: rustfmt, clippy
57+
58+
# Cache Protoc
59+
- name: Cache protoc
60+
id: cache-protoc
61+
uses: actions/cache@v4
62+
with:
63+
path: |
64+
/var/cache/apt/archives
65+
~/.local/bin/protoc
66+
key: protoc-${{ runner.os }}-26.1
67+
68+
- name: Install Latest Protoc if Not Cached
69+
if: steps.cache-protoc.outputs.cache-hit != 'true'
70+
run: |
71+
PROTOC_VERSION=26.1
72+
ARCH=x86_64
73+
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${ARCH}.zip
74+
sudo apt-get install -y unzip protobuf-compiler libprotobuf-dev
75+
unzip protoc-${PROTOC_VERSION}-linux-${ARCH}.zip -d $HOME/.local
76+
echo "$HOME/.local/bin" >> $GITHUB_PATH
77+
protoc --version
78+
79+
# Build yellowstone-vixen
80+
- name: build yellowstone-vixen
81+
run: cargo build --verbose --release

.github/workflows/test.yml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
name: Check lock file, fmt, clippy
2-
2+
# This workflow uses github runners.
33
concurrency:
44
group: ${{ github.workflow }}-${{ github.ref }}
55
cancel-in-progress: true
66

7+
# This may be adjusted to whatever suits best your runners config.
8+
# Current config will build on manual trigger or pull-request (each push)
79
on:
10+
# pull_request can be removed, to save minutes on github runners
811
pull_request:
912
push:
1013
branches:
1114
- 'main'
1215
workflow_dispatch:
13-
1416
env:
1517
CARGO_TERM_COLOR: always
16-
1718
jobs:
1819
test:
1920
runs-on: ubuntu-22.04
20-
2121
steps:
2222
- name: checkout repo
2323
uses: actions/checkout@v4
24-
2524
- name: set build cache
2625
uses: actions/cache@v4
2726
with:
@@ -33,14 +32,43 @@ jobs:
3332
yellowstone-vixen/target/
3433
key: cargo-${{ hashFiles('**/Cargo.lock') }}-0001
3534

36-
# Install Rust Nightly
37-
- name: Install Rust Nightly
35+
# Cache Rust Nightly Toolchain
36+
- name: Cache Rust Nightly
37+
id: cache-rust-nightly
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.rustup
41+
key: rust-nightly-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}
42+
43+
- name: Install Rust Nightly if Not Cached
44+
if: steps.cache-rust-nightly.outputs.cache-hit != 'true'
3845
uses: actions-rs/toolchain@v1
3946
with:
4047
toolchain: nightly
4148
override: true
4249
components: rustfmt, clippy
4350

51+
# Cache Protoc
52+
- name: Cache protoc
53+
id: cache-protoc
54+
uses: actions/cache@v4
55+
with:
56+
path: |
57+
/var/cache/apt/archives
58+
~/.local/bin/protoc
59+
key: protoc-${{ runner.os }}-26.1
60+
61+
- name: Install Latest Protoc if Not Cached
62+
if: steps.cache-protoc.outputs.cache-hit != 'true'
63+
run: |
64+
PROTOC_VERSION=26.1
65+
ARCH=x86_64
66+
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${ARCH}.zip
67+
sudo apt-get install -y unzip protobuf-compiler libprotobuf-dev
68+
unzip protoc-${PROTOC_VERSION}-linux-${ARCH}.zip -d $HOME/.local
69+
echo "$HOME/.local/bin" >> $GITHUB_PATH
70+
protoc --version
71+
4472
# Cargo.lock
4573
- name: Check lock file
4674
run: |

0 commit comments

Comments
 (0)