-
-
Notifications
You must be signed in to change notification settings - Fork 15
171 lines (138 loc) · 6.11 KB
/
Copy pathci.yml
File metadata and controls
171 lines (138 loc) · 6.11 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
168
169
170
171
name: CI
permissions:
contents: read
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci.yml'
- 'auth-*/**'
- 'cli-*/**'
- 'openstack_cli/**'
- 'openstack_sdk/**'
- 'openstack_tui/**'
- 'openstack_types/**'
- 'sdk/**'
- 'fuzz/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
NEXTEST_RETRIES: 3
jobs:
test:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
test_args: ""
rust_ver: 1.91
# - target: x86_64-unknown-linux-musl
# os: ubuntu-latest
# - target: x86_64-apple-darwin
# os: macos-latest
# - target: x86_64-pc-windows-msvc
# os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Cache cargo registry
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- name: Install Rust
uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # stable
with:
targets: ${{ matrix.target }}
toolchain: ${{ matrix.rust_ver }}
- name: Install cargo-nextest
uses: taiki-e/install-action@9e1e5806d4a4822de933115878265be9aaa786d9 # v2.82.2
with:
tool: cargo-nextest
- name: Run tests
run: cargo nextest run ${{ matrix.test_args }} --all-features
- name: Run Doc tests
run: cargo test --doc
fuzz:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Cache cargo registry
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- name: Install Rust
uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # stable
with:
toolchain: nightly
- name: Install cargo-fuzz
run: |
cargo install cargo-fuzz
- name: Run tests
run: |
for target in fuzz_openstack_sdk_config fuzz_openstack_sdk_config_yaml fuzz_link_header fuzz_next_page_from_body fuzz_expand_link fuzz_discovery_endpoints fuzz_api_version fuzz_api_error_from_openstack fuzz_auth_error_response fuzz_build_request_url fuzz_state_cache fuzz_wasm_plugin_identity_http_request fuzz_wasm_plugin_sso_build_response fuzz_wasm_plugin_auth_result; do
cargo +nightly fuzz run "$target" --features=fuzzing -- -max_total_time=60
done
mock:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Cache cargo registry
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- name: Install Rust
uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # stable
with:
toolchain: stable
- name: Start prism mock server - BlockStorage
run: |
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4010:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/block-storage/v3.yaml -d
- name: Start prism mock server - Compute
run: |
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4011:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/compute/v2.yaml -d
- name: Start prism mock server - DNS
run: |
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4012:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/dns/v2.yaml -d
- name: Start prism mock server - Identity
run: |
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4013:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/identity/v3.yaml -d
- name: Start prism mock server - Image
run: |
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4014:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/image/v2.yaml -d
- name: Start prism mock server - Load Balancer
run: |
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4015:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/load-balancer/v2.yaml -d
- name: Start prism mock server - Network
run: |
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4016:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/network/v2.yaml -d
- name: Start prism mock server - Object Storage
run: |
docker run --init --rm -d -v "$GITHUB_WORKSPACE/openstack_types/data":"/data" -p 4017:4010 stoplight/prism:4 mock -h 0.0.0.0 /data/object-store/v1.yaml -d
- name: Run tests
env:
OPENSTACK_BLOCK_STORAGE_ENDPOINT: http://localhost:4010/v3
OPENSTACK_COMPUTE_ENDPOINT: http://localhost:4011/v2.1
OPENSTACK_DNS_ENDPOINT: http://localhost:4012/v2
OPENSTACK_IDENTITY_ENDPOINT: http://localhost:4013/v3
OPENSTACK_IMAGE_ENDPOINT: http://localhost:4014/v2
OPENSTACK_LOAD_BALANCER_ENDPOINT: http://localhost:4015/v2
OPENSTACK_NETWORK_ENDPOINT: http://localhost:4016/v2.0
OPENSTACK_OBJECT_STORE_ENDPOINT: http://localhost:4017/v1
run: cargo test -p openstack_types --test mocked