diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..cadb1db --- /dev/null +++ b/.drone.jsonnet @@ -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), +] diff --git a/tests-wrapper.sh b/tests-wrapper.sh new file mode 100755 index 0000000..198d984 --- /dev/null +++ b/tests-wrapper.sh @@ -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[@]}" "$@"