From 9faf1211039f8c8b0352df73db93a14076ca22f8 Mon Sep 17 00:00:00 2001 From: Frank Yang Date: Sun, 18 Dec 2022 15:04:41 +0800 Subject: [PATCH] ci: add codecov Signed-off-by: Frank Yang --- .github/workflows/build.yml | 80 +++++++++++++++++++++++++++++++++++++ tests/integration.rs | 2 + 2 files changed, 82 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3cb0f59dd6..4b9bc68f1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -250,3 +250,83 @@ jobs: - name: "Test Go SDK" run: make test-sdk-go + + code-coverage: + name: Run code coverage + runs-on: ${{ matrix.config.os }} + needs: build-rust + strategy: + matrix: + config: + - { + os: "ubuntu-latest", + extension: "", + # We have this enabled for releases, so we should test it. + extraArgs: "--features openssl/vendored", + bindleUrl: "https://bindle.blob.core.windows.net/releases/bindle-v0.8.0-linux-amd64.tar.gz", + bindleBinary: "bindle-server", + pathInBindleArchive: "bindle-server", + nomadUrl: "https://releases.hashicorp.com/nomad/1.3.1/nomad_1.3.1_linux_amd64.zip", + nomadBinary: "nomad", + pathInNomadArchive: "nomad", + hippoUrl: "https://github.com/deislabs/hippo/releases/download/v0.19.0/hippo-server-linux-x64.tar.gz", + } + steps: + - uses: actions/checkout@v2 + + - name: Install latest Rust stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + + - name: "Install Wasm Rust target" + run: rustup target add wasm32-wasi + + - name: Install bindle + uses: engineerd/configurator@v0.0.8 + with: + name: ${{ matrix.config.bindleBinary }} + url: ${{ matrix.config.bindleUrl }} + pathInArchive: ${{ matrix.config.pathInBindleArchive }} + + - name: Install nomad + uses: engineerd/configurator@v0.0.8 + with: + name: ${{ matrix.config.nomadBinary }} + url: ${{ matrix.config.nomadUrl }} + pathInArchive: ${{ matrix.config.pathInNomadArchive }} + + - name: Install hippo + run: | + curl -L ${{ matrix.config.hippoUrl }} -o hippo-server.tar.gz + mkdir hippo-server-output + tar xz -C hippo-server-output -f hippo-server.tar.gz + cp -r hippo-server-output/**/* ~/configurator/bin + chmod +x ~/configurator/bin/Hippo.Web + + - name: Install cargo-tarpaulin binary crate + uses: actions-rs/install@v0.1 + with: + crate: cargo-tarpaulin + version: latest + use-tool-cache: true + + - name: Cargo Tarpaulin + run: cargo tarpaulin --follow-exec --skip-clean -t 6000 --out xml --features openssl/vendored,default,e2e-tests + env: + RUST_LOG: spin=trace + + - name: Upload to codecov.io + uses: codecov/codecov-action@v3 + if: ${{ github.ref == 'refs/heads/main' }} + with: + fail_ci_if_error: true + verbose: true + + - name: Archive code coverage results + uses: actions/upload-artifact@v3 + if: ${{ github.ref == 'refs/heads/main' }} + with: + name: code-coverage-report + path: cobertura.xml diff --git a/tests/integration.rs b/tests/integration.rs index 76e24cc861..aeb0d0180f 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -1260,12 +1260,14 @@ route = "/..." /// Build an app whose component `workdir` is a subdirectory. #[tokio::test] + #[cfg(not(tarpaulin))] async fn test_build_command_nested_workdir() -> Result<()> { do_test_build_command("tests/build/nested").await } /// Build an app whose component `workdir` is a sibling. #[tokio::test] + #[cfg(not(tarpaulin))] async fn test_build_command_sibling_workdir() -> Result<()> { do_test_build_command("tests/build/sibling").await }