Skip to content

Commit

Permalink
build: remove cargo-chef, revert to stable rust
Browse files Browse the repository at this point in the history
  • Loading branch information
neysofu committed Nov 18, 2022
1 parent d988219 commit 6e32edf
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 34 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Code coverage

on:
workflow_dispatch:
schedule:
# Run it every 5 days.
- cron: "0 5 * * *"

jobs:
stale:
runs-on: ubuntu-latest
timeout-minutes: 50
steps:
- uses: actions/stale@main
id: stale
with:
# PRs
days-before-pr-stale: 90
days-before-pr-close: 14
stale-pr-message: >
This pull request hasn't had any activity for the last 90 days. If
there's no more activity over the course of the next 14 days, it will
automatically be closed.
# Issues
days-before-issue-stale: 180
# Never close stale issues, only mark them as such.
days-before-issue-close: -1
stale-issue-message: >
Looks like this issue has been open for 6 months with no activity.
Is it still relevant? If not, please remember to close it.
- name: Print stale outputs
run: echo ${{ join(steps.stale.outputs.*, ',') }}
34 changes: 8 additions & 26 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,22 @@ ARG ENVSUBST_COMMIT_SHA=16035fe3571ad42c7796bf554f978bb2df64231b
RUN go install github.com/a8m/envsubst/cmd/envsubst@$ENVSUBST_COMMIT_SHA \
&& strip -g /go/bin/envsubst

FROM rust:bullseye AS cargo-chef

WORKDIR /app
# Best thing in life after sliced bread.
# <https://github.com/LukeMathWalker/cargo-chef>
# We're not using cargo-chef's prebuilt image for security reasons (not that
# there's anything wrong with it per se). The version is pinned to minimize the
# risk of supply chain attacks.
RUN cargo install cargo-chef --version 0.1.45

FROM cargo-chef AS cargo-chef-plan

COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM cargo-chef AS graph-node-build

WORKDIR /graph-node
FROM rust:bullseye as graph-node-build

ARG COMMIT_SHA=unknown
ARG REPO_NAME=unknown
ARG BRANCH_NAME=unknown
ARG TAG_NAME=unknown

COPY --from=cargo-chef-plan /app/recipe.json cargo-chef-recipe.json
ADD . /graph-node

RUN apt-get update \
&& apt-get install -y cmake
RUN RUSTFLAGS="-g" cargo chef cook --release --recipe-path cargo-chef-recipe.json

ADD . .

RUN RUSTFLAGS="-g" cargo build --release \
&& apt-get install -y cmake && \
cd /graph-node && \
RUSTFLAGS="-g" cargo build --release --package graph-node \
&& cp target/release/graph-node /usr/local/bin/graph-node \
&& cp target/release/graphman /usr/local/bin/graphman \
# Reduce the size of the layer by removing unnecessary files.
&& cargo clean \
&& objcopy --only-keep-debug /usr/local/bin/graph-node /usr/local/bin/graph-node.debug \
&& strip -g /usr/local/bin/graph-node \
Expand All @@ -59,7 +40,8 @@ RUN RUSTFLAGS="-g" cargo build --release \
&& echo "BRANCH_NAME='$BRANCH_NAME'" >> /etc/image-info \
&& echo "COMMIT_SHA='$COMMIT_SHA'" >> /etc/image-info \
&& echo "CARGO_VERSION='$(cargo --version)'" >> /etc/image-info \
&& echo "RUST_VERSION='$(rustc --version)'" >> /etc/image-info
&& echo "RUST_VERSION='$(rustc --version)'" >> /etc/image-info \
&& echo "CARGO_DEV_BUILD='$CARGO_DEV_BUILD'" >> /etc/image-info

# Debug image to access core dumps
FROM graph-node-build as graph-node-debug
Expand Down
9 changes: 4 additions & 5 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "graph-node"
version.workspace = true
edition.workspace = true
default-run = "graph-node"
rust-version = "1.64"

[[bin]]
name = "graph-node"
Expand All @@ -28,12 +27,12 @@ graph-chain-arweave = { path = "../chain/arweave" }
graph-chain-ethereum = { path = "../chain/ethereum" }
graph-chain-near = { path = "../chain/near" }
graph-chain-cosmos = { path = "../chain/cosmos" }
graph-chain-substreams= { path = "../chain/substreams" }
graph-chain-substreams = { path = "../chain/substreams" }
graph-graphql = { path = "../graphql" }
graph-runtime-wasm = { path = "../runtime/wasm" }
graph-server-http = { path = "../server/http" }
graph-server-index-node = { path = "../server/index-node" }
graph-server-json-rpc = { path = "../server/json-rpc"}
graph-server-json-rpc = { path = "../server/json-rpc" }
graph-server-websocket = { path = "../server/websocket" }
graph-server-metrics = { path = "../server/metrics" }
graph-store-postgres = { path = "../store/postgres" }
Expand All @@ -44,5 +43,5 @@ toml = "0.5.7"
shellexpand = "2.1.0"
diesel = "1.4.8"
http = "0.2.5" # must be compatible with the version rust-web3 uses
prometheus = { version ="0.13.3", features = ["push"] }
json-structural-diff = {version = "0.1", features = ["colorize"] }
prometheus = { version = "0.13.3", features = ["push"] }
json-structural-diff = { version = "0.1", features = ["colorize"] }
5 changes: 2 additions & 3 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[toolchain]
channel = "stable"
components = ["rustfmt", "clippy"]
profile = "minimal"
channel = "1.65.0"
profile = "default"

0 comments on commit 6e32edf

Please sign in to comment.