Skip to content

Commit 5a7ccd1

Browse files
clean CI code a bit + add CodeQL steps (#13)
1 parent 8278366 commit 5a7ccd1

File tree

4 files changed

+39
-19
lines changed

4 files changed

+39
-19
lines changed

.github/workflows/_code_checks.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ jobs:
4242
pip install -r requirements.txt
4343
4444
- name: lint
45-
run: |
46-
make lint
45+
run: make lint
4746

4847
- name: test
49-
run: |
50-
make test
48+
run: make test
49+
50+
- name: codeql_init
51+
uses: github/codeql-action/init@v1
52+
with:
53+
languages: 'python'
54+
55+
- name: codeql_analyze
56+
uses: github/codeql-action/analyze@v1

.github/workflows/release.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,28 @@ jobs:
3939
- name: Install dependencies
4040
run: |
4141
python -m pip install --upgrade pip
42-
pip install bump2version
42+
pip install --upgrade -r requirements_release.txt
4343
4444
- name: Bump Major Version
4545
env:
4646
COMMIT_MSG: ${{ github.event.head_commit.message }}
47-
run: |
48-
bump2version major
47+
run: bump2version major
4948
if: startsWith(github.event.head_commit.message, '[MAJOR]')
5049

5150
- name: Bump Minor Version
5251
env:
5352
COMMIT_MSG: ${{ github.event.head_commit.message }}
54-
run: |
55-
bump2version minor
53+
run: bump2version minor
5654
if: startsWith(github.event.head_commit.message, '[MINOR]')
5755

5856
- name: Bump Patch Version
5957
env:
6058
COMMIT_MSG: ${{ github.event.head_commit.message }}
61-
run: |
62-
bump2version patch
59+
run: bump2version patch
6360
if: startsWith(github.event.head_commit.message, '[PATCH]')
6461

6562
- name: Commit version change to main
66-
run: |
67-
git push --follow-tags
63+
run: git push --follow-tags
6864

6965
code_checks:
7066
needs: version_bump
@@ -117,12 +113,10 @@ jobs:
117113

118114
- name: Build pypi package
119115
run: |
120-
python3 -m pip install -U setuptools twine wheel
121-
rm -rf dist
122-
python3 setup.py sdist
123-
python3 -m twine check dist/*
116+
python -m pip install --upgrade pip
117+
pip install --upgrade -r requirements_release.txt
118+
make build_package
124119
125120
- name: Publish pypi package
126121
run: |
127-
ls -la
128-
python3 -m twine upload --verbose -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} dist/*
122+
make publish_package TWINE_USERNAME=__token__ TWINE_PASSWORD=${{ secrets.PYPI_API_TOKEN }}

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,19 @@ test:
99
then python3 -m pytest tests; \
1010
else nosetests -v --with-coverage --cover-package=$(PROJECT) tests; \
1111
fi
12+
13+
build_package:
14+
rm -rf dist && \
15+
python3 setup.py sdist && \
16+
python3 -m twine check dist/*
17+
18+
publish_package:
19+
ifndef TWINE_USERNAME
20+
$(error TWINE_USERNAME is not set)
21+
else
22+
ifndef TWINE_PASSWORD
23+
$(error TWINE_PASSWORD is not set)
24+
endif
25+
endif
26+
python3 -m twine upload --verbose -u $(TWINE_USERNAME) -p $(TWINE_PASSWORD) dist/*
27+

requirements_release.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bump2version
2+
setuptools
3+
twine
4+
wheel

0 commit comments

Comments
 (0)