Skip to content

Commit 91b8102

Browse files
authored
Merge db448bf into 7a7488e
2 parents 7a7488e + db448bf commit 91b8102

6 files changed

Lines changed: 199 additions & 188 deletions

File tree

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.4.19
2+
current_version = 1.4.20.alpha
33
commit = False
44
tag = False
55

.github/workflows/test.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: test
2+
on: [pull_request, push]
3+
4+
env:
5+
MIN_LINE_RATE: 0.2
6+
7+
jobs:
8+
run_tests:
9+
runs-on: self-hosted
10+
container:
11+
image: python:3.8
12+
steps:
13+
- name: Update base image
14+
run: |
15+
apt update
16+
apt install -qy libkrb5-dev libsasl2-dev
17+
pip install poetry==1.2.2
18+
- uses: actions/checkout@v2
19+
- name: Install package
20+
run: poetry install -vvv
21+
- name: Test base imports
22+
run: poetry run python -c 'from muttlib import dbconn, utils'
23+
- name: Test forecast extra
24+
run: |
25+
poetry install -E forecast -vvv
26+
poetry run python -c 'from muttlib import forecast'
27+
- name: Test gsheetsconn
28+
run: |
29+
poetry install -E gsheets -vvv
30+
poetry run python -c 'from muttlib import gsheetsconn'
31+
- name: Test gdrive
32+
run: |
33+
poetry install -E gdrive -vvv
34+
poetry run python -c 'from muttlib import gdrive'
35+
- name: Run nox
36+
run: |
37+
poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions tests
38+
39+
lint:
40+
runs-on: [self-hosted]
41+
container:
42+
image: python:3.8
43+
steps:
44+
- name: Update base image
45+
run: |
46+
apt update
47+
apt install -y libkrb5-dev libsasl2-dev
48+
pip install poetry==1.2.2
49+
- uses: actions/checkout@v2
50+
- name: Install package
51+
run: poetry install -vvv
52+
- name: Run nox
53+
run: poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions precommit_hooks
54+
55+
docstr-cov:
56+
runs-on: [self-hosted]
57+
container:
58+
image: python:3.8
59+
steps:
60+
- name: Update base image
61+
run: |
62+
apt update
63+
apt install -y libkrb5-dev libsasl2-dev
64+
pip install poetry==1.2.2
65+
- uses: actions/checkout@v2
66+
- name: Install package
67+
run: poetry install -vvv
68+
- name: Run interrogate
69+
run: poetry run interrogate muttlib -c pyproject.toml -vv --generate-badge docs_coverage.svg --badge-style flat
70+
71+
bandit:
72+
runs-on: [self-hosted]
73+
container:
74+
image: python:3.8
75+
steps:
76+
- name: Update base image
77+
run: |
78+
apt update
79+
apt install -y libkrb5-dev libsasl2-dev
80+
pip install poetry==1.2.2
81+
- uses: actions/checkout@v2
82+
- name: Install package
83+
run: poetry install -vvv
84+
- name: Run nox
85+
run: poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions bandit
86+
87+
typing:
88+
runs-on: [self-hosted]
89+
container:
90+
image: python:3.8
91+
steps:
92+
- name: Update base image
93+
run: |
94+
apt update
95+
apt install -y libkrb5-dev libsasl2-dev
96+
pip install poetry==1.2.2
97+
- uses: actions/checkout@v2
98+
- name: Install package
99+
run: poetry install -vvv
100+
- name: Run mypy and check lines
101+
run: |
102+
poetry run mypy ./muttlib --cobertura-xml-report ./
103+
line_rate=$(cat cobertura.xml | grep -oP '(?<=line-rate\W{2})(\d.\d+)(?=\W\s\w+)')
104+
python -c "import sys; exit(float(sys.argv[1]) <= float(sys.argv[2]))" $line_rate $MIN_LINE_RATE
105+
exit_status=$?
106+
exit $exit_status

.github/workflows/validate.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: validate
2+
on: [pull_request]
3+
4+
jobs:
5+
check_version:
6+
if: github.base_ref == 'master'
7+
runs-on: [self-hosted]
8+
container:
9+
image: python:3.8
10+
steps:
11+
- name: Update base image
12+
run: |
13+
apt update
14+
apt install -y libkrb5-dev libsasl2-dev
15+
pip install poetry==1.2.2
16+
- uses: actions/checkout@v2
17+
- name: Install dependencies
18+
run: pip install packaging
19+
- name: Fetch source ref
20+
run: git fetch origin $GITHUB_HEAD_REF
21+
- name: Fetch target ref
22+
run: git fetch origin $GITHUB_BASE_REF
23+
- name: Check version
24+
run: |
25+
lib_ver=$(git diff origin/$GITHUB_HEAD_REF origin/$GITHUB_BASE_REF -- .bumpversion.cfg | grep "current_version" | cut -d = -f 2 | xargs)
26+
echo "lib_ver=$lib_ver"
27+
python -c "import sys; from packaging import version; exit(not version.parse(sys.argv[1]) > version.parse(sys.argv[2]))" $lib_ver
28+
exit_status=$?
29+
if [ $exit_status -eq 1 ]; then echo "Error comparing versions"; fi;
30+
exit $exit_status
31+
32+
check_changelog:
33+
if: github.base_ref == 'master'
34+
runs-on: [self-hosted]
35+
container:
36+
image: python:3.8
37+
steps:
38+
- name: Update base image
39+
run: |
40+
apt update
41+
apt install -y libkrb5-dev libsasl2-dev
42+
pip install poetry==1.2.2
43+
- uses: actions/checkout@v2
44+
- name: Fetch source ref
45+
run: git fetch origin $GITHUB_HEAD_REF
46+
- name: Fetch target ref
47+
run: git fetch origin $GITHUB_BASE_REF
48+
- name: Check changed lines
49+
run: |
50+
added_lines=$(git diff --numstat origin/$GITHUB_BASE_REF origin/$GITHUB_HEAD_REF -- CHANGELOG.md | awk '{print $1}')
51+
if [ -z $added_lines ] || [ $added_lines -eq 0 ]; then echo "Changelog has not been modified" && exit 1; else echo "Changelog has been modified" && exit 0; fi;

.github/workflows/version.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: linters
2+
on: [pull_request]
3+
4+
jobs:
5+
bump_version:
6+
runs-on: [self-hosted]
7+
container:
8+
image: python:3.8
9+
steps:
10+
- name: Update base image
11+
run: |
12+
apt update
13+
apt install -y libkrb5-dev libsasl2-dev
14+
pip install poetry==1.2.2
15+
- uses: actions/checkout@v2
16+
- name: Set tag output
17+
id: set-tag
18+
run: echo "::set-output name=tag_name::v$(grep current_version .bumpversion.cfg | cut -d= -f2 | xargs)"
19+
- name: Create Tag
20+
uses: actions/github-script@v3
21+
env:
22+
TAG: ${{ steps.set-tag.outputs.tag_name }}
23+
with:
24+
github-token: ${{ github.token }}
25+
script: |
26+
github.git.createRef({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
ref: "refs/tags/${{ steps.set-tag.outputs.tag_name }}",
30+
sha: context.sha
31+
})
32+
- name: Create release
33+
uses: ncipollo/release-action@v1
34+
with:
35+
tag: ${{ steps.set-tag.outputs.tag_name }}
36+
bodyFile: './CHANGELOG.md'
37+
token: ${{ secrets.GITHUB_TOKEN }}

.gitlab-ci.yml

Lines changed: 0 additions & 187 deletions
This file was deleted.

0 commit comments

Comments
 (0)