2021-07-07 07:36:54 -07:00
|
|
|
name: Coverage
|
2021-02-16 11:05:27 -08:00
|
|
|
|
|
|
|
on:
|
2021-06-14 18:36:33 -07:00
|
|
|
workflow_dispatch:
|
2021-02-16 11:05:27 -08:00
|
|
|
pull_request:
|
2022-02-11 06:05:19 -08:00
|
|
|
paths:
|
2022-01-25 03:58:11 -08:00
|
|
|
- '**/*.rs'
|
|
|
|
- '**/*.txt'
|
|
|
|
- '**/Cargo.toml'
|
|
|
|
- '**/Cargo.lock'
|
|
|
|
- 'codecov.yml'
|
|
|
|
- '.github/workflows/coverage.yml'
|
2021-02-16 11:05:27 -08:00
|
|
|
|
refactor (actions): make better use of variables, secrets and versions (#3393)
* style: use global variables and don't double print
Remove repeated instances of global environment variables. Do not print ENV variables on the terminal as GitHub Actions already shows it.
* fix (actions): Use fixed major versions for actions
As actions get recurrent fixes, using a specific version causes more maintance on the pipelines.
On the other hand, using @master versions could make some action unreliable, as breaking changes might be included without further notice, and even change behavior on a daily basis.
* refactor: make better use of ENV variables
A whole step with refex was being used to extract different variables from GitHub's environment. This gets depecrated in favor of using `rlespinasse/github-slug-action@v4` which has slug URL variables.
A SLUG on a variable will:
- put the variable content in lower case
- replace any character by - except 0-9, a-z, ., and _
- remove leading and trailing - character
- limit the string size to 63 characters
This changes also takes care of using the Head or Base branch for deployments. This will allow us tomerge of workflows, as most steps on this deployment actions are very similar, with little variations between workflows.
* fix (actions): use secrets for sensitive information
* revert: use specific versions for dependabot
Reverting commit 8c934099028e0651e464678c096d8d3815efe95c
2022-01-26 17:46:18 -08:00
|
|
|
env:
|
|
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
RUST_BACKTRACE: full
|
|
|
|
|
2021-02-16 11:05:27 -08:00
|
|
|
jobs:
|
|
|
|
coverage:
|
|
|
|
name: Coverage (+nightly)
|
2021-11-25 08:26:32 -08:00
|
|
|
# The large timeout is to accommodate:
|
|
|
|
# - nightly builds (75 minutes, typically 30-50 minutes)
|
|
|
|
# - parameter downloads (40 minutes, but only when the cache expires)
|
|
|
|
timeout-minutes: 115
|
2021-02-16 14:56:12 -08:00
|
|
|
runs-on: ubuntu-latest
|
2021-11-19 15:02:56 -08:00
|
|
|
|
2021-02-16 11:05:27 -08:00
|
|
|
steps:
|
2021-11-04 22:08:39 -07:00
|
|
|
- uses: actions/checkout@v2.4.0
|
2021-05-16 16:32:38 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2021-02-16 11:05:27 -08:00
|
|
|
|
2021-06-14 18:35:26 -07:00
|
|
|
- uses: actions-rs/toolchain@v1.0.7
|
2021-02-16 11:05:27 -08:00
|
|
|
with:
|
2022-01-31 17:10:28 -08:00
|
|
|
toolchain: nightly
|
2021-02-16 11:05:27 -08:00
|
|
|
override: true
|
|
|
|
profile: minimal
|
|
|
|
components: llvm-tools-preview
|
|
|
|
|
2021-06-14 18:35:26 -07:00
|
|
|
- name: Install cargo-llvm-cov cargo command
|
2021-08-27 08:03:40 -07:00
|
|
|
run: cargo install cargo-llvm-cov
|
2021-06-14 18:35:26 -07:00
|
|
|
|
2021-11-22 09:26:07 -08:00
|
|
|
- name: Skip network tests on Ubuntu
|
|
|
|
# Ubuntu runners don't have reliable network or DNS during test steps.
|
2021-11-19 15:02:56 -08:00
|
|
|
shell: bash
|
|
|
|
run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" >> $GITHUB_ENV
|
|
|
|
|
2021-11-22 09:26:07 -08:00
|
|
|
- name: Minimise proptest cases in Coverage tests
|
|
|
|
# We set cases to 1, because some tests already run 1 case by default.
|
|
|
|
# We set maximum shrink iterations to 0, because we don't expect failures in these tests.
|
|
|
|
#
|
|
|
|
# Coverage tests are much slower than other tests, particularly in hot loops.
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "PROPTEST_CASES=1" >> $GITHUB_ENV
|
|
|
|
echo "PROPTEST_MAX_SHRINK_ITERS=0" >> $GITHUB_ENV
|
|
|
|
|
2021-11-19 15:02:56 -08:00
|
|
|
# Modified from:
|
|
|
|
# https://github.com/zcash/librustzcash/blob/c48bb4def2e122289843ddb3cb2984c325c03ca0/.github/workflows/ci.yml#L20-L33
|
|
|
|
- name: Fetch path to Zcash parameters
|
|
|
|
working-directory: ./zebra-consensus
|
|
|
|
shell: bash
|
|
|
|
# cargo-llvm-cov doesn't have a silent mode, so we have to extract the path from stderr
|
|
|
|
run: echo "ZCASH_PARAMS=$(cargo llvm-cov --lcov --no-report run --example get-params-path 2>&1 >/dev/null | tail -1)" >> $GITHUB_ENV
|
|
|
|
- name: Cache Zcash parameters
|
|
|
|
id: cache-params
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ env.ZCASH_PARAMS }}
|
2021-11-25 08:26:32 -08:00
|
|
|
key: ${{ runner.os }}-sprout-and-sapling-params
|
2021-11-19 15:02:56 -08:00
|
|
|
- name: Fetch Zcash parameters
|
|
|
|
if: steps.cache-params.outputs.cache-hit != 'true'
|
|
|
|
working-directory: ./zebra-consensus
|
|
|
|
run: cargo llvm-cov --lcov --no-report run --example download-params
|
|
|
|
|
|
|
|
- name: Run Zebra tests
|
|
|
|
run: cargo llvm-cov --lcov --no-report
|
|
|
|
|
|
|
|
- name: Generate coverage report
|
|
|
|
run: cargo llvm-cov --lcov --no-run --output-path lcov.info
|
2021-02-16 11:05:27 -08:00
|
|
|
|
|
|
|
- name: Upload coverage report to Codecov
|
2021-09-13 11:28:37 -07:00
|
|
|
uses: codecov/codecov-action@v2.1.0
|