-
Notifications
You must be signed in to change notification settings - Fork 208
167 lines (153 loc) · 7.14 KB
/
sub-ci-unit-tests-docker.yml
File metadata and controls
167 lines (153 loc) · 7.14 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# Google Cloud unit tests that run when Rust code or dependencies are modified,
# but only on PRs from the ZcashFoundation/zebra repository. (External PRs are tested by GitHub's Merge Queue.)
#
# This workflow is designed for running various unit tests within Docker containers.
# Jobs:
# 1. Builds a Docker image for tests, adaptable to the specified network (Mainnet or Testnet).
# 2. 'test-all': Executes all Zebra tests, including normally ignored ones, in a Docker environment.
# 3. 'sync-large-checkpoints-empty': Tests Zebra's ability to sync and checkpoint from an empty state.
# 4. 'test-lightwalletd-integration': Validates integration with 'lightwalletd' starting from an empty state.
# 5. 'test-docker-configurations': Runs a matrix of configuration tests to validate various Docker configurations.
name: Docker Unit Tests
on:
workflow_call:
inputs:
image_digest:
type: string
network:
type: string
default: "Mainnet"
no_cache:
type: boolean
default: false
env:
RUST_LOG: ${{ vars.RUST_LOG }}
RUST_BACKTRACE: ${{ vars.RUST_BACKTRACE }}
RUST_LIB_BACKTRACE: ${{ vars.RUST_LIB_BACKTRACE }}
COLORBT_SHOW_HIDDEN: ${{ vars.COLORBT_SHOW_HIDDEN }}
CARGO_INCREMENTAL: ${{ vars.CARGO_INCREMENTAL }}
jobs:
test-all:
name: Test all
timeout-minutes: 180
runs-on: ${{ github.repository_owner == 'ZcashFoundation' && 'ubuntu-latest-xl' || 'ubuntu-latest' }}
steps:
- uses: r7kamura/rust-problem-matchers@v1.5.0
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v5
with:
short-length: 7
# Run unit, basic acceptance tests, and ignored tests, only showing
# command output if the test fails.
#
# If some tests hang, add "-- --nocapture" for just that test, or for all
# the tests.
- name: Run all tests
run: |
docker pull ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}@${{ inputs.image_digest }}
docker run --tty \
-e NEXTEST_PROFILE=all-tests \
-e ZEBRA_NETWORK__NETWORK="${{ inputs.network || vars.ZCASH_NETWORK }}" \
-e RUST_LOG=${{ env.RUST_LOG }} \
-e RUST_BACKTRACE=${{ env.RUST_BACKTRACE }} \
-e RUST_LIB_BACKTRACE=${{ env.RUST_LIB_BACKTRACE }} \
-e COLORBT_SHOW_HIDDEN=${{ env.COLORBT_SHOW_HIDDEN }} \
-e CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }} \
${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}@${{ inputs.image_digest }}
# Test that Zebra syncs and checkpoints a few thousand blocks from an empty state.
sync-large-checkpoints-empty:
name: Test checkpoint sync from empty state
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: r7kamura/rust-problem-matchers@v1.5.0
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v5
with:
short-length: 7
- name: Run zebrad large sync tests
run: |
docker pull ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}@${{ inputs.image_digest }}
docker run --tty \
-e NEXTEST_PROFILE=sync-large-checkpoints-empty \
-e TEST_LARGE_CHECKPOINTS=1 \
-e ZEBRA_NETWORK__NETWORK="${{ inputs.network || vars.ZCASH_NETWORK }}" \
-e RUST_LOG=${{ env.RUST_LOG }} \
-e RUST_BACKTRACE=${{ env.RUST_BACKTRACE }} \
-e RUST_LIB_BACKTRACE=${{ env.RUST_LIB_BACKTRACE }} \
-e COLORBT_SHOW_HIDDEN=${{ env.COLORBT_SHOW_HIDDEN }} \
-e CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }} \
${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}@${{ inputs.image_digest }}
# Test launching lightwalletd with an empty lightwalletd and Zebra state.
test-lightwalletd-integration:
name: Lightwalletd integration
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: r7kamura/rust-problem-matchers@v1.5.0
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v5
with:
short-length: 7
- name: Run tests with empty lightwalletd launch
run: |
docker pull ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}@${{ inputs.image_digest }}
docker run --tty \
-e NEXTEST_PROFILE=lwd-integration \
-e TEST_LIGHTWALLETD=1 \
-e ZEBRA_NETWORK__NETWORK="${{ inputs.network || vars.ZCASH_NETWORK }}" \
-e RUST_LOG=${{ env.RUST_LOG }} \
-e RUST_BACKTRACE=${{ env.RUST_BACKTRACE }} \
-e RUST_LIB_BACKTRACE=${{ env.RUST_LIB_BACKTRACE }} \
-e COLORBT_SHOW_HIDDEN=${{ env.COLORBT_SHOW_HIDDEN }} \
-e CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }} \
${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}@${{ inputs.image_digest }}
# Run a matrix of configuration tests against the Docker image
test-docker-configurations:
name: Test Zebra Docker configurations
uses: ./.github/workflows/sub-test-zebra-config.yml
with:
docker_image: ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}@${{ inputs.image_digest }}
failure-issue:
name: Open or update issues for main branch failures
# When a new test is added to this workflow, add it to this list.
#
# This list is for reliable tests that are run on the `main` branch.
# Testnet jobs are not in this list, because we expect testnet to fail occasionally.
needs:
[
test-all,
sync-large-checkpoints-empty,
test-lightwalletd-integration,
test-docker-configurations,
]
# Only open tickets for failed scheduled jobs, manual workflow runs, or `main` branch merges.
# (PR statuses are already reported in the PR jobs list, and checked by GitHub's Merge Queue.)
# TODO: if a job times out, we want to create a ticket. Does failure() do that? Or do we need cancelled()?
if: failure() && github.event.pull_request == null
runs-on: ubuntu-latest
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}"
# New failures open an issue with this label.
# TODO: do we want a different label for each workflow, or each kind of workflow?
label-name: S-ci-fail-auto-issue
# If there is already an open issue with this label, any failures become comments on that issue.
always-create-new-issue: false
github-token: ${{ secrets.GITHUB_TOKEN }}
check-no-git-dependencies:
if: contains(github.event.pull_request.labels.*.name, 'A-release')
runs-on: ubuntu-latest
steps:
- name: Run check_no_git_refs_in_cargo_lock
run: |
docker pull ${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}@${{ inputs.image_digest }}
docker run --tty \
-e NEXTEST_PROFILE=check-no-git-dependencies \
-e ZEBRA_NETWORK__NETWORK="${{ inputs.network || vars.ZCASH_NETWORK }}" \
-e RUST_LOG=${{ env.RUST_LOG }} \
-e RUST_BACKTRACE=${{ env.RUST_BACKTRACE }} \
-e RUST_LIB_BACKTRACE=${{ env.RUST_LIB_BACKTRACE }} \
-e COLORBT_SHOW_HIDDEN=${{ env.COLORBT_SHOW_HIDDEN }} \
${{ vars.GAR_BASE }}/${{ vars.CI_IMAGE_NAME }}@${{ inputs.image_digest }}