forked from canonical/rockcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spread.yaml
150 lines (126 loc) · 4.07 KB
/
spread.yaml
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
project: rockcraft
path: /rockcraft
environment:
PROJECT_PATH: /rockcraft
SNAPD_TESTING_TOOLS: $PROJECT_PATH/tools/external/tools
PATH: /snap/bin:$PATH:$SNAPD_TESTING_TOOLS:$PROJECT_PATH/tools/spread
include:
- tests/
- tools/
- docs/
- requirements-doc.txt
- requirements-jammy.txt
- Makefile
- rockcraft/
backends:
google:
key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
location: snapd-spread/us-east1-b
halt-timeout: 2h
systems:
- ubuntu-20.04-64:
workers: 1
storage: 40G
- ubuntu-22.04-64:
workers: 4
storage: 40G
- fedora-39-64:
workers: 1
storage: 40G
prepare: |
# if the 'tools' directory inside the submodule does not exist, then assume the submodule is empty
if [[ ! -d "$SNAPD_TESTING_TOOLS" ]]; then
echo "Cannot run spread because submodule 'snapd-testing-tools' is empty. Fetch with 'git submodule update --init' and rerun spread."
exit 1
fi
if os.query is-ubuntu; then
tempfile="$(mktemp)"
if ! apt-get update > "$tempfile" 2>&1; then
cat "$tempfile"
exit 1
fi
fi
tests.pkgs install snapd
snap wait system seed.loaded
# The /snap directory does not exist in some environments
[ ! -d /snap ] && ln -s /var/lib/snapd/snap /snap
# older linux releases have separate packages for lxd and lxc (lxd-client)
if [ "$SPREAD_SYSTEM" = "ubuntu-18.04-64" ] || \
[ "$SPREAD_SYSTEM" = "ubuntu-20.04-64" ] || \
[ "$SPREAD_SYSTEM" = "fedora-39-64" ]; then
tests.pkgs remove lxd lxd-client
else
tests.pkgs remove lxd
fi
# 5.21/stable is the latest stable LTS. Use 5.21/candidate as a "first line of
# defense" against LXD regressions.
snap install lxd --channel=5.21/candidate
# Hold snap refreshes for 24h.
snap set system refresh.hold="$(date --date=tomorrow +%Y-%m-%dT%H:%M:%S%:z)"
if ! snap watch --last=auto-refresh?; then
journalctl -xe
fi
if ! snap watch --last=install?; then
journalctl -xe
fi
lxd waitready --timeout=30
lxd init --auto
if [ "$SPREAD_SYSTEM" = "fedora-39-64" ]; then
# Latest docker snap needs a more recent version of snapd than Fedora ships
# https://github.com/canonical/rockcraft/pull/277
snap install docker --channel=core18/stable
else
snap install docker
fi
# make sure docker is working
retry -n 10 --wait 2 sh -c 'docker run --rm hello-world'
install_rockcraft
restore-each: |
# Cleanup after each task.
docker system prune -a -f
if lxc project info rockcraft > /dev/null 2>&1 ; then
for instance in $(lxc --project=rockcraft list -c n --format csv); do
# Don't remove the base instance, we want to reuse it between tests
if ! [[ $instance =~ ^base-instance-* ]]; then
lxc --project=rockcraft delete --force "$instance"
fi
done
fi
debug-each: |
# output latest rockcraft log file on test failure
rockcraft_log_file=$(find /root/.local/state/rockcraft/log/ -name 'rockcraft*.log' | sort -n | tail -n1)
if [[ -f $rockcraft_log_file ]]; then
echo -e "rockcraft log file contents:\n----------------------------"
cat "$rockcraft_log_file"
echo "----------------------------"
else
echo "could not find rockcraft log file (this is not necessarily an error)"
fi
suites:
docs/tutorial/code/:
summary: tests tutorial from the docs
systems:
- ubuntu-22.04-64
docs/how-to/code/:
summary: tests how-to guides from the docs
systems:
- ubuntu-22.04-64
docs/reference/code/:
summary: tests reference code from the docs
systems:
- ubuntu-22.04-64
docs/reuse/tutorial/code/:
summary: tests reusable code from the docs
systems:
- ubuntu-22.04-64
tests/spread/rockcraft/:
summary: tests for rockcraft core functionality, independent of host system
systems:
- ubuntu-22.04-64
tests/spread/foreign/:
summary: tests that rockcraft and rocks work on different host systems
tests/spread/manual/:
summary: manually-triggered tests, like bigger tests and flaky ones
manual: true
systems:
- ubuntu-22.04-64