.gitlab-ci.yml 1.9 KB
Newer Older
1 2 3 4 5
variables:
  # Configure mysql service (https://hub.docker.com/_/mysql/)
  MYSQL_DATABASE: wordpress_tests
  MYSQL_ROOT_PASSWORD: mysql

Erick Hitter's avatar
Erick Hitter committed
6 7 8 9
cache:
  paths:
    - $HOME/.composer
    - /root/.composer
10

Erick Hitter's avatar
Erick Hitter committed
11
before_script:
12
  # Set up WordPress tests
Erick Hitter's avatar
Erick Hitter committed
13
  - bash bin/install-wp-tests.sh $MYSQL_DATABASE root $MYSQL_ROOT_PASSWORD mysql latest true
14

Erick Hitter's avatar
Erick Hitter committed
15 16 17 18 19 20 21
  # PHPUnit
  - |
    if [[ $(php -v) =~ "PHP 7." ]]; then
      composer global require "phpunit/phpunit=6.1.*"
    else
      composer global require "phpunit/phpunit=4.8.*"
    fi
22

Erick Hitter's avatar
Erick Hitter committed
23 24 25 26
  # Install PHPCS and WPCS
  - composer global require automattic/vipwpcs
  - composer global require phpcompatibility/phpcompatibility-wp
  - phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs,$HOME/.composer/vendor/phpcompatibility/php-compatibility,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-wp
27 28

PHPunit:PHP7.2:MySQL:
Erick Hitter's avatar
Erick Hitter committed
29
  image: containers.ethitter.com:443/docker/images/php:7.2
30 31 32
  services:
    - mysql:5.6
  script:
Erick Hitter's avatar
Erick Hitter committed
33 34 35
    - find . -type "f" -iname "*.php" | xargs -L "1" php -l
    - phpcs -n
    - phpunit
Erick Hitter's avatar
Erick Hitter committed
36 37 38 39 40 41 42 43 44

PHPunit:PHP7.3:MySQL:
  image: containers.ethitter.com:443/docker/images/php:7.3
  services:
    - mysql:5.6
  script:
    - find . -type "f" -iname "*.php" | xargs -L "1" php -l
    - phpcs -n
    - phpunit
Erick Hitter's avatar
Erick Hitter committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

sast:
  image: docker:stable
  variables:
    DOCKER_DRIVER: overlay2
  allow_failure: true
  services:
    - docker:stable-dind
  script:
    - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
    - docker run
      --env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
      --volume "$PWD:/code"
      --volume /var/run/docker.sock:/var/run/docker.sock
      "registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
  artifacts:
    reports:
      sast: gl-sast-report.json