Skip to content
Snippets Groups Projects
Commit e07dcc24 authored by François Agneray's avatar François Agneray
Browse files

Add gitlab-ci

parent 81ba34b9
No related branches found
No related tags found
1 merge request!29Develop
Pipeline #5958 failed
stages:
- trigger-child-pipelines
client:
stage: trigger-child-pipelines
trigger:
include: client/.gitlab-ci.yml
strategy: depend
only:
changes:
- client/**/*
refs:
- develop
server:
stage: trigger-child-pipelines
trigger:
include: server/.gitlab-ci.yml
strategy: depend
only:
changes:
- server/**/*
refs:
- develop
services:
stage: trigger-child-pipelines
trigger:
include: services/.gitlab-ci.yml
strategy: depend
only:
changes:
- services/**/*
refs:
- develop
stages:
- install_dependencies
- sonar
- build
- dockerize
variables:
VERSION: "3.7.0"
SONARQUBE_URL: https://sonarqube.lam.fr
install_dependencies:
image: node:16-slim
stage: install_dependencies
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules
policy: pull-push
script:
- yarn install
sonar_scanner:
image: sonarsource/sonar-scanner-cli:latest
stage: sonar
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules
policy: pull
script:
- sonar-scanner
-Dsonar.projectKey=anis-next
-Dsonar.sources=src
-Dsonar.projectVersion=$VERSION
-Dsonar.host.url=$SONARQUBE_URL
-Dsonar.login=$SONAR_TOKEN_CLIENT
-Dsonar.exclusions=**.spec.ts
-Dsonar.typescript.lcov.reportPaths=./coverage/anis-next/lcov.info
build:
image: node:16-slim
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules
policy: pull
script:
- yarn global add @angular/cli@latest
- ng build
artifacts:
paths:
- dist
dockerize:
image: docker:stable
stage: dockerize
cache: {}
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY/anis/anis-next/client:latest || true
- docker build --cache-from $CI_REGISTRY/anis/anis-next/client:latest -t $CI_REGISTRY/anis/anis-next/client:latest .
- docker push $CI_REGISTRY/anis/anis-next/client:latest
......@@ -17,7 +17,7 @@ import { AppConfigService } from '../app-config.service';
export function initializeKeycloak(keycloak: KeycloakService, store: Store<{ }>, appConfigService: AppConfigService) {
if (!appConfigService.authenticationEnabled) {
return true;
return Promise.resolve(true);
}
from(keycloak.keycloakEvents$).subscribe(event => {
......
......@@ -15,7 +15,6 @@ services:
build:
context: ./server
dockerfile: ./Dockerfile.dev
working_dir: /project
environment:
docker: "true"
DISPLAY_ERROR_DETAILS: "true"
......@@ -38,7 +37,6 @@ services:
volumes:
- ./server:/project
- ./conf-dev/dev-php.ini:/usr/local/etc/php/conf.d/dev-php.ini
- ./conf-dev/vhost.conf:/etc/apache2/sites-available/000-default.conf
- ./conf-dev/init-keycloak.sh:/mnt/init-keycloak.sh
- ./conf-dev/create-db.sh:/mnt/create-db.sh
- ./conf-dev/public_key:/mnt/public_key
......
......@@ -3,10 +3,9 @@ stages:
- test
- sonar
- dockerize
- deploy
variables:
VERSION: "3.6"
VERSION: "3.7"
SONARQUBE_URL: https://sonarqube.lam.fr
install_dependencies:
......@@ -19,9 +18,6 @@ install_dependencies:
paths:
- vendor
policy: pull-push
only:
refs:
- develop
test:
image: jakzal/phpqa:php8.0
......@@ -32,22 +28,29 @@ test:
- vendor
policy: pull
script:
- phpdbg -qrr ./vendor/bin/phpunit --bootstrap ./tests/bootstrap.php --whitelist src --coverage-clover ./coverage/clover.xml --log-junit ./coverage/junit-logfile.xml --coverage-text --colors=never ./tests
- phpdbg
-qrr ./vendor/bin/phpunit
--bootstrap ./tests/bootstrap.php
--whitelist src
--coverage-clover ./coverage/clover.xml
--log-junit ./coverage/junit-logfile.xml
--coverage-text --colors=never ./tests
artifacts:
paths:
- coverage
only:
refs:
- develop
sonar_scanner:
image: sonarsource/sonar-scanner-cli:latest
stage: sonar
script:
- sonar-scanner -Dsonar.projectKey=anis-server -Dsonar.sources=src -Dsonar.projectVersion=$VERSION -Dsonar.host.url=$SONARQUBE_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.php.tests.reportPath=./coverage/junit-logfile.xml -Dsonar.php.coverage.reportPaths=./coverage/clover.xml
only:
refs:
- develop
- sonar-scanner
-Dsonar.projectKey=anis-next
-Dsonar.sources=src
-Dsonar.projectVersion=$VERSION
-Dsonar.host.url=$SONARQUBE_URL
-Dsonar.login=$SONAR_TOKEN_SERVER
-Dsonar.php.tests.reportPath=./coverage/junit-logfile.xml
-Dsonar.php.coverage.reportPaths=./coverage/clover.xml
dockerize:
image: docker:stable
......@@ -60,23 +63,6 @@ dockerize:
dependencies: []
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY/anis/anis-server/server:latest || true
- docker build --cache-from $CI_REGISTRY/anis/anis-server/server:latest -t $CI_REGISTRY/anis/anis-server/server:latest .
- docker push $CI_REGISTRY/anis/anis-server/server:latest
only:
refs:
- develop
deploy:
image: alpine
stage: deploy
variables:
GIT_STRATEGY: none
cache: {}
dependencies: []
script:
- apk add --update curl
- curl -XPOST $DEV_WEBHOOK
only:
refs:
- develop
\ No newline at end of file
- docker pull $CI_REGISTRY/anis/anis-next/server:latest || true
- docker build --cache-from $CI_REGISTRY/anis/anis-next/server:latest -t $CI_REGISTRY/anis/anis-next/server:latest .
- docker push $CI_REGISTRY/anis/anis-next/server:latest
......@@ -10,8 +10,8 @@ RUN printf "\n" | pecl install apcu
RUN a2enmod rewrite
COPY . /project
COPY ./conf-dev/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY ./conf-dev/php.ini /usr/local/etc/php/conf.d/app.ini
COPY ./vhost.conf /etc/apache2/sites-available/000-default.conf
COPY ./php.ini /usr/local/etc/php/conf.d/app.ini
WORKDIR /project
......
......@@ -14,4 +14,8 @@ RUN touch /var/log/xdebug_remote.log && chown www-data:www-data /var/log/xdebug_
# Install mod_rewrite
RUN a2enmod rewrite
COPY ./vhost.conf /etc/apache2/sites-available/000-default.conf
WORKDIR /project
CMD ["apache2-foreground"]
File moved
File moved
stages:
- dockerize
variables:
VERSION: "3.7"
SONARQUBE_URL: https://sonarqube.lam.fr
dockerize:
image: docker:stable
stage: dockerize
cache: {}
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY/anis/anis-next/services:latest || true
- docker build --cache-from $CI_REGISTRY/anis/anis-next/services:latest -t $CI_REGISTRY/anis/anis-next/services:latest .
- docker push $CI_REGISTRY/anis/anis-next/services: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