From 274b0845d928f213af1b9aa64e411442ea6b6d2d Mon Sep 17 00:00:00 2001
From: Wittmann Gregory <gregory.wittmann4@etu.univ-lorraine.fr>
Date: Mon, 8 Jan 2024 16:56:21 +0100
Subject: [PATCH] Add

---
 .gitignore            | 28 ++++++++++++++++++++++++++++
 .gitlab-ci.yml        | 25 +++++++++++++++++++++++++
 calculVolumeSphere.py | 11 +++++++----
 index.php             | 17 +++++++++++++++++
 volume.txt            |  2 +-
 5 files changed, 78 insertions(+), 5 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 .gitlab-ci.yml
 create mode 100644 index.php

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..85eb504
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,28 @@
+# Ignore les fichiers et répertoires générés par Python
+__pycache__/
+*.pyc
+*.pyo
+*.pyd
+
+# ignore les fichier txt
+*.txt
+
+# Ignore les fichiers générés par l'IDE (par exemple, PyCharm)
+.idea/
+
+# Ignore les fichiers générés lors de l'exécution des tests
+htmlcov/
+.coverage
+
+# Ignore les fichiers générés par le système d'exploitation
+.DS_Store
+Thumbs.db
+
+# Ignore les fichiers générés lors de la construction
+dist/
+build/
+*.egg-info/
+
+# Ignore les fichiers générés par les outils de gestion de dépendances
+venv/
+env/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..44d60c3
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,25 @@
+stages:
+  - lint
+  - test
+  - build
+
+variables:
+  PYTEST_FLAGS: "-v"
+
+lint:
+  stage: lint
+  script:
+    - pip install flake8
+    - flake8 sphère.py
+
+test:
+  stage: test
+  script:
+    - pip install -r requirements.txt
+    - pip install pytest
+    - pytest test_sphère.py
+
+build:
+  stage: build
+  script:
+    - docker build -t EvalSpherePython .
\ No newline at end of file
diff --git a/calculVolumeSphere.py b/calculVolumeSphere.py
index b7e0f1d..22437ec 100644
--- a/calculVolumeSphere.py
+++ b/calculVolumeSphere.py
@@ -1,3 +1,4 @@
+# sphère.py
 
 import math
 
@@ -10,12 +11,14 @@ def calculer_volume_sphere(rayon):
 
 def enregistrer_resultat_fichier(volume, fichier):
     with open(fichier, 'w') as f:
-        f.write(f"Volume de la sphère : {volume}")
-        
+        f.write(f"{volume}")
+
 def main():
-    rayon = float(input("Rayon de la sphere : "))
+    rayon = float(input("Rayon de la sphère en cm : "))
     volume = calculer_volume_sphere(rayon)
-    enregistrer_resultat_fichier(volume, "volume.txt")
     
+    # Enregistrement du résultat dans un fichier texte
+    enregistrer_resultat_fichier(volume, "volume.txt")
+
 if __name__ == '__main__':
     main()
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..ace9d5f
--- /dev/null
+++ b/index.php
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="fr">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Résultat du Calcul</title>
+</head>
+<body>
+    <?php
+        // Lire le contenu du fichier texte
+        $contenu = file_get_contents('volume.txt');
+        
+        // Afficher le contenu du fichier texte
+        echo '<p>Le volume du cône est de ' . $contenu . ' cm<sup>3</sup>.</p>';
+    ?>
+</body>
+</html>
\ No newline at end of file
diff --git a/volume.txt b/volume.txt
index 432334c..7123441 100644
--- a/volume.txt
+++ b/volume.txt
@@ -1 +1 @@
-Volume de la sph�re : 523.5987755982989
\ No newline at end of file
+33.510321638291124
\ No newline at end of file
-- 
GitLab