Skip to content

Commit

Permalink
coverage as github action
Browse files Browse the repository at this point in the history
  • Loading branch information
insipx committed Dec 22, 2023
1 parent ac95b2d commit b87f4ec
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Coverage
on: [pull_request, push]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup toolchain install nightly --component llvm-tools-preview
- name: Install cargo-llvm-cov
run: curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
files: lcov.info
fail_ci_if_error: true
25 changes: 23 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
FROM ghcr.io/xmtp/rust:latest

ARG PROJECT=didethresolver
WORKDIR /workspaces/${PROJECT}

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


WORKDIR /build
RUN git clone https://github.com/foundry-rs/foundry

ARG MAXIMUM_THREADS=2
WORKDIR /build/foundry
RUN git pull && LATEST_TAG=$(git describe --tags --abbrev=0) || LATEST_TAG=master && \
echo "building tag ${LATEST_TAG}" && \
git -c advice.detachedHead=false checkout nightly && \
. $HOME/.cargo/env && \
THREAD_NUMBER=$(cat /proc/cpuinfo | grep -c ^processor) && \
MAX_THREADS=$(( THREAD_NUMBER > ${MAXIMUM_THREADS} ? ${MAXIMUM_THREADS} : THREAD_NUMBER )) && \
echo "building with ${MAX_THREADS} threads" && \
cargo install --path crates/anvil --jobs ${MAX_THREADS}

WORKDIR /workspaces/${PROJECT}
USER xmtp
ENV USER=xmtp
ENV PATH=/home/${USER}/.cargo/bin:$PATH

# source $HOME/.cargo/env

COPY --chown=xmtp:xmtp . .

RUN cargo fmt --check
RUN cargo clippy --all-features --no-deps
RUN cargo test
# Skip integration tests for now
RUN cargo test --lib
RUN cargo test --doc

CMD cargo run

0 comments on commit b87f4ec

Please sign in to comment.