Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit b376132

Browse files
committed
26: light refactor, command line arguments, production support, codecov
1 parent 4bf3d4b commit b376132

File tree

17 files changed

+469
-106
lines changed

17 files changed

+469
-106
lines changed

.devcontainer/devcontainer.json

+4-16
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,8 @@
77
"context": "..",
88
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
99
"dockerfile": "../Dockerfile"
10+
},
11+
"containerEnv": {
12+
"RPC_URL": "${localEnv:RPC_URL}"
1013
}
11-
12-
// Features to add to the dev container. More info: https://containers.dev/features.
13-
// "features": {},
14-
15-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
16-
// "forwardPorts": [],
17-
18-
// Uncomment the next line to run commands after the container is created.
19-
// "postCreateCommand": "cat /etc/os-release",
20-
21-
// Configure tool-specific properties.
22-
// "customizations": {},
23-
24-
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
25-
// "remoteUser": "devcontainer"
26-
}
14+
}

.github/workflows/ci-image.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: docker/setup-qemu-action@v2
1818
- name: Set up Docker Buildx
1919
uses: docker/setup-buildx-action@v2
20-
- name: Build and Push
20+
- name: Build CI
2121
uses: docker/build-push-action@v3
2222
with:
2323
context: .
@@ -26,3 +26,13 @@ jobs:
2626
build-args: |
2727
VERSION=latest
2828
CARGO_INCREMENTAL=0
29+
- name: Build Prod Image CI
30+
uses: docker/build-push-action@v3
31+
with:
32+
context: .
33+
file: prod/Dockerfile
34+
platforms: linux/amd64
35+
push: false
36+
build-args: |
37+
VERSION=latest
38+
CARGO_INCREMENTAL=0

.github/workflows/coverage.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818
- name: Generate code coverage
1919
run: RUST_LOG=lib_didethresolver=info cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
2020
- name: Upload coverage to Codecov
21-
uses: codecov/codecov-action@v1
21+
uses: codecov/codecov-action@v3
2222
with:
23+
token: ${{ secrets.CODECOV_TOKEN }}
2324
files: lcov.info
2425
fail_ci_if_error: true

.github/workflows/ghcr-image.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Docker Image Build Push
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
concurrency:
9+
group: "docker-image"
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
-
17+
name: Checkout
18+
uses: actions/checkout@v3
19+
-
20+
name: Set up QEMU
21+
uses: docker/setup-qemu-action@v2
22+
-
23+
name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v2
25+
26+
- name: Generate repository name
27+
run: |
28+
echo "REPOSITORY_PATH=$( echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]' )" >> ${GITHUB_ENV}
29+
echo "REPOSITORY_SHA=$( echo ${GITHUB_SHA} | cut -c 1-8 )" >> ${GITHUB_ENV}
30+
-
31+
name: Login to GitHub Container Registry
32+
uses: docker/login-action@v2
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.repository_owner }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
-
38+
name: Build and Push
39+
uses: docker/build-push-action@v3
40+
with:
41+
context: .
42+
file: ./prod/Dockerfile
43+
platforms: linux/amd64,linux/arm64
44+
push: true
45+
build-args: |
46+
VERSION=${{ github.ref_name }}
47+
CARGO_INCREMENTAL=0
48+
tags: |
49+
ghcr.io/${{ env.REPOSITORY_PATH }}:v${{ github.ref_name }}
50+
ghcr.io/${{ env.REPOSITORY_PATH }}:${{ env.REPOSITORY_SHA }}
51+
ghcr.io/${{ env.REPOSITORY_PATH }}:latest
52+
-
53+
name: GitHub Release
54+
uses: actions/create-release@v1
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
with:
58+
draft: false
59+
prerelease: false
60+
tag_name: ${{ github.ref_name }}
61+
release_name: v${{ github.ref_name }}
62+
body_path: CHANGELOG.md

.github/workflows/github-pages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Invoke cargo doc
4343
run: |
4444
rm -rf ./_site
45-
cargo doc --lib --no-deps
45+
cargo doc --workspace --no-deps
4646
rm -f target/doc/.lock
4747
cp -r target/doc _site
4848
echo "<meta http-equiv=\"refresh\" content=\"0; url=didethresolver\">" > _site/index.html

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 0.1.0 (2024-01-24)
2+
3+
* inital production support
4+
* light refactor
5+
* command line and environment variables
6+
* url parser

Cargo.lock

+124-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[workspace]
22
members = [
33
"lib",
4-
"gateway",
5-
"examples/*",
4+
"resolver",
5+
"examples/*",
66
]
77

88
exclude = [ ]

Dockerfile

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
FROM ghcr.io/xmtp/rust:latest
2-
ARG CARGO_INCREMENTAL
32
ARG PROJECT=didethresolver
3+
ARG CARGO_INCREMENTAL
4+
45
WORKDIR /workspaces/${PROJECT}
56

67
RUN sudo apt update && sudo apt install -y pkg-config openssl libssl-dev
78

89
USER xmtp
910
ENV USER=xmtp
10-
ENV PATH=/home/${USER}/.cargo/bin:$PATH
11+
ENV PATH=~${USER}/.cargo/bin:$PATH
1112
# source $HOME/.cargo/env
1213

1314
COPY --from=ghcr.io/xmtp/foundry:latest /usr/local/bin/anvil /usr/local/bin/anvil
1415

1516
COPY --chown=xmtp:xmtp . .
1617

1718
ENV CARGO_INCREMENTAL=${CARGO_INCREMENTAL:-1}
19+
RUN cargo check --all-features
1820
RUN cargo fmt --check --all
1921
RUN cargo clippy --all-features --no-deps -- -D warnings
2022
RUN cargo test --workspace --all-features
23+
RUN CARGO_TARGET_DIR=/workspaces/${PROJECT}/target cargo install --path resolver --bin=resolver --root ~${USER}/.cargo/
24+
RUN valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose ~${USER}/.cargo/bin/resolver --help
2125

22-
CMD cargo run
26+
ENV RUST_LOG=info
27+
CMD cargo run --package=resolver -- --host 0.0.0.0 --port 8080

0 commit comments

Comments
 (0)