diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..85eb50465c009192505a8fc4f97d63863ae6c933 --- /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 0000000000000000000000000000000000000000..44d60c3b8ee9c8aa9db1ae48508324eb4b42e577 --- /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 b7e0f1d8f536255935f7670f58e64024366f4b55..22437ecc4898135583f8947fa9f88bdcdf976c0f 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 0000000000000000000000000000000000000000..ace9d5f0b06a60d3b084b87ffa5ee1b597b36b10 --- /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 432334c55be7657510fdf34e95baea00e0a13016..7123441a18b565ba430ece3683b10ebd26a45c75 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