Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f007558
feat: add GitHub Actions workflow for Hello NexaCloud
benslimane-byte Jun 4, 2026
583c0f4
feat: premier commit — activation de la CI
benslimane-byte Jun 4, 2026
8726390
feat: add compiled Python files for app and test with CI/CD integration
benslimane-byte Jun 4, 2026
97df056
feat: update GitHub Actions workflow to include runner date and time
benslimane-byte Jun 4, 2026
2ce4219
feat: update CI workflow name and refine job steps for NexaCloud API
benslimane-byte Jun 4, 2026
7027e92
feat: add steps for Python setup, dependency installation, and test e…
benslimane-byte Jun 4, 2026
8b62d11
feat: add linter step and duplicate Python setup in CI workflow
benslimane-byte Jun 4, 2026
8a5077b
feat: reorganize CI workflow to separate linting and testing jobs
benslimane-byte Jun 4, 2026
e56c6cf
feat: add demo secrets workflow to utilize API key
benslimane-byte Jun 4, 2026
a3aff3e
feat: add validation step for API_KEY in demo secrets workflow
benslimane-byte Jun 4, 2026
7af0911
feat: add deploy workflow for staging and production environments
benslimane-byte Jun 4, 2026
43e7204
feat: consolidate deployment jobs and add environment input options
benslimane-byte Jun 5, 2026
f6c0c58
feat: restructure deploy workflow to include build job and output sha…
benslimane-byte Jun 5, 2026
1f90a64
feat: add CI/CD workflow for NexaCloud API with staging and productio…
benslimane-byte Jun 5, 2026
913438f
fix: correct syntax for staging publish profile in CI/CD workflow
benslimane-byte Jun 5, 2026
6d67dee
fix: update publish profile reference to use secrets in staging deplo…
benslimane-byte Jun 5, 2026
0535f62
feat: add pre-commit configuration for flake8 and common hooks
benslimane-byte Jun 5, 2026
a6ddd43
fix: update staging app name in deployment workflow
benslimane-byte Jun 5, 2026
0f2633e
fix: ensure consistent formatting in workflow files and .gitignore
benslimane-byte Jun 5, 2026
da77765
fix: correct line breaks for consistency in README.md
benslimane-byte Jun 5, 2026
fdcfdf8
feat: add pre-commit configuration for flake8 and common hooks
benslimane-byte Jun 5, 2026
0bea5b3
feat: add pre-commit configuration for flake8 and common hooks
benslimane-byte Jun 5, 2026
a1da1d6
fix: add missing hooks for check-added-large-files and isort in pre-c…
benslimane-byte Jun 5, 2026
06e0365
fix: update app names for Azure App Service deployment in CI/CD workflow
benslimane-byte Jun 11, 2026
1db876f
fix: update dependencies for flake8, pre-commit-hooks, and isort in p…
benslimane-byte Jun 11, 2026
744db87
feat: add dependabot configuration for GitHub Actions and Python depe…
benslimane-byte Jun 11, 2026
046a079
fix: update commit message prefixes and comments in dependabot config…
benslimane-byte Jun 11, 2026
22330b7
feat: add CODEOWNERS file to define review requirements for repositor…
benslimane-byte Jun 11, 2026
60272f2
fix: update CODEOWNERS to specify correct GitHub account for reviews
benslimane-byte Jun 11, 2026
3f26ce0
feat: add additional notes to the GitHub Actions documentation
benslimane-byte Jun 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Syntaxe : <pattern de fichier> <@utilisateur ou @org/équipe>

# Par défaut : tout changement requiert une review de ces personnes
* @<benslimane-byte>

# Les workflows CI/CD ne peuvent être modifiés que par le lead DevOps
.github/workflows/ @<benslimane-byte>

# Le fichier de dépendances requiert une validation technique
ressources/requirements.txt @<benslimane-byte>

# Les fichiers de sécurité requièrent une double validation
.github/dependabot.yml @<benslimane-byte>
.github/CODEOWNERS @<benslimane-byte>
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2

updates:
# GitHub Actions : surveille les "uses: action/nom@version" dans les workflows
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly" # "daily" ou "monthly" aussi possible
labels:
- "dependencies"
- "github-actions"
commit-message:
prefix: "ci" # les commits Dependabot auront le préfixe "ci:"

# pip : surveille requirements.txt dans /ressources
- package-ecosystem: "pip"
directory: "/ressources"
schedule:
interval: "weekly"
labels:
- "dependencies"
- "python"
open-pull-requests-limit: 5
commit-message:
prefix: "chore"
40 changes: 33 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
name: CI
name: CI — NexaCloud API

on:
push:
branches: [ "main" ]
branches: [main]
pull_request:
branches: [ "main" ]
branches: [main]

