Skip to content

Commit 6a9b0e9

Browse files
committed
feat: add lint & build to ci
1 parent 5a845af commit 6a9b0e9

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- prod
8+
- preprod
9+
- staging
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: astral-sh/ruff-action@v3
17+
18+
build:
19+
needs: lint
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- image: honeypot-ftp
26+
context: ./honeypots/ftp
27+
- image: honeypot-http
28+
context: ./honeypots/http
29+
- image: honeypot-ssh
30+
context: ./honeypots/ssh
31+
- image: honeybot
32+
context: ./attacks
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Docker meta
36+
id: meta
37+
uses: docker/metadata-action@v6
38+
with:
39+
images: |
40+
qualite863/${{ matrix.image }}
41+
tags: |
42+
type=ref,event=branch
43+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/prod' || github.ref == 'refs/heads/main' }}
44+
type=semver,pattern={{version}}
45+
type=semver,pattern={{major}}.{{minor}}
46+
type=sha
47+
- name: Login Docker
48+
if: github.event_name != 'pull_request'
49+
uses: docker/login-action@v4
50+
with:
51+
username: ${{ secrets.DOCKER_USERNAME }}
52+
password: ${{ secrets.DOCKER_PASSWORD }}
53+
- name: Set up Buildx
54+
uses: docker/setup-buildx-action@v4
55+
- name: Build and push
56+
uses: docker/build-push-action@v7
57+
with:
58+
context: ${{ matrix.context }}
59+
push: ${{ github.event_name != 'pull_request' }}
60+
tags: ${{ steps.meta.outputs.tags }}
61+
labels: ${{ steps.meta.outputs.labels }}
62+
cache-from: type=gha,scope=${{ matrix.image }}
63+
cache-to: type=gha,mode=max,scope=${{ matrix.image }}

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.env
2+
__pycache__
3+
.venv
4+
.idea

‎ruff.toml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
line-length = 100 # Longueur maximale des lignes
2+
target-version = "py312" # Version de Python
3+
4+
[lint]
5+
select = ["E", "F", "W", "I", "N", "UP"] # Sélection des règles de linting
6+
ignore = ["E501"] # Ignorer la règle E501, ligne trop longue
7+
8+
[lint.per-file-ignores]
9+
"tests/**" = ["S101"] # autorise assert dans les tests

0 commit comments

Comments
 (0)