From 018f5150b865488fb8941c4aa5c95a4ef15c771c Mon Sep 17 00:00:00 2001 From: Andru Cherny Date: Mon, 7 Jun 2021 14:42:01 +0300 Subject: [PATCH] add travis docker cache --- .make/static-analysis.mk | 6 ------ .travis.yml | 21 +++++++++++++-------- docker-compose.yml | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.make/static-analysis.mk b/.make/static-analysis.mk index 28d833e..c9904d9 100644 --- a/.make/static-analysis.mk +++ b/.make/static-analysis.mk @@ -22,12 +22,6 @@ coding-standards: ## run check and validate code standards tests coding-standards-fixer: ## run code standards fixer docker-compose run --rm --no-deps php sh -lc './vendor/bin/ecs check src tests --fix' -tests-unit: ## Run unit-tests suite - docker-compose run --rm --no-deps php sh -lc 'vendor/bin/phpunit --configuration /app/phpunit.xml.dist' - -tests-integration: ## Run integration-tests suite - docker-compose run --rm --no-deps php sh -lc 'vendor/bin/phpunit --configuration /app/phpunit.func.xml' - .PHONY: infection infection: ## executes mutation framework infection docker-compose run --rm --no-deps php-fpm sh -lc './vendor/bin/infection --min-msi=70 --min-covered-msi=80 --threads=$(JOBS) --coverage=var/report' diff --git a/.travis.yml b/.travis.yml index f5a238b..f5bec82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,20 @@ dist: xenial sudo: true -#cache: -# - directories: -# - /var/lib/docker -#env: -# global: -# - DOCKER_SERVER_HOST=docker.local -# - DOCKER_PROJECT_PATH=components/base -# - TEST_CONFIG="phpunit.xml.dist" + +cache: + directories: + - docker_images + +before_install: + - docker load -i docker_images/images.tar || true + +before_cache: + - docker save -o docker_images/images.tar $(docker images -a -q) install: + - export DOCKER_UID=`id -u` + - export DOCKER_GID=`id -g` + - export DOCKER_IMAGE_VERSION=`echo $TRAVIS_BRANCH | tr "[:upper:]" "[:lower:]" | sed "s/[^a-zA-Z0-9-]/-/g" | sed "s/-$//g" | tr -d '\n' | tr -d '\r'` - make build - make composer-install diff --git a/docker-compose.yml b/docker-compose.yml index f5220d4..24fe362 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: "3.7" services: php: container_name: ${ADGBASE_COMPOSE_PROJECT_NAME}_php - user: 1000:1000 + user: ${DOCKER_UID:-1000}:${DOCKER_GID:-1000} build: context: .docker/php7.2-dev volumes: