Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GitLab-CI: Caching by package manager
variables:
ANDROID_COMPILE_SDK: "28"
test:unit:
image: circleci/android:api-${ANDROID_COMPILE_SDK}
cache:
key: gradle-cache
paths: [ .gradle ]
variables:
# GRADLE_OPTS: "-Dorg.gradle.daemon=false"
GRADLE_USER_HOME: $CI_PROJECT_DIR/.gradle-cache
before_script:
- ./gradlew androidDependencies
script:
- ./gradlew lint test
# References:
# + https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/
# + https://circleci.com/docs/2.0/language-android/
test:junit:
stage: test
image: gradle:4.3-jdk8-alpine
cache:
key: gradle-cache
paths: [ .gradle ]
variables:
# GRADLE_OPTS: "-Dorg.gradle.daemon=false"
GRADLE_USER_HOME: $CI_PROJECT_DIR/.gradle
before_script:
- gradle init
script:
- gradle check
variables:
# See: http://maven.apache.org/settings.html
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
# See: http://maven.apache.org/ref/3.5.0/maven-embedder/cli.html
MAVEN_CLI_OPTS: "--batch-mode"
test:junit:
stage: test
image: maven:3.5-jdk-8-alpine
cache:
key: maven-cache
paths: [ .m2/repository ]
before_script:
- mvn dependency:resolve $MAVEN_CLI_OPTS
script:
- mvn test $MAVEN_CLI_OPTS
- grep -Eio 'Total[^%]*(\d+%)' target/site/jacoco/index.html
coverage: '/^Total.*?(\d+%)$/'
test:mocha:
stage: test
image: node:9.3-alpine
cache:
key: npm-cache
paths: [ .npm ]
before_script:
# See: https://docs.npmjs.com/misc/config#cache
- npm config set cache .npm
- npm install
script:
- npm test
coverage: '/^Lines\s+:\s+(\d*\.?\d+\%)\s*/'
test:mocha:
stage: test
image: node:9.3-alpine
cache:
key: yarn-cache
paths: [ .yarn ]
before_script:
# See: https://yarnpkg.com/lang/en/docs/cli/cache/
- yarn config set cache-folder .yarn
- yarn install
script:
- npx mocha
coverage: '/^Lines\s+:\s+(\d*\.?\d+\%)\s*/'
test:phpunit:
stage: test
image: composer:1.5
variables:
# See: https://getcomposer.org/doc/03-cli.md#composer-cache-dir
COMPOSER_CACHE_DIR: .composer
cache:
key: composer-cache
paths: [ .composer ]
before_script:
- composer install --no-progress
script:
- vendor/bin/phpunit --coverage-text --colors=never
coverage: '/^\s*Lines:\s*(\d+.\d+\%)/'
lint:phpcs:
stage: test
image: php:7.2-alpine
cache:
key: pear-cache
paths: [ .pear ]
before_script:
# See: https://pear.php.net/manual/en/guide.users.commandline.config.php
- pear config-set cache_dir .pear
- pear install PHP_CodeSniffer
script:
- vendor/bin/phpcs app/
test:pytest:
stage: test
image: python:3.6-alpine
cache:
key: pip-cache
paths: [ .pip ]
before_script:
# See: https://pip.pypa.io/en/stable/reference/pip_install/#caching
- pip install --cache-dir=.pip -r requirements.txt
script:
- pytest --cov=src --cov-report=term
coverage: '/^TOTAL\s+(?:\d+\s+)+(\d+\%)\s*$/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.