Skip to content

Commit 7114bb7

Browse files
committed
ci: Add config files for CI with GitHub Actions
1 parent c4e4f52 commit 7114bb7

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
name: release
3+
4+
on:
5+
release:
6+
types: [released]
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
python-version: [2.7]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
# It seems that coverage6.0 has been released, and it resolves to 6.0, which causes an error in coverage-badge, so tentatively specifying the coverage version.
29+
# pip install flake8 pytest pytest-cov coverage-badge
30+
pip install flake8 pytest 'coverage>=5.5,<6' pytest-cov coverage-badge
31+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32+
33+
- name: Lint with flake8
34+
run: |
35+
# stop the build if there are Python syntax errors or undefined names
36+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37+
# exit-zero treats all errors as warnings.
38+
flake8 . --exclude tests --ignore E301,E302,E303,E305,W391 --count --exit-zero --max-complexity=10 --max-line-length=300 --statistics
39+
40+
- name: Test with pytest & Collect coverage
41+
run: |
42+
pytest -v tests --cov=src.csvdiff2 --cov-report=term-missing --cov-report=html
43+
44+
- name: Make coverage badge
45+
run: |
46+
coverage-badge -o ./htmlcov/coverage.svg
47+
48+
- name: Upload coverage-report to GitHub Pages
49+
uses: peaceiris/actions-gh-pages@v3
50+
with:
51+
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
publish_dir: ./htmlcov

.github/workflows/testing.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
name: testing
3+
4+
on:
5+
pull_request:
6+
branches: [main, develop]
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
python-version: [2.7]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install flake8 pytest pytest-cov
29+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30+
31+
- name: Lint with flake8
32+
run: |
33+
# stop the build if there are Python syntax errors or undefined names
34+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35+
# exit-zero treats all errors as warnings.
36+
flake8 . --exclude tests --ignore E301,E302,E303,E305,W391 --count --exit-zero --max-complexity=10 --max-line-length=300 --statistics
37+
38+
- name: Test with pytest
39+
run: |
40+
pytest -v tests --cov=src.csvdiff2 --cov-report=term-missing --cov-report=html

0 commit comments

Comments
 (0)