Skip to content
Snippets Groups Projects
Commit 5e592d54 authored by Tibo's avatar Tibo
Browse files

add gitlab-ci with phpunit, phpcs and docker build and push

parent 03bb7bd6
No related branches found
No related tags found
No related merge requests found
stages:
- test
- build
## Cache composer packages between all jobs and all branches
## of this project...
cache:
key: one-key-to-rull-them-all
paths:
- composer-cache/
before_script:
- cp env.gitlab-ci .env
- touch storage/app/db.sqlite
- COMPOSER_CACHE_DIR=composer-cache composer install
- php artisan key:generate
- php artisan migrate
# Test with PHP7.4
test:php74:
image: cylab/php74
stage: test
script:
- vendor/bin/phpunit --coverage-text --colors=never --coverage-html build/coverage
- vendor/bin/phpcs
artifacts:
paths:
- build/
expire_in: 1 month
build:
image: docker:19.03.1
stage: build
tags:
- dind
services:
- docker:19.03.1-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- docker info
script:
- docker build -t cylab/ctf .
build:tagged:
only:
- tags
image: docker:19.03.1
stage: build
tags:
- dind
services:
- docker:19.03.1-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- docker info
script:
- docker build -t cylab/ctf:$CI_COMMIT_TAG .
- docker tag cylab/ctf:$CI_COMMIT_TAG cylab/ctf:latest
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker push cylab/ctf:$CI_COMMIT_TAG
- docker push cylab/ctf:latest
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment