Add Drone CI pipeline

This commit is contained in:
James Lu 2021-03-05 00:36:29 -08:00
parent d713ee66a8
commit f9b6b4c247
2 changed files with 52 additions and 0 deletions

41
.drone.jsonnet Normal file
View File

@ -0,0 +1,41 @@
# Pipeline template
local test_with(version, use_network=false) = {
kind: "pipeline",
type: "docker",
name: "py" + version + (if use_network then '-online' else ''),
steps: [
{
name: "test",
image: "python:" + version + "-buster",
commands: [
"pip install -r requirements.txt",
"apt-get update",
# For SysDNS
"apt-get -yy install bind9-host",
"./tests-wrapper.sh" + if !use_network then ' --no-network' else ''
],
failure: if use_network then "ignore",
environment: {
[secret_name]: {
from_secret: secret_name
}
for secret_name in [
"AQICN_APIKEY",
"NUWEATHER_APIKEY_DARKSKY",
"NUWEATHER_APIKEY_OPENWEATHERMAP",
"NUWEATHER_APIKEY_WEATHERSTACK",
"lastfm_apikey",
]
}
}
]
};
[
test_with("3.6"),
test_with("3.6", use_network=true),
test_with("3.7"),
test_with("3.8"),
test_with("3.9"),
test_with("3.9", use_network=true),
]

11
tests-wrapper.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# Exclude stubs for (re)moved plugins
SKIP_PLUGINS=("--exclude=./Weather" "--exclude=./DDG" "--exclude=./SedRegex")
if [[ -n "$DRONE_PULL_REQUEST" ]]; then
echo "Skipping tests that require secret API keys"
export SKIP_PLUGINS+=("--exclude=./LastFM" "--exclude=./NuWeather" "--exclude=./AQI")
fi
supybot-test -c --plugins-dir=. "${SKIP_PLUGINS[@]}" "$@"