Skip to content

Refactor agent followup #1145

Refactor agent followup

Refactor agent followup #1145

Workflow file for this run

name: Tarpaulin Code Coverage
on:
push:
branches: [ main ]
paths:
- .github/workflows/run-tarpaulin.yml
- '**.rs'
- '**/Cargo.toml'
pull_request:
branches: [ main ]
paths:
- .github/workflows/run-tarpaulin.yml
- '**.rs'
- '**/Cargo.toml'
env:
CARGO_TERM_COLOR: always
CARGO_VERSION: 1.73.0
jobs:
build:
runs-on: ubuntu-latest
# There is a second, hidden timeout in this workflow. When the tarpaulin container is created,
# it is created with a CMD that sleeps for 600 minutes. A more reasonable value could be selected,
# but it seems easier to make it SOOOO big that timeout-minutes is likely to never be impacted by
# it.
#
# But, if this workflow is mysteriously timing out after 600 minutes, make changes to the docker
# create command in the Create tarpaulin instance step.
timeout-minutes: 30
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Create tarpaulin instance
run: docker create --network host --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin:0.27.1 bash -c "echo 'sleep 600m; echo bye' > /tmp/keep_alive.sh; chmod 777 /tmp/keep_alive.sh; /tmp/keep_alive.sh" > container_id.txt
- name: Start tarpaulin instance
run: docker start $(cat container_id.txt)
- name: Install linux requirement in tarpaulin instance
run: docker exec $(cat container_id.txt) sh -c "echo Run apt update and apt install the following dependencies - git curl libssl-dev pkg-config libudev-dev libv4l-dev protobuf-compiler ; apt update ; apt install -y git curl libssl-dev pkg-config libudev-dev libv4l-dev protobuf-compiler"
- name: Install desired rust version
run: docker exec $(cat container_id.txt) sh -c "rustup install $CARGO_VERSION"
- name: Tell cargo to use desired rust version
run: docker exec $(cat container_id.txt) sh -c "rustup override set $CARGO_VERSION"
- name: Install rust requirements in tarpaulin instance
run: docker exec $(cat container_id.txt) sh -c "rustup component add rustfmt"
- name: Run tarpaulin
run: docker exec $(cat container_id.txt) sh -c "RUST_LOG=trace cargo tarpaulin -v --all-features --out Xml"
- name: Upload report to codecov for push
if: (!(startsWith(github.event_name, 'pull_request')))
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: true
verbose: true
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: cobertura.xml