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