2022-05-09 12:54:16 -07:00
|
|
|
name: CI OSes
|
2020-10-12 14:19:00 -07:00
|
|
|
|
2021-02-15 17:50:32 -08:00
|
|
|
on:
|
2021-02-16 14:04:00 -08:00
|
|
|
workflow_dispatch:
|
2022-04-20 17:33:08 -07:00
|
|
|
# we build Rust and Zcash parameter caches on main,
|
|
|
|
# so they can be shared by all branches:
|
|
|
|
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
# production code and test code
|
|
|
|
- '**/*.rs'
|
|
|
|
# hard-coded checkpoints
|
|
|
|
# TODO: skip proptest regressions
|
|
|
|
- '**/*.txt'
|
|
|
|
# dependencies
|
|
|
|
- '**/Cargo.toml'
|
|
|
|
- '**/Cargo.lock'
|
|
|
|
# workflow definitions
|
|
|
|
- '.github/workflows/ci.yml'
|
2021-02-15 17:50:32 -08:00
|
|
|
pull_request:
|
2022-02-11 06:05:19 -08:00
|
|
|
paths:
|
2022-03-02 06:23:05 -08:00
|
|
|
# code and tests
|
2022-01-25 03:58:11 -08:00
|
|
|
- '**/*.rs'
|
2022-03-04 11:55:49 -08:00
|
|
|
# hard-coded checkpoints and proptest regressions
|
2022-01-25 03:58:11 -08:00
|
|
|
- '**/*.txt'
|
2022-03-02 06:23:05 -08:00
|
|
|
# test data snapshots
|
|
|
|
- '**/*.snap'
|
|
|
|
# dependencies
|
2022-01-25 03:58:11 -08:00
|
|
|
- '**/Cargo.toml'
|
|
|
|
- '**/Cargo.lock'
|
|
|
|
- '**/deny.toml'
|
2022-03-02 06:23:05 -08:00
|
|
|
# workflow definitions
|
2022-05-09 12:54:16 -07:00
|
|
|
- '.github/workflows/continous-integration-os.yml'
|
2020-09-23 18:52:52 -07: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
|
2022-08-22 20:43:18 -07:00
|
|
|
RUST_LOG: info
|
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
|
|
|
RUST_BACKTRACE: full
|
2022-03-08 07:09:41 -08:00
|
|
|
RUST_LIB_BACKTRACE: full
|
|
|
|
COLORBT_SHOW_HIDDEN: '1'
|
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
|
|
|
|
2019-09-05 10:08:48 -07:00
|
|
|
jobs:
|
2020-05-14 13:31:01 -07:00
|
|
|
test:
|
2022-02-18 14:53:27 -08:00
|
|
|
name: Test ${{ matrix.rust }} on ${{ matrix.os }}
|
2021-11-25 08:26:32 -08:00
|
|
|
# The large timeout is to accommodate:
|
2022-04-19 17:58:55 -07:00
|
|
|
# - Windows builds (75 minutes, typically 30-50 minutes), and
|
|
|
|
# - parameter downloads (an extra 90 minutes, but only when the cache expires)
|
|
|
|
timeout-minutes: 165
|
2020-05-14 13:31:01 -07:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
2021-02-18 15:54:35 -08:00
|
|
|
fail-fast: false
|
2020-05-14 13:31:01 -07:00
|
|
|
matrix:
|
2022-03-09 16:50:12 -08:00
|
|
|
# TODO: Windows was removed for now, see https://github.com/ZcashFoundation/zebra/issues/3801
|
2022-04-11 22:06:37 -07:00
|
|
|
os: [ubuntu-latest, macos-latest]
|
2022-06-21 21:35:18 -07:00
|
|
|
rust: [stable, beta]
|
2022-08-22 20:43:18 -07:00
|
|
|
exclude:
|
|
|
|
# TODO: re-enable beta Rust tests on ubuntu (#4929)
|
|
|
|
- os: ubuntu-latest
|
|
|
|
rust: beta
|
2022-06-21 21:35:18 -07:00
|
|
|
# We're excluding macOS for the following reasons:
|
|
|
|
# - the concurrent macOS runner limit is much lower than the Linux limit
|
|
|
|
# - macOS is slower than Linux, and shouldn't have a build or test difference with Linux
|
|
|
|
# - macOS is a second-tier Zebra support platform
|
|
|
|
- os: macos-latest
|
|
|
|
rust: beta
|
2020-05-14 13:31:01 -07:00
|
|
|
|
2019-09-05 10:08:48 -07:00
|
|
|
steps:
|
2022-04-21 20:00:02 -07:00
|
|
|
- uses: actions/checkout@v3.0.2
|
2021-05-16 16:32:38 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2020-05-14 13:31:01 -07:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
2021-02-11 07:06:54 -08:00
|
|
|
toolchain: ${{ matrix.rust }}
|
2021-04-29 13:47:15 -07:00
|
|
|
profile: minimal
|
2020-05-14 13:31:01 -07:00
|
|
|
override: true
|
2021-06-14 18:36:33 -07:00
|
|
|
|
|
|
|
- uses: Swatinem/rust-cache@v1
|
|
|
|
|
2020-05-14 13:31:01 -07:00
|
|
|
- name: cargo fetch
|
2021-05-12 14:54:02 -07:00
|
|
|
uses: actions-rs/cargo@v1.0.3
|
2020-05-14 13:31:01 -07:00
|
|
|
with:
|
|
|
|
command: fetch
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2020-10-18 21:03:24 -07:00
|
|
|
- name: Install LLVM on Windows
|
2020-08-18 11:08:53 -07:00
|
|
|
if: matrix.os == 'windows-latest'
|
2021-04-19 03:39:24 -07:00
|
|
|
run: |
|
|
|
|
choco install llvm -y
|
|
|
|
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2021-11-19 15:02:56 -08:00
|
|
|
- name: Skip network tests on Ubuntu and Windows
|
2021-11-22 09:26:07 -08:00
|
|
|
# Ubuntu runners don't have reliable network or DNS during test steps.
|
2021-11-19 15:02:56 -08:00
|
|
|
# Windows runners have an unreliable network.
|
|
|
|
shell: bash
|
2022-04-11 22:06:37 -07:00
|
|
|
if: matrix.os != 'macos-latest'
|
2020-10-18 21:03:24 -07:00
|
|
|
run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" >> $GITHUB_ENV
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2021-11-22 09:26:07 -08:00
|
|
|
- name: Minimise proptest cases on macOS and Windows
|
|
|
|
# We set cases to 1, because some tests already run 1 case by default.
|
|
|
|
# We keep maximum shrink iterations at the default value, because it only happens on failure.
|
|
|
|
#
|
|
|
|
# Windows compilation and tests are slower than other platforms.
|
|
|
|
# macOS runners do extra network tests, so they take longer.
|
|
|
|
shell: bash
|
|
|
|
if: matrix.os != 'ubuntu-latest'
|
|
|
|
run: |
|
2022-04-11 22:06:37 -07:00
|
|
|
echo "PROPTEST_CASES=1" >> $GITHUB_ENV
|
|
|
|
echo "PROPTEST_MAX_SHRINK_ITERS=1024" >> $GITHUB_ENV
|
2021-11-22 09:26:07 -08:00
|
|
|
|
2021-11-02 11:46:57 -07:00
|
|
|
- name: Change target output directory on Windows
|
|
|
|
# Windows doesn't have enough space on the D: drive, so we redirect the build output to the
|
|
|
|
# larger C: drive.
|
|
|
|
# TODO: Remove this workaround once the build is more efficient (#3005).
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
run: |
|
|
|
|
mkdir C:\zebra-target
|
|
|
|
echo "CARGO_TARGET_DIR=C:\zebra-target" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
|
|
|
2021-11-19 15:02:56 -08:00
|
|
|
# Modified from:
|
|
|
|
# https://github.com/zcash/librustzcash/blob/c48bb4def2e122289843ddb3cb2984c325c03ca0/.github/workflows/ci.yml#L20-L33
|
2022-05-11 07:06:58 -07:00
|
|
|
#
|
|
|
|
# TODO: split get-params-path and download-params examples into their own crate,
|
|
|
|
# to speed up compilation
|
|
|
|
# compile examples in release mode, to speed up downloads
|
2021-11-19 15:02:56 -08:00
|
|
|
- name: Fetch path to Zcash parameters
|
|
|
|
working-directory: ./zebra-consensus
|
|
|
|
shell: bash
|
|
|
|
run: echo "ZCASH_PARAMS=$(cargo run --example get-params-path)" >> $GITHUB_ENV
|
|
|
|
- name: Cache Zcash parameters
|
|
|
|
id: cache-params
|
2022-03-21 16:08:25 -07:00
|
|
|
uses: actions/cache@v3
|
2021-11-19 15:02:56 -08:00
|
|
|
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 run --example download-params
|
|
|
|
|
2020-05-14 13:31:01 -07:00
|
|
|
- name: Run tests
|
2021-05-12 14:54:02 -07:00
|
|
|
uses: actions-rs/cargo@v1.0.3
|
2020-05-14 13:31:01 -07:00
|
|
|
with:
|
|
|
|
command: test
|
2022-05-11 16:41:33 -07:00
|
|
|
args: --verbose --workspace -- --nocapture
|
2021-08-23 07:17:33 -07:00
|
|
|
|
2021-02-19 01:36:32 -08:00
|
|
|
# Explicitly run any tests that are usually #[ignored]
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2020-10-27 02:25:29 -07:00
|
|
|
- name: Run zebrad large sync tests
|
2021-02-19 01:36:32 -08:00
|
|
|
# Skip the entire step on Ubuntu and Windows, because the test would be skipped anyway due to ZEBRA_SKIP_NETWORK_TESTS
|
2022-04-11 22:06:37 -07:00
|
|
|
if: matrix.os == 'macos-latest'
|
2021-05-12 14:54:02 -07:00
|
|
|
uses: actions-rs/cargo@v1.0.3
|
2020-10-27 02:25:29 -07:00
|
|
|
with:
|
|
|
|
command: test
|
2021-10-21 16:51:20 -07:00
|
|
|
# Note: this only runs the zebrad acceptance tests, because re-running all the test binaries is slow on Windows
|
2022-05-11 16:41:33 -07:00
|
|
|
args: --verbose --package zebrad --test acceptance -- --nocapture --include-ignored sync_large_checkpoints_
|
2020-08-14 16:51:03 -07:00
|
|
|
|
2022-05-11 16:41:33 -07:00
|
|
|
# Install Zebra with lockfile dependencies, with no caching and default features
|
2022-03-30 14:53:57 -07:00
|
|
|
install-from-lockfile-no-cache:
|
|
|
|
name: Install zebrad from lockfile without cache on ubuntu-latest
|
|
|
|
timeout-minutes: 60
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-04-21 20:00:02 -07:00
|
|
|
- uses: actions/checkout@v3.0.2
|
2022-03-30 14:53:57 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Install
|
|
|
|
uses: actions-rs/cargo@v1.0.3
|
|
|
|
with:
|
|
|
|
command: install
|
|
|
|
args: --locked --path ./zebrad/ zebrad
|
|
|
|
|
2022-05-11 16:41:33 -07:00
|
|
|
# Check that Cargo.lock includes any Cargo.toml changes.
|
|
|
|
# This check makes sure the `cargo-deny` crate dependency checks are accurate.
|
|
|
|
check-cargo-lock:
|
|
|
|
name: Check Cargo.lock is up to date
|
2021-02-16 07:53:04 -08:00
|
|
|
timeout-minutes: 60
|
2021-04-29 13:54:47 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2020-08-14 16:51:03 -07:00
|
|
|
steps:
|
2022-04-21 20:00:02 -07:00
|
|
|
- uses: actions/checkout@v3.0.2
|
2021-05-16 16:32:38 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2020-08-14 16:51:03 -07:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
2021-04-29 13:54:47 -07:00
|
|
|
toolchain: stable
|
2021-04-29 13:47:15 -07:00
|
|
|
profile: minimal
|
2020-08-14 16:51:03 -07:00
|
|
|
override: true
|
2021-06-14 18:36:33 -07:00
|
|
|
|
|
|
|
- uses: Swatinem/rust-cache@v1
|
2022-05-18 19:43:08 -07:00
|
|
|
|
2022-01-25 03:58:11 -08:00
|
|
|
- name: Check Cargo.lock is up to date
|
|
|
|
uses: actions-rs/cargo@v1.0.3
|
|
|
|
with:
|
|
|
|
command: check
|
|
|
|
args: --locked --all-features --all-targets
|
|
|
|
|
|
|
|
cargo-deny:
|
2022-06-20 19:30:45 -07:00
|
|
|
name: Check deny.toml ${{ matrix.checks }} ${{ matrix.features }}
|
2020-04-21 01:51:05 -07:00
|
|
|
runs-on: ubuntu-latest
|
2022-01-25 03:58:11 -08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
checks:
|
2022-02-21 09:41:31 -08:00
|
|
|
- bans
|
2022-01-25 03:58:11 -08:00
|
|
|
- sources
|
2022-06-20 19:30:45 -07:00
|
|
|
features: ['', '--all-features', '--no-default-features']
|
2021-11-22 09:26:07 -08:00
|
|
|
|
2022-01-25 03:58:11 -08:00
|
|
|
# Prevent sudden announcement of a new advisory from failing ci:
|
|
|
|
continue-on-error: ${{ matrix.checks == 'advisories' }}
|
2021-02-16 14:04:00 -08:00
|
|
|
|
2020-05-27 19:12:25 -07:00
|
|
|
steps:
|
2022-04-21 20:00:02 -07:00
|
|
|
- uses: actions/checkout@v3.0.2
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
|
2022-06-20 19:30:45 -07:00
|
|
|
# this check also runs with optional features off
|
2022-04-11 22:06:37 -07:00
|
|
|
# so we expect some warnings about "skip tree root was not found"
|
2022-06-20 19:30:45 -07:00
|
|
|
- name: Check ${{ matrix.checks }} with features ${{ matrix.features }}
|
|
|
|
uses: EmbarkStudios/cargo-deny-action@v1
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
command: check ${{ matrix.checks }}
|
2022-06-20 19:30:45 -07:00
|
|
|
args: --workspace with features ${{ matrix.features }}
|