10
10
branches : [ main ]
11
11
12
12
jobs :
13
- deploy :
13
+ build :
14
14
runs-on : ubuntu-latest
15
15
16
16
strategy :
17
17
matrix :
18
- python-version : [3.7, 3.8, 3.9 ]
18
+ python-version : [3.7]
19
19
20
20
steps :
21
21
- uses : actions/checkout@v2
@@ -26,14 +26,35 @@ jobs:
26
26
- name : Install dependencies
27
27
run : |
28
28
python -m pip install --upgrade pip
29
- python -m pip install flake8 pytest
30
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29
+ pip install -e . -r requirements.txt -r requirements-tests.txt python-semantic-release
30
+ sudo apt-get update && sudo apt-get install -y nodejs npm && sudo npm install -g dockerfilelint
31
31
- name : Lint with flake8
32
32
run : |
33
33
# stop the build if there are Python syntax errors or undefined names
34
- flake8 vmware_exporter tests --count --show-source -- statistics
35
- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36
- flake8 vmware_exporter tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
34
+ flake8 vmware_exporter tests --statistics
35
+ - name : Lint dockerfile
36
+ run : dockerfilelint ./Dockerfile
37
37
- name : Test with pytest
38
38
run : |
39
39
pytest --cov=. -v tests/unit
40
+ - uses : codecov/codecov-action@v1
41
+ - name : integration tests
42
+ run : |
43
+ pytest tests/integration
44
+
45
+ deploy :
46
+ needs : ["build"]
47
+ runs-on : ubuntu-latest
48
+
49
+ steps :
50
+ - name : deploy pip
51
+ if : ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
52
+ run : |
53
+ git config --global user.name "semantic-release (via github actions)"
54
+ git config --global user.email "semantic-release@github-actions"
55
+ semantic-release publish
56
+ semantic-release changelog --post
57
+ env : # Or as an environment variable
58
+ GH_TOKEN : ${{ secrets.GH_TOKEN }}
59
+ PYPI_USERNAME : ${{ secrets.PYPI_USERNAME }}
60
+ PYPI_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
0 commit comments