summaryrefslogtreecommitdiff
path: root/.github/workflows/codecov.yml
blob: cd18818b7f63e62c12feaf172a3f4a52aee08f2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
on:
  push:
    branches-ignore:
      - '**.tmp'

name: codecov

jobs:
  codecov:
    runs-on: ubuntu-20.04
    env:
      ZFS_TEMPFS: tpool
    steps:
      - uses: actions/checkout@v1
      - name: Setup Rust Toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          override: true
          components: llvm-tools-preview

      - uses: Swatinem/rust-cache@v1

      # note: this works around the gha images sometimes not being up-to-date
      # with ubuntu mirrors, which can result in 404s when fetching packages
      - name: apt-get update
        run: sudo apt-get -o Acquire::Retries=3 update

      - name: Install dependencies
        run: sudo apt install libzfslinux-dev zfsutils-linux

      - name: Setup test pool
        run: sudo ./zfs-core/test-prepare "${ZFS_TEMPFS}"

      - name: Run tests & generate coverage info
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features --no-fail-fast
        env:
          CARGO_INCREMENTAL: '0'
          RUSTFLAGS: '-Zinstrument-coverage'
          LLVM_PROFILE_FILE: 'rust-libzfs-%p-%m.profraw'

      - run: curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-linux-x86_64.tar.bz2 | tar jxf -
      - run: ./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
      - run: bash <(curl -s https://codecov.io/bash) -f lcov.info
      - name: Run codacy-coverage-reporter
        uses: codacy/codacy-coverage-reporter-action@v1
        with:
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          coverage-reports: lcov.info