Merge pull request 'issue_003_Sonar' (#18) from issue_003_Sonar into master
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Reviewed-on: #18pull/19/head
commit
d37e13400b
@ -0,0 +1,59 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: HeartWave
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: composer:2.6
|
||||||
|
commands:
|
||||||
|
- cd Sources
|
||||||
|
# Installe les dépendances PHP si nécessaire
|
||||||
|
- composer install --no-interaction
|
||||||
|
- ./vendor/bin/phpunit
|
||||||
|
|
||||||
|
# Sonar static code analisis deployment ✔️
|
||||||
|
# TODO : use an image that already have unzip
|
||||||
|
- name: code-analysis
|
||||||
|
image: php:8.1-cli
|
||||||
|
environment:
|
||||||
|
SONAR_TOKEN:
|
||||||
|
from_secret: SONAR_TOKEN
|
||||||
|
commands:
|
||||||
|
- apt-get update && apt-get install -y curl unzip
|
||||||
|
- export SONAR_SCANNER_VERSION=4.7.0.2747
|
||||||
|
- export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
|
||||||
|
- curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
|
||||||
|
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
|
||||||
|
- export PATH=$SONAR_SCANNER_HOME/bin:$PATH
|
||||||
|
- export SONAR_SCANNER_OPTS="-server"
|
||||||
|
- cd Sources
|
||||||
|
- sonar-scanner -D sonar.projectKey=HeartTrack -D sonar.host.url=https://codefirst.iut.uca.fr/sonar
|
||||||
|
depends_on: [ test ]
|
||||||
|
|
||||||
|
# build image and push on the registry ✔️
|
||||||
|
- name: docker-build-and-push
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
dockerfile: Sources/config/Dockerfile
|
||||||
|
context: Sources
|
||||||
|
registry: hub.codefirst.iut.uca.fr
|
||||||
|
repo: hub.codefirst.iut.uca.fr/david.d_almeida/web
|
||||||
|
username:
|
||||||
|
from_secret: SECRET_REGISTRY_USERNAME
|
||||||
|
password:
|
||||||
|
from_secret: SECRET_REGISTRY_PASSWORD
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: ruby:2.1
|
||||||
|
when:
|
||||||
|
status: [ success ]
|
||||||
|
ref:
|
||||||
|
include:
|
||||||
|
- refs/tags/*-demo
|
||||||
|
commands:
|
||||||
|
- sh ./notifymail.sh
|
||||||
|
depends_on: [ docker-build-and-push ]
|
@ -0,0 +1,17 @@
|
|||||||
|
# Activer la réécriture d'URL
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
|
||||||
|
RewriteRule ^ index.php [QSA,L]
|
||||||
|
|
||||||
|
<Files *>
|
||||||
|
Order Allow,Deny
|
||||||
|
Deny from all
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
<Files .htaccess>
|
||||||
|
Order Allow,Deny
|
||||||
|
Deny from all
|
||||||
|
</Files>
|
@ -0,0 +1,19 @@
|
|||||||
|
FROM php:8.2-apache
|
||||||
|
# Installation de dépendances nécessaires pour Composer
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
git \
|
||||||
|
unzip
|
||||||
|
|
||||||
|
# Installation de Composer
|
||||||
|
# TODO : should use a image with composer install
|
||||||
|
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||||
|
|
||||||
|
RUN docker-php-ext-install pdo pdo_mysql
|
||||||
|
|
||||||
|
COPY . /var/www/html
|
||||||
|
|
||||||
|
WORKDIR /var/www/html
|
||||||
|
RUN chown -R www-data:www-data /var/www/html
|
||||||
|
RUN composer install
|
||||||
|
EXPOSE 80
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class MaClasseTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testMethode()
|
||||||
|
{
|
||||||
|
echo "TEST MEC";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Mailjet API Credentials
|
||||||
|
API_KEY='MAILJET_API_KEY'
|
||||||
|
API_SECRET='MAILJET_API_SECRET'
|
||||||
|
|
||||||
|
#Mail info
|
||||||
|
|
||||||
|
SUBJECT='Nouvelle version démo'
|
||||||
|
changelog="$(base64 -w 0 CHANGELOG)"
|
||||||
|
|
||||||
|
FROM_EMAIL='contactHeartTrack@gmail.com'
|
||||||
|
FROM_NAME='Equipe de développement'
|
||||||
|
|
||||||
|
# This call sends a message to the given recipient with vars and custom vars.
|
||||||
|
curl -s \
|
||||||
|
-X POST \
|
||||||
|
--user "$API_KEY:$API_SECRET" \
|
||||||
|
https://api.mailjet.com/v3.1/send \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"Messages":[
|
||||||
|
{
|
||||||
|
"From": { "Email": "$FROM_EMAIL", "Name": "$FROM_NAME" },
|
||||||
|
"To": [ { "Email": "equipedev@waveheart.fr", "Name": "dev" } ],
|
||||||
|
"TemplateID": 0000, "TemplateLanguage": true,
|
||||||
|
"Subject": "Nouvelle version démo", "Variables": {},
|
||||||
|
"Attachments": [ { "ContentType": "text/plain", "Filename": "changelog.md", "Base64Content": "'"$changelog"'" } ] } ] }'
|
Loading…
Reference in new issue