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 .
21
-
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
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 : List directory contents
39
+ run : ls -R
40
+ - name : Run tests
41
+ run : |
42
+ export PYTHONPATH=$PYTHONPATH:$(pwd)
43
+ pytest tests/ -v --cov=./ --cov-report=xml
44
+ - name : Upload coverage report
45
+ uses : actions/upload-artifact@v2
46
+ with :
47
+ name : coverage-report
34
48
path : coverage.xml
35
49
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
50
+ build :
51
+ runs-on : ubuntu-latest
52
+ needs : [lint, test]
53
+ steps :
54
+ - uses : actions/checkout@v2
55
+ - name : Set up Python
56
+ uses : actions/setup-python@v2
57
+ with :
58
+ python-version : 3.9
59
+ - name : Install dependencies
60
+ run : |
61
+ python -m pip install --upgrade pip
62
+ pip install pyinstaller
63
+ - name : Build executable
64
+ run : pyinstaller --onefile main.py
65
+ - name : Upload artifact
66
+ uses : actions/upload-artifact@v2
67
+ with :
68
+ name : abap-code-scanner
69
+ path : dist/main
45
70
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
71
+ deploy :
72
+ runs-on : ubuntu-latest
73
+ needs : build
74
+ if : github.ref == 'refs/heads/main'
75
+ steps :
76
+ - name : Deploy application
77
+ run : |
78
+ echo "Deploying application..."
79
+ # Add your deployment steps here
0 commit comments