From cb6f78df0319690e484ff54e30e3f965247bb494 Mon Sep 17 00:00:00 2001 From: Yashodhan Joshi Date: Mon, 6 Sep 2021 10:37:39 +0530 Subject: [PATCH 1/3] Change Code coverage CI See https://github.com/actions-rs/grcov/issues/105 and https://github.com/PyO3/pyo3/blob/main/.github/workflows/ci.yml --- .github/workflows/main.yml | 56 ++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66da3ca5..b3302bce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -77,25 +77,53 @@ jobs: run: ./build.sh --release - name: Run tests run: cargo test --no-fail-fast - # env: - # CARGO_INCREMENTAL: "0" - # RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests" - # RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests" - name: Run doc tests run: cargo test --doc - name: Run cgroup tests working-directory: cgroups run: cargo test --no-fail-fast - # env: - # CARGO_INCREMENTAL: "0" - # RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests" - # RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests" - # - name: Coverage - # uses: actions-rs/grcov@v0.1 - # with: - # config: .github/grcov.yml - # - name: Upload Results - # uses: codecov/codecov-action@v2 + coverage: + name: Run test coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry + ~/.cargo/git + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + continue-on-error: true + - name: install cargo-llvm-cov + run: | + wget https://github.com/taiki-e/cargo-llvm-cov/releases/download/v${CARGO_LLVM_COV_VERSION}/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz -qO- | tar -xzvf - + mv cargo-llvm-cov ~/.cargo/bin + env: + CARGO_LLVM_COV_VERSION: 0.1.5 + - name: Update System Libraries + run: sudo apt-get -y update + - name: Install System Libraries + run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev + - name: Toolchain setup + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + profile: minimal + components: llvm-tools-preview + - name: Run Test Coverage + env: + ALL_PACKAGES: youki cgroups + run: | + cargo llvm-cov clean --workspace + cargo llvm-cov --package $ALL_PACKAGES --no-report + cargo llvm-cov --package $ALL_PACKAGES --no-run --lcov --output-path coverage.lcov + - name: Upload Results + uses: codecov/codecov-action@v2 + with: + file: coverage.lcov integration_tests: runs-on: ubuntu-latest strategy: From f69fef1aadb05c05b294810ed68c08cf10fb01ec Mon Sep 17 00:00:00 2001 From: Yashodhan Joshi Date: Mon, 6 Sep 2021 10:42:51 +0530 Subject: [PATCH 2/3] Remove cgroups from code coverage as it makes CI fail --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3302bce..f9438041 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -115,7 +115,7 @@ jobs: components: llvm-tools-preview - name: Run Test Coverage env: - ALL_PACKAGES: youki cgroups + ALL_PACKAGES: youki run: | cargo llvm-cov clean --workspace cargo llvm-cov --package $ALL_PACKAGES --no-report From a01be9d12e0724c9139f2665f79cf6b3ef820101 Mon Sep 17 00:00:00 2001 From: Yashodhan Joshi Date: Mon, 6 Sep 2021 11:00:50 +0530 Subject: [PATCH 3/3] Try Adding cgroups for code coverage --- .github/workflows/main.yml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9438041..db77ca44 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,8 +20,9 @@ jobs: .: 'src/*' ./test_framework: test_framework/* ./youki_integration_test: youki_integration_test/* + ./cgroups: cgroups/* check: - needs: changes + needs: [changes] runs-on: ubuntu-latest strategy: matrix: @@ -83,8 +84,8 @@ jobs: working-directory: cgroups run: cargo test --no-fail-fast coverage: - name: Run test coverage runs-on: ubuntu-latest + name: Run test coverage steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -113,17 +114,25 @@ jobs: override: true profile: minimal components: llvm-tools-preview - - name: Run Test Coverage - env: - ALL_PACKAGES: youki + - name: Run Test Coverage for youki run: | cargo llvm-cov clean --workspace - cargo llvm-cov --package $ALL_PACKAGES --no-report - cargo llvm-cov --package $ALL_PACKAGES --no-run --lcov --output-path coverage.lcov - - name: Upload Results + cargo llvm-cov --no-report + cargo llvm-cov --no-run --lcov --output-path ./coverage.lcov + - name: Run Test Coverage for cgroups + working-directory: ./cgroups + run: | + cargo llvm-cov clean --workspace + cargo llvm-cov --no-report + cargo llvm-cov --no-run --lcov --output-path ./coverage.lcov + - name: Upload Youki Code Coverage Results uses: codecov/codecov-action@v2 with: - file: coverage.lcov + file: ./coverage.lcov + - name: Upload Cgroups Code Coverage Results + uses: codecov/codecov-action@v2 + with: + file: ./cgroups/coverage.lcov integration_tests: runs-on: ubuntu-latest strategy: