fdroiddata/.gitlab-ci.yml
Hans-Christoph Steiner c87a57a430 gitlab-ci: do not rely on static paths for the gitlab runner
Before, this assumed that the gitlab-runner was running as the 'fdroid'
user.  Now, it shouldn't matter which user it is running as.
2018-12-08 09:48:13 +01:00

118 lines
4.2 KiB
YAML

image: registry.gitlab.com/fdroid/ci-images-server:latest
lint:
before_script:
- rm -rf fdroidserver
- mkdir fdroidserver
- curl --silent https://gitlab.com/fdroid/fdroidserver/repository/master/archive.tar.gz
| tar -xz --directory=fdroidserver --strip-components=1
- export PATH="$PWD/fdroidserver:$PATH"
- touch config.py
script:
# if this is a merge request fork, then only check relevant apps
- if [ "$CI_PROJECT_NAMESPACE" != "fdroid" ]; then
git fetch https://gitlab.com/fdroid/fdroiddata;
test -d build || mkdir build;
for f in `git diff --name-only --diff-filter=d FETCH_HEAD...HEAD`; do
appid=`echo $f | sed -n -e 's,^metadata/\([^/][^/]*\)\.txt,\1,p'
-e 's,^metadata/\([^/][^/]*\)\.yml,\1,p'`;
export CHANGED="$CHANGED $appid";
grep -q "^Repo *Type\W *git" $f && git -C build clone `sed -n "s,^Repo *:,,p" $f` $appid;
done;
./tools/audit-gradle.py $CHANGED;
fi
- export EXITVALUE=0
- fdroid lint -f $CHANGED || {
export EXITVALUE=1;
printf "\nThese files have lint issues:\n";
fdroid rewritemeta -l $CHANGED;
printf "\nThese are the formatting issues:\n";
fdroid rewritemeta $CHANGED;
git --no-pager diff --color=always;
}
- apt-get -qy update
- apt-get -qy install --no-install-recommends exiftool
- find metadata/ -name '*.jp*g' -o -name '*.png' | xargs exiftool -all=
- echo "these images have EXIF that must be stripped:"
- git --no-pager diff --stat
- git --no-pager diff --name-only --exit-code || export EXITVALUE=1
- ./tools/check-keyalias-collision.py || export EXITVALUE=1
- exit $EXITVALUE
pages:
image: ruby:2.3
stage: deploy
only:
- schedules
cache:
key: "$CI_JOB_NAME"
paths:
- vendor/ruby
artifacts:
paths:
- public
script:
- rm -rf public
- gem install git_stats
- git_stats generate --silent --out-path=public
fdroid-buildserver:
tags:
- fdroid
- buildserver
only:
- branches@Bubu/fdroiddata
- branches@eighthave/fdroiddata
- branches@fdroid/fdroiddata
- branches@grote/fdroiddata
- branches@izzysoft/fdroiddata
- branches@schildbach/fdroiddata
- branches@uniqx/fdroiddata
artifacts:
name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
paths:
- json
- libscout-logs
- logs
- stats
- unsigned
expire_in: 1 week
when: always
cache:
key: "$CI_JOB_NAME"
paths:
- build
- unsigned
script:
- virsh -c qemu:///system destroy builder_default || true
- virsh -c qemu:///system undefine builder_default
--nvram --managed-save --remove-all-storage --snapshots-metadata || true
- git -C $HOME/fdroidserver reset --hard
- git -C $HOME/fdroidserver checkout -B master origin/master
- export PATH="$HOME/fdroidserver:$PATH"
- if [ "$CI_PROJECT_NAMESPACE" = "fdroid" ]; then
export head=HEAD^^^;
echo ORIG_HEAD `git diff --name-only --diff-filter=d ORIG_HEAD...HEAD
| sed -n -e 's,^metadata/\([^/][^/]*\)\.txt,\1,p' -e 's,^metadata/\([^/][^/]*\)\.yml,\1,p'`;
else
git fetch https://gitlab.com/fdroid/fdroiddata.git;
export head=FETCH_HEAD;
fi
- export appids=`git diff --name-only --diff-filter=d $head...HEAD
| sed -n -e 's,^metadata/\([^/][^/]*\)\.txt,\1,p' -e 's,^metadata/\([^/][^/]*\)\.yml,\1,p'`
- echo $appids | grep '\w' || exit 0
- fdroid build --verbose --server --stop --no-tarball --latest $appids
- find unsigned -maxdepth 0 -empty -exec exit 0 \;
- cd ~/libscout
- java -jar build/LibScout.jar -o match -a lib/android-23.jar -p profiles
-j $CI_PROJECT_DIR/json
-s $CI_PROJECT_DIR/stats
-d $CI_PROJECT_DIR/libscout-logs
$CI_PROJECT_DIR/unsigned
- for f in $CI_PROJECT_DIR/libscout-logs/*.log; do printf "\n\n$f\n"; cut -b43-160 $f; done
- for f in `find $CI_PROJECT_DIR/json -name \*.json`; do cat $f | python3 -m json.tool; done
after_script:
- test -d builder || exit 0
- cd builder
- vagrant destroy --force