-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy path.cirrus.yml
168 lines (152 loc) · 5.44 KB
/
.cirrus.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
165
166
167
168
cargo_task_tempate: &cargo_task_template
registry_cache:
folder: $CARGO_HOME/registry
fingerprint_script: cat Cargo.lock
target_cache:
folder: target
fingerprint_script:
- rustc --version
- cat Cargo.lock
setup_script:
- apt-get update
- apt-get -y install llvm clang libelf-dev libpcap-dev python3-pip make jq
- rustup component add rustfmt
- rustup component add clippy
before_cache_script: rm -rf $CARGO_HOME/registry/index
unittest_task:
<< : *cargo_task_template
container:
image: rust:bookworm
build_script: make V=1 CARGO_OPTS=--verbose
test_script: make test V=1 CARGO_OPTS=--verbose
check_script:
- cargo fmt --check
- cargo clippy -- -D warnings
benchmark_task:
<< : *cargo_task_template
container:
image: rust:bookworm
build_script: make bench V=1 CARGO_OPTS=--verbose
test_script:
- ./target/release/retis benchmark --ci events_parsing
- ./target/release/retis benchmark --ci events_output
check_script:
- cargo clippy -F benchmark -- -D warnings
aarch64_task:
<< : *cargo_task_template
name: aarch64 build & basic tests
arm_container:
image: rust:bookworm
build_script:
- ln -s /usr/include/asm-generic /usr/include/asm
- make V=1 CARGO_OPTS=--verbose
test_script: make test V=1 CARGO_OPTS=--verbose
python_task:
name: Python lint & format
container:
image: python:3.11-slim
lint_script:
- python3 -m pip install flake8
- cd tests && python3 -m flake8
format_script:
- python3 -m pip install black
- python3 -m black --check --diff tests/*.py
build_python_lib_task:
container:
image: ghcr.io/pyo3/maturin
build_script:
- maturin build --release -m retis-events/Cargo.toml -F python-lib
dist_artifacts:
path: "target/wheels/*"
test_python_lib_task:
container:
matrix:
- image: python:3.8
- image: python:3.9
- image: python:3.10
- image: python:3.11
- image: python:3.12
setup_script:
- apt-get update
- apt-get install -y curl
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
- chmod +x rustup-init.sh && ./rustup-init.sh -y --profile minimal
build_script:
- source $HOME/.cargo/env
- python -m pip install tox
- make pytest
functional_task:
# Run for PRs with a specific label
required_pr_labels: run-functional-tests
only_if: "$CIRRUS_PR != ''"
matrix: &distro_matrix
- name: Fedora 41 (x86_64)
env:
DISTRO: x86_64-f41
TEST_EXTRA_ARGS: "--ovs-track"
- name: Fedora Rawhide (x86_64)
env:
DISTRO: x86_64-rawhide
TEST_EXTRA_ARGS: "--ovs-track"
- name: Centos 8 Stream (x86_64)
env:
DISTRO: x86_64-c8s
TEST_EXTRA_ARGS: "--ignore=test_ovs.py --ignore=test_nft.py"
CARGO_CMD_OPTS: "--no-default-features"
- name: Centos 9 Stream (x86_64)
env:
DISTRO: x86_64-c9s
TEST_EXTRA_ARGS: "--ovs-track"
- name: Ubuntu Jammy (x86_64)
env:
DISTRO: x86_64-jammy
compute_engine_instance: &nestedvm
image_project: cirrus-images
image: family/docker-kvm
platform: linux
cpu: 4
memory: 16G
nested_virtualization: true
# Initialization of the test environment
setup_script: &vagrant_setup
- grep -q vmx /proc/cpuinfo # Ensure nested virtualization is enabled
# The version of vagrant shipped with ubuntu fails to download some boxes (e.g: f38).
# See https://bugs.launchpad.net/vagrant/+bug/2017828.
# Installing it from Hashicorp directly
- wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
- echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list
- DEBIAN_FRONTEND=noninteractive apt-get -y update && DEBIAN_FRONTEND=noninteractiven apt-get -y install vagrant ruby-libvirt qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils pkg-config libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev gcc make ruby-nokogiri
- vagrant plugin install vagrant-libvirt
- systemctl enable --now libvirtd
# Download, provision and cache test image(s).
vagrant_cache: &vagrant_cache
reupload_on_changes: true
fingerprint_script: |
# Invalidate once a week
date -d 'next monday - 1 week' +%Y%m%d
echo ${DISTRO}; cat Vagrantfile
folder: /root/.vagrant.d/boxes
up_script: &vagrant_up
- vagrant box update -f ${DISTRO}
- vagrant box prune -f
- vagrant up ${DISTRO} --no-tty || vagrant up ${DISTRO} --no-tty # Retry to overcome network glitches.
- mkdir -p -m 0700 /root/.ssh
- vagrant ssh-config ${DISTRO} >> /root/.ssh/config
upload_caches: vagrant
guest_info_script: &guest_info
- echo "--- Host info ---"
- ssh ${DISTRO} 'sh -exc "uname -a"'
test_script: &functional_test
- ssh -tt ${DISTRO} "env CARGO_CMD_OPTS=$CARGO_CMD_OPTS bash --login -exc 'cd /vagrant && make V=1'"
- ssh -tt ${DISTRO} "cd /vagrant/tests && sudo python3 -m pytest ${TEST_EXTRA_ARGS}"
# Manual trigger for non-PR branches.
manual_test_funtional_task:
trigger_type: manual
only_if: "$CIRRUS_BRANCH !=~ 'pull/.*'"
matrix: *distro_matrix
compute_engine_instance: *nestedvm
setup_script: *vagrant_setup
vagrant_cache: *vagrant_cache
up_script: *vagrant_up
guest_info_script: *guest_info
test_script: *functional_test