Skip to content

Commit 9416a8b

Browse files
authored
chore(hermes): small improvements to add tests in CI and more (#1393)
* fix(hermes): fix a broken test * refactor(hermes): add clippy to pre-commit * feat(hermes): add ci for tests * chore(hermes): remove legacy go footprint * fix: add protoc action for ci * chore: rebase on top of main * fix: use right rust version for the Dockerfile * fix: fix precommit ci
1 parent d66c00f commit 9416a8b

File tree

11 files changed

+68
-837
lines changed

11 files changed

+68
-837
lines changed

.github/workflows/ci-hermes.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check Hermes
2+
3+
on:
4+
pull_request:
5+
paths: [hermes/**]
6+
push:
7+
branches: [main]
8+
paths: [hermes/**]
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions-rs/toolchain@v1
15+
with:
16+
profile: minimal
17+
toolchain: nightly-2024-03-26
18+
components: rustfmt, clippy
19+
override: true
20+
- name: Install protoc
21+
uses: arduino/setup-protoc@v3
22+
- name: Run executor tests
23+
run: cargo test --manifest-path ./hermes/Cargo.toml

.github/workflows/ci-pre-commit.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ jobs:
2727
profile: minimal
2828
toolchain: nightly-2023-07-23
2929
components: rustfmt, clippy
30+
- uses: actions-rs/toolchain@v1
31+
with:
32+
profile: minimal
33+
toolchain: nightly-2024-03-26
34+
components: rustfmt, clippy
35+
- name: Install protoc
36+
uses: arduino/setup-protoc@v3
3037
- uses: actions/checkout@v4
3138
- name: Install poetry
3239
run: pipx install poetry

.pre-commit-config.yaml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,6 @@ repos:
3030
entry: cargo +nightly-2023-03-01 clippy --manifest-path ./governance/remote_executor/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
3131
pass_filenames: false
3232
files: governance/remote_executor
33-
# Hooks for the attester
34-
- id: cargo-fmt-attester
35-
name: Cargo format for attester
36-
language: "rust"
37-
entry: cargo +nightly-2023-03-01 fmt --manifest-path ./wormhole_attester/Cargo.toml --all -- --config-path rustfmt.toml
38-
pass_filenames: false
39-
files: wormhole_attester
40-
- id: cargo-clippy-attester
41-
name: Cargo clippy for attester
42-
language: "rust"
43-
entry: |
44-
bash -c 'EMITTER_ADDRESS=0 BRIDGE_ADDRESS=0 cargo +nightly-2023-03-01 clippy --manifest-path \
45-
./wormhole_attester/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings'
46-
pass_filenames: false
47-
files: wormhole_attester
4833
# Hooks for cosmwasm contract
4934
- id: cargo-fmt-cosmwasm
5035
name: Cargo format for cosmwasm contract
@@ -60,9 +45,15 @@ repos:
6045
files: target_chains/cosmwasm
6146
# Hooks for Hermes
6247
- id: cargo-fmt-hermes
63-
name: Cargo format for Pyth Hermes
48+
name: Cargo format for Hermes
49+
language: "rust"
50+
entry: cargo +nightly-2024-03-26 fmt --manifest-path ./hermes/Cargo.toml --all -- --config-path rustfmt.toml
51+
pass_filenames: false
52+
files: hermes
53+
- id: cargo-clippy-hermes
54+
name: Cargo clippy for Hermes
6455
language: "rust"
65-
entry: cargo +nightly-2023-07-23 fmt --manifest-path ./hermes/Cargo.toml --all -- --config-path rustfmt.toml
56+
entry: cargo +nightly-2024-03-26 clippy --manifest-path ./hermes/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
6657
pass_filenames: false
6758
files: hermes
6859
# Hooks for Fortuna

hermes/Dockerfile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
FROM docker.io/golang:1.20.4@sha256:6dd5c5f8936d7d4487802fb10a77f31b1776740be0fc17ada1acb74ac958f7be AS build
1+
# The rust version itself is not so important as we install a fixed
2+
# nightly version. We use the latest stable version to get the latest
3+
# updates and dependencies.
4+
FROM rust:1.77.0 AS build
25

36
# Install OS packages
47
RUN apt-get update && apt-get install --yes \
58
build-essential curl clang libssl-dev protobuf-compiler
69

7-
# Install Rust
8-
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --quiet --no-modify-path
9-
ENV PATH="/root/.cargo/bin:${PATH}"
10-
11-
# Install Solana
12-
RUN sh -c "$(curl -sSfL https://release.solana.com/v1.14.17/install)"
13-
ENV PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
14-
1510
# Set default toolchain
16-
RUN rustup default nightly-2023-07-23
11+
RUN rustup default nightly-2024-03-26
1712

1813
# Build
1914
WORKDIR /src
@@ -25,7 +20,7 @@ WORKDIR /src/hermes
2520

2621
RUN --mount=type=cache,target=/root/.cargo/registry cargo build --release
2722

28-
FROM docker.io/golang:1.20.4@sha256:6dd5c5f8936d7d4487802fb10a77f31b1776740be0fc17ada1acb74ac958f7be
23+
FROM rust:1.77.0
2924

3025
# Copy artifacts from other images
3126
COPY --from=build /src/hermes/target/release/hermes /usr/local/bin/

hermes/go.mod

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

0 commit comments

Comments
 (0)