mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
gradlew-fdroid: use gradle zipballs from local cachedir, if present
This commit is contained in:
parent
4b05854ffc
commit
cc3b88ab30
@ -143,6 +143,20 @@ arch_pip_install:
|
|||||||
- fdroid readmeta
|
- fdroid readmeta
|
||||||
- fdroid update --help
|
- fdroid update --help
|
||||||
|
|
||||||
|
|
||||||
|
gradlew-fdroid:
|
||||||
|
image: debian:bullseye
|
||||||
|
<<: *apt-template
|
||||||
|
only:
|
||||||
|
changes:
|
||||||
|
- .gitlab-ci.yml
|
||||||
|
- gradlew-fdroid
|
||||||
|
- tests/test-gradlew-fdroid
|
||||||
|
script:
|
||||||
|
- apt-get install ca-certificates curl default-jdk-headless unzip
|
||||||
|
- ./tests/test-gradlew-fdroid
|
||||||
|
|
||||||
|
|
||||||
lint_format_safety_bandit_checks:
|
lint_format_safety_bandit_checks:
|
||||||
image: alpine:3.10 # cannot upgrade until bandit supports Python 3.8
|
image: alpine:3.10 # cannot upgrade until bandit supports Python 3.8
|
||||||
variables:
|
variables:
|
||||||
@ -154,7 +168,6 @@ lint_format_safety_bandit_checks:
|
|||||||
- export EXITVALUE=0
|
- export EXITVALUE=0
|
||||||
- function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; }
|
- function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; }
|
||||||
- ./hooks/pre-commit || set_error
|
- ./hooks/pre-commit || set_error
|
||||||
- ./tests/test-gradlew-fdroid || set_error
|
|
||||||
- bandit
|
- bandit
|
||||||
-ii
|
-ii
|
||||||
-s B110,B322,B404,B408,B410,B603,B607
|
-s B110,B322,B404,B408,B410,B603,B607
|
||||||
|
@ -8,8 +8,11 @@ if [ -z "$GRADLE_VERSION_DIR" ]; then
|
|||||||
else
|
else
|
||||||
gradle_version_dir="$GRADLE_VERSION_DIR"
|
gradle_version_dir="$GRADLE_VERSION_DIR"
|
||||||
fi
|
fi
|
||||||
|
BUILDSERVER_CACHEDIR=/vagrant/cache
|
||||||
if [ -n "$CACHEDIR" ]; then
|
if [ -n "$CACHEDIR" ]; then
|
||||||
cachedir="$CACHEDIR"
|
cachedir="$CACHEDIR"
|
||||||
|
elif [ -d $BUILDSERVER_CACHEDIR ]; then
|
||||||
|
cachedir=$BUILDSERVER_CACHEDIR
|
||||||
fi
|
fi
|
||||||
args=("$@")
|
args=("$@")
|
||||||
|
|
||||||
@ -34,11 +37,12 @@ download_gradle() {
|
|||||||
gradle_zip="${cachedir}/gradle-$1-bin.zip"
|
gradle_zip="${cachedir}/gradle-$1-bin.zip"
|
||||||
else
|
else
|
||||||
echo "Downloading missing gradle version $1"
|
echo "Downloading missing gradle version $1"
|
||||||
if [ -n "${cachedir}" ]; then
|
echo cachedir $cachedir
|
||||||
|
if [[ -n "${cachedir}" && ! -d "${cachedir}" ]]; then
|
||||||
|
mkdir -p "${cachedir}"
|
||||||
|
fi
|
||||||
|
if [[ -n "${cachedir}" && -d "${cachedir}" && -w "${cachedir}" ]]; then
|
||||||
tmpdir="${cachedir}"
|
tmpdir="${cachedir}"
|
||||||
if [ ! -d ${tmpdir} ]; then
|
|
||||||
mkdir -p "${cachedir}"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
tmpdir=$(mktemp -d)
|
tmpdir=$(mktemp -d)
|
||||||
fi
|
fi
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
red='\033[0;31m'
|
||||||
|
green='\033[0;32m'
|
||||||
|
nocolor='\033[0m'
|
||||||
|
|
||||||
|
TEST_VALUE='HELLO WORLD!'
|
||||||
|
|
||||||
run_test() {
|
run_test() {
|
||||||
red='\033[0;31m'
|
|
||||||
green='\033[0;32m'
|
|
||||||
nocolor='\033[0m'
|
|
||||||
cd $source_files/$1
|
cd $source_files/$1
|
||||||
printf "\n${1}:\n"
|
printf "\n${1}:\n"
|
||||||
if ($basedir/gradlew-fdroid 2>/dev/null || true) | grep -Fo "$2"; then
|
if ($basedir/gradlew-fdroid 2>/dev/null || true) | grep -Fo "$2"; then
|
||||||
@ -15,6 +18,17 @@ run_test() {
|
|||||||
printf $nocolor
|
printf $nocolor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
download_cache_test() {
|
||||||
|
if $basedir/gradlew-fdroid helloWorld 2>/dev/null | grep -F "$TEST_VALUE"; then
|
||||||
|
printf "${green}passed: $1\n"
|
||||||
|
else
|
||||||
|
printf "${red}ERROR: \n"
|
||||||
|
$basedir/gradlew-fdroid helloWorld
|
||||||
|
((exit_value++))
|
||||||
|
fi
|
||||||
|
printf $nocolor
|
||||||
|
}
|
||||||
|
|
||||||
exit_value=0
|
exit_value=0
|
||||||
basedir=$(cd $(dirname $0)/..; pwd)
|
basedir=$(cd $(dirname $0)/..; pwd)
|
||||||
source_files=$basedir/tests/source-files
|
source_files=$basedir/tests/source-files
|
||||||
@ -39,4 +53,23 @@ source_files=$tmpdir
|
|||||||
run_test yuriykulikov/AlarmClock 5.1.1
|
run_test yuriykulikov/AlarmClock 5.1.1
|
||||||
run_test osmandapp/osmand 2.2.1
|
run_test osmandapp/osmand 2.2.1
|
||||||
|
|
||||||
|
cd $tmpdir
|
||||||
|
mkdir -p download_cache_test/gradle/wrapper
|
||||||
|
cd download_cache_test
|
||||||
|
echo 'distributionUrl=https\://services.gradle.org/distributions/gradle-0.7-bin.zip' \
|
||||||
|
> gradle/wrapper/gradle-wrapper.properties
|
||||||
|
printf "task helloWorld {\n\tdoLast {\n\t\tprintln '$TEST_VALUE'\n\t}\n}" > build.gradle
|
||||||
|
|
||||||
|
export GRADLE_VERSION_DIR=$tmpdir/gradle/versions
|
||||||
|
mkdir -p $GRADLE_VERSION_DIR
|
||||||
|
|
||||||
|
unset https_proxy
|
||||||
|
printf "download, unpack, and run: "
|
||||||
|
download_cache_test 0.7
|
||||||
|
printf "unpack and run: "
|
||||||
|
rm -rf $GRADLE_VERSION_DIR/0.7/
|
||||||
|
download_cache_test 0.7
|
||||||
|
printf "just run: "
|
||||||
|
download_cache_test 0.7
|
||||||
|
|
||||||
exit $exit_value
|
exit $exit_value
|
||||||
|
Loading…
Reference in New Issue
Block a user