1
- stages :
2
- - lint
3
- - test
4
- - build
5
- - deploy
1
+ name : CI/CD Pipeline
6
2
7
- variables :
8
- PIP_CACHE_DIR : " $CI_PROJECT_DIR/.pip-cache"
3
+ on :
4
+ push :
5
+ branches : [ master ]
6
+ pull_request :
7
+ branches : [ master ]
9
8
10
- cache :
11
- paths :
12
- - .pip-cache/
9
+ jobs :
10
+ lint :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - uses : actions/checkout@v2
14
+ - name : Set up Python
15
+ uses : actions/setup-python@v2
16
+ with :
17
+ python-version : 3.9
18
+ - name : Install dependencies
19
+ run : |
20
+ python -m pip install --upgrade pip
21
+ pip install flake8
22
+ - name : Lint with flake8
23
+ run : flake8 .
13
24
14
- lint :
15
- stage : lint
16
- image : python:3.9
17
- before_script :
18
- - pip install flake8
19
- script :
20
- - flake8 .
25
+ test :
26
+ runs-on : ubuntu-latest
27
+ steps :
28
+ - uses : actions/checkout@v2
29
+ - name : Set up Python
30
+ uses : actions/setup-python@v2
31
+ with :
32
+ python-version : 3.9
33
+ - name : Install dependencies
34
+ run : |
35
+ python -m pip install --upgrade pip
36
+ pip install -r requirements.txt
37
+ pip install pytest pytest-cov
38
+ - name : Run tests
39
+ run : pytest tests/ --cov=./ --cov-report=xml
40
+ - name : Upload coverage report
41
+ uses : actions/upload-artifact@v2
42
+ with :
43
+ name : coverage-report
44
+ path : coverage.xml
21
45
22
- test :
23
- stage : test
24
- image : python:3.9
25
- before_script :
26
- - pip install -r requirements.txt
27
- - pip install pytest pytest-cov
28
- script :
29
- - pytest tests/ --cov=./ --cov-report=xml
30
- artifacts :
31
- reports :
32
- coverage_report :
33
- coverage_format : cobertura
34
- path : coverage.xml
46
+ build :
47
+ runs-on : ubuntu-latest
48
+ needs : [ lint, test ]
49
+ steps :
50
+ - uses : actions/checkout@v2
51
+ - name : Set up Python
52
+ uses : actions/setup-python@v2
53
+ with :
54
+ python-version : 3.9
55
+ - name : Install dependencies
56
+ run : |
57
+ python -m pip install --upgrade pip
58
+ pip install pyinstaller
59
+ - name : Build executable
60
+ run : pyinstaller --onefile main.py
61
+ - name : Upload artifact
62
+ uses : actions/upload-artifact@v2
63
+ with :
64
+ name : abap-code-scanner
65
+ path : dist/main
35
66
36
- build :
37
- stage : build
38
- image : python:3.9
39
- script :
40
- - pip install pyinstaller
41
- - pyinstaller --onefile main.py
42
- artifacts :
43
- paths :
44
- - dist/main
45
-
46
- deploy :
47
- stage : deploy
48
- image : python:3.9
49
- script :
50
- - echo "Deploying application..."
51
- # Add your deployment steps here
52
- only :
53
- - main # This job will only run on the main branch
67
+ deploy :
68
+ runs-on : ubuntu-latest
69
+ needs : build
70
+ if : github.ref == 'refs/heads/main'
71
+ steps :
72
+ - name : Deploy application
73
+ run : |
74
+ echo "Deploying application..."
75
+ # Add your deployment steps here
0 commit comments