-
-
Notifications
You must be signed in to change notification settings - Fork 10
156 lines (125 loc) · 5.35 KB
/
ci.yml
File metadata and controls
156 lines (125 loc) · 5.35 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
name: CI
permissions:
contents: read
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci.yml'
- 'openstack_cli/**'
- 'openstack_sdk/**'
- 'openstack_tui/**'
- 'openstack_types/**'
- 'fuzz/**'
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.88
# - 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@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Rust
uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0 # stable
with:
targets: ${{ matrix.target }}
toolchain: ${{ matrix.rust_ver }}
- name: Install cargo-nextest
uses: taiki-e/install-action@522492a8c115f1b6d4d318581f09638e9442547b # v2.62.21
with:
tool: cargo-nextest
- name: Rust Cache
uses: swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- 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@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Rust
uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0 # stable
with:
toolchain: nightly
- name: Rust Cache
uses: swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- name: Install cargo-fuzz
run: |
cargo install cargo-fuzz
- name: Run tests
run: cargo +nightly fuzz run fuzz_openstack_sdk_config --features=fuzzing -- -max_total_time=60
mock:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Rust
uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0 # stable
with:
toolchain: stable
- name: Rust Cache
uses: swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- 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