|
| 1 | +stages: |
| 2 | + - test |
| 3 | + |
| 4 | +variables: |
| 5 | + DEBIAN_FRONTEND: "noninteractive" |
| 6 | + COMPOSER_CACHE_DIR: "$CI_PROJECT_DIR/build/composer/cache" |
| 7 | + YARN_CACHE_FOLDER: "$CI_PROJECT_DIR/build/yarn/cache" |
| 8 | + |
| 9 | +cache: |
| 10 | + # Cache is per-branch. |
| 11 | + key: "$CI_BUILD_REF_NAME" |
| 12 | + paths: |
| 13 | + - "$COMPOSER_CACHE_DIR" |
| 14 | + - "$YARN_CACHE_FOLDER" |
| 15 | + |
| 16 | +# Hidden job intended as a template for tests. |
| 17 | +# |
| 18 | +# @see https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#anchors |
| 19 | +.test-base: &test-base |
| 20 | + stage: test |
| 21 | + |
| 22 | + variables: |
| 23 | + DOCKER_HOST: tcp://docker:2375 |
| 24 | + DOCKER_DRIVER: overlay2 |
| 25 | + DOCKER_TLS_CERTDIR: "" |
| 26 | + # Allow service containers to see each other. |
| 27 | + # |
| 28 | + # @see https://docs.gitlab.com/ee/ci/services/#connecting-services |
| 29 | + FF_NETWORK_PER_BUILD: 'true' |
| 30 | + # Remove "umask 0000" usage, so DDEV has permissions on the cloned |
| 31 | + # repository. |
| 32 | + # |
| 33 | + # @see https://docs.gitlab.com/runner/configuration/feature-flags.html#available-feature-flags |
| 34 | + FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 'true' |
| 35 | + |
| 36 | + services: |
| 37 | + - name: docker:20-dind |
| 38 | + alias: docker |
| 39 | + command: ["--tls=false"] |
| 40 | + |
| 41 | + image: |
| 42 | + name: registry.gitlab.com/consensus.enterprises/drumkit/ddev |
| 43 | + # Options to run the Docker executor with; notably run as the 'ddev' user |
| 44 | + # and group. This must match the user and group that the Drumkit DDEV image |
| 45 | + # creates. |
| 46 | + # |
| 47 | + # @see https://docs.gitlab.com/ee/ci/yaml/index.html#imagedocker |
| 48 | + docker: |
| 49 | + user: ddev:ddev |
| 50 | + # We have to override the container entrypoint or else we end up in /bin/sh |
| 51 | + # and `source d` doesn't work. |
| 52 | + # |
| 53 | + # @see https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#overriding-the-entrypoint-of-an-image |
| 54 | + entrypoint: [""] |
| 55 | + |
| 56 | + before_script: |
| 57 | + # Opt into sending diagnotistic data to the DDEV project to help improve it. |
| 58 | + # |
| 59 | + # @see https://ddev.readthedocs.io/en/stable/users/usage/diagnostics/ |
| 60 | + - ddev config global --instrumentation-opt-in=true |
| 61 | + # Disable the DDEV SSH agent container as it fails its health checks and we |
| 62 | + # shouldn't need it. |
| 63 | + - ddev config global --omit-containers=ddev-ssh-agent |
| 64 | + - ddev mutagen reset && ddev config global --mutagen-enabled=false |
| 65 | + - ddev start |
| 66 | + - ddev composer install --no-progress |
| 67 | + - ddev yarn install |
| 68 | + - ddev yarn build:deploy |
| 69 | + |
| 70 | +test:phpunit: |
| 71 | + <<: *test-base |
| 72 | + script: |
| 73 | + - ddev exec phpunit --group=omnipedia --verbose |
0 commit comments