| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| # ------------------------------------------------------------- |
| # |
| # CI Coverage Rust Workflow |
| # |
| # This workflow runs tests for Rust code and generates coverage report. |
| # This workflow can be triggered manually or by other workflows. |
| # |
| name: ci-coverage-rust |
| |
| on: |
| workflow_dispatch: |
| workflow_call: |
| |
| env: |
| RUST_BACKTRACE: 1 |
| CARGO_TERM_COLOR: always |
| IGGY_CI_BUILD: true |
| GITHUB_BOT_CONTEXT_STRING: "coveralls coverage reporting job" |
| |
| jobs: |
| coverage: |
| name: coverage |
| runs-on: ubuntu-latest |
| timeout-minutes: 30 |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
| |
| - name: Cache cargo & target directories |
| uses: Swatinem/rust-cache@v2 |
| with: |
| key: "coverage" |
| |
| - name: Install gnome-keyring, keyutils and lcov |
| run: | |
| sudo apt-get update --yes && sudo apt-get install --yes gnome-keyring keyutils lcov |
| rm -f $HOME/.local/share/keyrings/* |
| echo -n "test" | gnome-keyring-daemon --unlock |
| |
| - name: Install cargo-llvm-cov |
| uses: taiki-e/install-action@v2 |
| with: |
| tool: cargo-llvm-cov |
| |
| - name: Build |
| run: source <(cargo llvm-cov show-env --export-prefix) && cargo build |
| |
| - name: Test |
| run: source <(cargo llvm-cov show-env --export-prefix) && cargo test |
| |
| - name: Generate code coverage |
| run: source <(cargo llvm-cov show-env --export-prefix) && cargo llvm-cov report --lcov --output-path coverage.lcov --ignore-filename-regex '(bench\/|integration\/|tools\/|tpc\/)' |
| |
| - name: Display code coverage |
| run: lcov --summary coverage.lcov |
| |
| - name: Upload code to Coveralls |
| # Do not upload coverage for user triggered workflows |
| if: ${{ github.event_name == 'workflow_call' }} |
| uses: coverallsapp/github-action@v2 |
| with: |
| fail-on-error: false |
| github-token: ${{ secrets.GITHUB_TOKEN }} |