jobs:
build:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4

- name: Example step
run: echo "Add your build/test steps here!"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Installer flake8
run: pip install flake8

- name: Lint avec flake8
run: flake8 ressources/ --config ressources/.flake8

test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Installer les dépendances
run: pip install -r ressources/requirements.txt

- name: Lancer les tests
run: pytest ressources/ -v
73 changes: 73 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI/CD — NexaCloud API

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
qualite:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Installer les dépendances
run: pip install -r ressources/requirements.txt

- name: Lint
run: flake8 ressources/ --config ressources/.flake8

- name: Tests avec couverture
run: pytest ressources/ -v --cov=ressources --cov-report=term-missing

staging:
runs-on: ubuntu-latest
needs: qualite
environment: staging
if: github.ref_name == 'main'

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Installer les dépendances
run: pip install -r ressources/requirements.txt

- name: Déployer sur Azure App Service (staging)
uses: azure/webapps-deploy@v3
with:
app-name: "ABstaging"
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }}
package: ressources/

production:
runs-on: ubuntu-latest
needs: staging
environment: production
if: github.ref_name == 'main'

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Installer les dépendances
run: pip install -r ressources/requirements.txt

- name: Déployer sur Azure App Service (production)
uses: azure/webapps-deploy@v3
with:
app-name: "ABproduction"
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ressources/
22 changes: 22 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Deploy

on:
workflow_dispatch:

jobs:
deploy-staging:
runs-on: ubuntu-latest
environment: staging # utilise l'environnement staging

steps:
- name: Déployer en staging
run: echo "Déploiement en staging..."

deploy-production:
runs-on: ubuntu-latest
environment: production # TODO: ajouter la dépendance sur deploy-staging
needs: deploy-staging

steps:
- name: Déployer en production
run: echo "Déploiement en production !"
27 changes: 27 additions & 0 deletions .github/workflows/hello.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Hello NexaCloud

on:
push:
branches: [main]
workflow_dispatch:

jobs:
salutation:
runs-on: ubuntu-latest

steps:
- name: Checkout du code
uses: actions/checkout@v4

- name: Informations sur l'environnement
run: |
echo "Repo : ${{ github.repository }}"
echo "Branche : ${{ github.ref_name }}"
echo "Commit : ${{ github.sha }}"
echo "Acteur : ${{ github.actor }}"

- name: Lister les fichiers du repo
run: ls -la

- name: Date et heure du runner
run: date
25 changes: 25 additions & 0 deletions .github/workflows/secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Demo Secrets

on:
workflow_dispatch:

jobs:
demo:
runs-on: ubuntu-latest

env:
API_KEY: ${{ secrets.API_KEY }} # injection du secret comme variable d'environnement

steps:
- name: Vérifier que le secret est défini
run: |
if [ -z "$API_KEY" ]; then
echo "❌ Le secret API_KEY n'est pas défini"
exit 1
fi
echo "✅ Le secret API_KEY est défini (${#API_KEY} caractères)"

- name: Simuler un appel API authentifié
run: |
echo "Appel à l'API avec Authorization: Bearer ***"
# En vrai : curl -H "Authorization: Bearer $API_KEY" https://api.example.com
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ terraform.rc

# Optional: ignore plan files saved before destroying Terraform configuration
# Uncomment the line below if you want to ignore planout files.
# planout
# planout
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# .pre-commit-config.yaml — version complète
repos:
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
args: [--config, ressources/.flake8]
files: ressources/.*\.py$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-merge-conflict
- id: check-added-large-files
args: [--maxkb=500]

- repo: https://github.com/pycqa/isort
rev: 9.0.0a3
hooks:
- id: isort # trie automatiquement les imports Python
files: ressources/.*\.py$
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TP GitHub Actions — CI/CD et automatisation

**Durée estimée :** 6h
**Prérequis :** Git, GitHub, bases Bash ou PowerShell (TPs précédents)
**Durée estimée :** 6h
**Prérequis :** Git, GitHub, bases Bash ou PowerShell (TPs précédents)
**Environnement :** tout OS avec Git installé et un compte GitHub actif

---
Expand Down Expand Up @@ -242,7 +242,7 @@ Commitez et pushez. Observez l'exécution dans l'onglet **Actions**.

> ✏️ **À vous**
>
> Ajoutez un step qui affiche la date et l'heure du runner avec `date`.
> Ajoutez un step qui affiche la date et l'heure du runner avec `date`.
> Puis déclenchez le workflow **manuellement** depuis l'interface GitHub (bouton "Run workflow").

<details>
Expand Down
1 change: 1 addition & 0 deletions notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Mon TP GitHub Actions !
Binary file added ressources/__pycache__/app.cpython-314.pyc
Binary file not shown.
Binary file not shown.