-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |