-
Notifications
You must be signed in to change notification settings - Fork 279
164 lines (155 loc) · 5.45 KB
/
iroha2-dev-pr.yml
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
name: I2::Dev::Tests
on:
pull_request:
branches: [iroha2-dev]
paths:
- '**.rs'
- '**.json'
- '**.toml'
- '.github/workflows/**.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CLIENT_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test"
jobs:
consistency:
runs-on: [self-hosted, Linux, iroha2ci]
container:
image: hyperledger/iroha2-ci:nightly-2023-06-25
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Check config.md
if: always()
run: ./scripts/tests/consistency.sh docs
- name: Check genesis.json
if: always()
run: ./scripts/tests/consistency.sh genesis
- name: Check client/config.json
if: always()
run: ./scripts/tests/consistency.sh client
- name: Check peer/config.json
if: always()
run: ./scripts/tests/consistency.sh peer
- name: Check schema.json
if: always()
run: ./scripts/tests/consistency.sh schema
- name: Check Docker Compose configurations
if: always()
run: ./scripts/tests/consistency.sh docker-compose
with_coverage:
runs-on: [self-hosted, Linux, iroha2ci]
container:
image: hyperledger/iroha2-ci:nightly-2023-06-25
steps:
- uses: actions/checkout@v3
# TODO Remove this step #2165
# - name: Adjust toolchain
# run: |
# rustup component add llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Run tests, with coverage
run: |
mold --run cargo llvm-cov clean --workspace
mold --run cargo llvm-cov --doc --no-report --all-features --workspace --no-fail-fast
mold --run cargo llvm-cov --no-report --ignore-filename-regex main.rs --all-features --workspace --no-fail-fast
- name: Generate lcov report
run: |
# generate report without tests
# https://github.com/taiki-e/cargo-llvm-cov#merge-coverages-generated-under-different-test-conditions
mold --run cargo llvm-cov --doctests --no-run --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to coveralls.io
uses: coverallsapp/github-action@v2
with:
file: lcov.info
compare-ref: ${{ github.base_ref }}
compare-sha: ${{ github.event.pull_request.base.sha}}
github-token: ${{ secrets.GITHUB_TOKEN }}
allow-empty: true
fail_ci_if_error: true
integration:
runs-on: [self-hosted, Linux, iroha2ci]
container:
image: hyperledger/iroha2-ci:nightly-2023-06-25
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Run tests, with no-default-features
run: |
mold --run cargo test --test mod --no-default-features -- \
integration:: --skip unstable_network
unstable:
runs-on: [self-hosted, Linux, iroha2ci]
container:
image: hyperledger/iroha2-ci:nightly-2023-06-25
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: mold --run cargo test -p iroha_client --tests --no-default-features unstable_network --quiet
# Run the job to check that the docker containers are properly buildable
pr-generator-build:
# Job will only execute if the head of the pull request is a branch for PR-generator case
if: startsWith(github.head_ref, 'iroha2-pr-deploy/')
runs-on: [self-hosted, Linux, iroha2-dev-push]
container:
image: hyperledger/iroha2-ci:nightly-2023-06-25
steps:
- uses: actions/checkout@v3
- name: Login to Soramitsu Harbor
uses: docker/login-action@v2
with:
registry: docker.soramitsu.co.jp
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_TOKEN }}
- name: Set up Docker Buildx
id: buildx
if: always()
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Build and push iroha2:dev image
uses: docker/build-push-action@v4
if: always()
with:
push: true
tags: docker.soramitsu.co.jp/iroha2/iroha2:dev-${{ github.event.pull_request.head.sha }}
labels: commit=${{ github.sha }}
build-args: TAG=dev
file: Dockerfile
# This context specification is required
context: .
client-cli-tests:
runs-on: [self-hosted, Linux, iroha2ci]
container:
image: hyperledger/iroha2-ci:nightly-2023-06-25
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Build binaries
run: |
cargo build --bin iroha_client_cli
cargo build --bin kagami
cargo build --bin iroha
- name: Setup test Iroha 2 environment on the bare metal
run: |
./scripts/test_env.py setup
- name: Mark binaries as executable
run: |
chmod +x ${{ env.CLIENT_CLI_DIR }}
- name: Install dependencies using Poetry
working-directory: client_cli/pytests
run: |
poetry install
- name: Run client cli tests
working-directory: client_cli/pytests
run: |
poetry run pytest
- name: Cleanup test environment
run: |
./scripts/test_env.py cleanup