Updated .gitlab* files to be consistent with other projects

This commit is contained in:
Deon George 2024-02-25 23:42:08 +11:00
parent d9279d0a54
commit 40a4808f98
3 changed files with 50 additions and 6 deletions

View File

@ -7,7 +7,7 @@ stages:
cache: cache:
key: ${CI_JOB_NAME_SLUG}-${CI_COMMIT_REF_SLUG} key: ${CI_JOB_NAME_SLUG}-${CI_COMMIT_REF_SLUG}
paths: paths:
- vendor/ - vendor/
include: include:
# .gitlab-test.yml # .gitlab-test.yml

44
.gitlab-test.yml Normal file
View File

@ -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

View File

@ -2,10 +2,10 @@ FROM registry.dege.au/leenooks/php:8.1-fpm-alpine
COPY . /var/www/html/ COPY . /var/www/html/
RUN mkdir /var/cache/composer && \ RUN mkdir -p ${COMPOSER_HOME} && \
([ -r auth.json ] && mv auth.json /var/cache/composer/) || true && \ ([ -r auth.json ] && mv auth.json ${COMPOSER_HOME}) || true && \
touch .composer.refresh && \ touch .composer.refresh && \
mv .env.example .env && \ mv .env.example .env && \
FORCE_PERMS=1 /sbin/init && \ FORCE_PERMS=1 NGINX_START=FALSE /sbin/init && \
rm -rf /var/cache/composer/* && \ touch .migrate && \
touch .migrate && chmod g+w database rm -rf ${COMPOSER_HOME}/*