Skip to content

Commit

Permalink
ops(ci): coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Arqu committed Nov 24, 2022
1 parent 875a29a commit c625b6e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,70 @@ jobs:
aws s3 cp ./target/optimized-release/iroh-store s3://vorc/iroh-store-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
coverage:
name: Coverage
runs-on: ${{ matrix.runner }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust: [stable]
experimental: [false]
include:
- os: ubuntu-latest
release-os: linux
release-arch: amd64
protoc-arch: linux-x86_64
runner: [self-hosted, linux, X64]
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
steps:
- uses: actions/checkout@master

- name: Set build arch
run: |
echo "PROTOC_ARCH=${{ matrix.protoc-arch }}" >> $GITHUB_ENV
- name: Install ${{ matrix.rust }}
run: |
rustup toolchain install --profile default ${{ matrix.rust }}
rustup component add llvm-tools-preview
- name: Install Protoc
run: |
PROTOC_VERSION=3.20.1
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
- name: Install grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: coverage
timeout-minutes: 30
env:
# iroh-util/src/lock.rs#test_locks uses a fork() command & fails only in
# GHA if this is not present
# https://twitter.com/steipete/status/921066430220652544?lang=en
# https://blog.phusion.nl/2017/10/13/why-ruby-app-servers-break-on-macos-high-sierra-and-what-can-be-done-about-it/
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES"
run: |
cargo xtask coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
files: coverage/*.lcov

fmt:
name: Rustfmt
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
codecov:
notify:
wait_for_ci: false
comment: false
1 change: 1 addition & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ anyhow = "1"
clap = { version = "4.0.9", features = ["derive"] }
clap_mangen = "0.2.2"
dirs-next = "2.0.0"
xtaskops = "0.2.2"
iroh = { path = "../iroh" }
8 changes: 8 additions & 0 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ struct Cli {

#[derive(Debug, Subcommand)]
enum Commands {
#[command(about = "generate code coverage report", long_about = None)]
Coverage {},
#[command(about = "build application and man pages", long_about = None)]
Dist {},
#[command(about = "build man pages")]
Expand Down Expand Up @@ -68,6 +70,7 @@ fn main() {

fn run_subcommand(args: Cli) -> Result<()> {
match args.command {
Commands::Coverage {} => coverage()?,
Commands::Dist {} => dist()?,
Commands::Man {} => dist_manpage()?,
Commands::DevInstall { build } => dev_install(build)?,
Expand All @@ -86,6 +89,11 @@ fn run_subcommand(args: Cli) -> Result<()> {
Ok(())
}

fn coverage() -> Result<()> {
xtaskops::tasks::coverage(false)?;
Ok(())
}

fn dist() -> Result<()> {
let _ = fs::remove_dir_all(&dist_dir());
fs::create_dir_all(&dist_dir())?;
Expand Down

0 comments on commit c625b6e

Please sign in to comment.