From 104d48e03a7b94ddb9e33dd0d3163235faeea2b0 Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Tue, 16 Feb 2021 16:05:27 -0300 Subject: [PATCH 1/2] bring coverage and docs back into CI --- .github/workflows/coverage.yml | 54 ++++++++++++++++++++++++++ .github/workflows/docs.yml | 70 ++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..60b007d4335 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,54 @@ +name: CI + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + + coverage: + name: Coverage (+nightly) + timeout-minutes: 30 + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + profile: minimal + components: llvm-tools-preview + + - name: Install rustfilt symbol demangler + run: | + cargo install rustfilt + - name: Rerun tests for coverage + env: + RUSTFLAGS: -Zinstrument-coverage -C link-dead-code -C debuginfo=2 + LLVM_PROFILE_FILE: "${{ github.workspace }}/test.%p.profraw" + ZEBRA_SKIP_NETWORK_TESTS: 1 + run: | + cargo test + cargo test --no-run --message-format=json | jq -r "select(.profile.test == true) | .filenames[]" | grep -v dSYM - > filenames.txt + - name: Merge coverage data + run: | + $(rustc --print target-libdir)/../bin/llvm-profdata merge test.*.profraw -o test.profdata + - name: Generate detailed html coverage report for github artifact + run: | + $(rustc --print target-libdir)/../bin/llvm-cov show -format=html -ignore-filename-regex=".*/.cargo/registry/.*" -ignore-filename-regex=".*/.cargo/git/.*" -ignore-filename-regex=".*/.rustup/.*" -Xdemangler=rustfilt -show-instantiations -output-dir=./coverage -instr-profile=./test.profdata $(printf -- "-object %s " $(cat filenames.txt)) + - uses: actions/upload-artifact@v2 + with: + name: coverage + path: ./coverage + + - name: Generate lcov coverage report for codecov + run: | + $(rustc --print target-libdir)/../bin/llvm-cov export -format=lcov -instr-profile=test.profdata $(printf -- "-object %s " $(cat filenames.txt)) > "lcov.info" + - name: Upload coverage report to Codecov + uses: codecov/codecov-action@v1 + diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000000..24595aed20e --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,70 @@ +name: Docs + +on: + push: + branches: + - main + +jobs: + + build: + name: Build and Deploy Docs (+beta) + timeout-minutes: 30 + runs-on: ubuntu-latest + steps: + - name: Checkout the source code + uses: actions/checkout@master + + - name: Install latest beta + uses: actions-rs/toolchain@v1 + with: + toolchain: beta + override: true + + - name: Install mdbook + run: | + cd book + curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.5/mdbook-v0.4.5-x86_64-unknown-linux-gnu.tar.gz | tar xz + # Add the book directory to the $PATH + echo "$GITHUB_WORKSPACE/book" >> $GITHUB_PATH + - name: Build Zebra book + run: | + mdbook build book/ + - name: Deploy Zebra book to firebase + uses: w9jds/firebase-action@v2.0.0 + with: + args: deploy + env: + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} + PROJECT_PATH: book/ + PROJECT_ID: zebra-book + + - name: Build external docs + run: | + # Exclude zebra-utils, it is not for library or app users + cargo doc --no-deps --workspace --exclude zebra-utils + env: + RUSTDOCFLAGS: "--html-in-header katex-header.html" + + - name: Deploy external docs to firebase + uses: w9jds/firebase-action@v2.0.0 + with: + args: deploy + env: + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} + PROJECT_ID: zealous-zebra + + - name: Build internal docs + run: | + cargo doc --no-deps --document-private-items + env: + RUSTDOCFLAGS: "--html-in-header katex-header.html" + + - name: Deploy external docs to firebase + uses: w9jds/firebase-action@v2.0.0 + with: + args: deploy + env: + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} +PROJECT_ID: zebra-doc-internal + From 5edc34d91c7ee2204c4a75c331934e0669e227ab Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Tue, 16 Feb 2021 19:56:12 -0300 Subject: [PATCH 2/2] change coverage to run on ubuntu-latest --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 60b007d4335..c154c80e57a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,7 +13,7 @@ jobs: coverage: name: Coverage (+nightly) timeout-minutes: 30 - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2