From 40a4808f9882d7f48ce2c7fa4bd058b336c5c470 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 25 Feb 2024 23:42:08 +1100 Subject: [PATCH] Updated .gitlab* files to be consistent with other projects --- .gitlab-ci.yml | 2 +- .gitlab-test.yml | 44 ++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 10 +++++----- 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 .gitlab-test.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4680701..7359d97 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ stages: cache: key: ${CI_JOB_NAME_SLUG}-${CI_COMMIT_REF_SLUG} paths: - - vendor/ + - vendor/ include: # .gitlab-test.yml diff --git a/.gitlab-test.yml b/.gitlab-test.yml new file mode 100644 index 0000000..e6db94c --- /dev/null +++ b/.gitlab-test.yml @@ -0,0 +1,44 @@ +test: + stage: test + + image: ${CI_REGISTRY}/leenooks/php:8.1-fpm-alpine-test + services: + - postgres:15-alpine + + variables: + POSTGRES_PASSWORD: password + POSTGRES_DB: ate + POSTGRES_INITDB_ARGS: "--data-checksums" + + tags: + - x86_64 + + before_script: + - mv .env.testing .env + + # Install Composer and project dependencies. + - mkdir -p /root/.config/composer + - if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > /root/.config/composer/auth.json ; fi + - composer install + - npm install + - npm run build + + # Run database migrations. + - php artisan migrate + + # Run database seed + - php artisan db:seed + + # Start steno + # php -S localhost:8080 -t public & + # node_modules/steno/bin/./steno --replay --app http://localhost:8080 --out-port 3000 --scenario-dir /tests/steno & + + script: + # run laravel tests + - XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text --colors=never + + # run frontend tests + # if you have any task for testing frontend + # set it in your package.json script + # comment this out if you don't have a frontend test + # npm test diff --git a/Dockerfile b/Dockerfile index 3c798aa..898e712 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,10 @@ FROM registry.dege.au/leenooks/php:8.1-fpm-alpine COPY . /var/www/html/ -RUN mkdir /var/cache/composer && \ - ([ -r auth.json ] && mv auth.json /var/cache/composer/) || true && \ +RUN mkdir -p ${COMPOSER_HOME} && \ + ([ -r auth.json ] && mv auth.json ${COMPOSER_HOME}) || true && \ touch .composer.refresh && \ mv .env.example .env && \ - FORCE_PERMS=1 /sbin/init && \ - rm -rf /var/cache/composer/* && \ - touch .migrate && chmod g+w database + FORCE_PERMS=1 NGINX_START=FALSE /sbin/init && \ + touch .migrate && \ + rm -rf ${COMPOSER_HOME}/*