Skip to content

Commit

Permalink
Merge branch 'master' into MartinCura-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinCura committed Apr 5, 2023
2 parents fae5d9a + 50afed5 commit d924470
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 190 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.4.19
current_version = 1.4.20
commit = False
tag = False

Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: test
on: [pull_request, push]

env:
MIN_LINE_RATE: 0.2

jobs:
run_tests:
runs-on: self-hosted
container:
image: python:3.8
steps:
- name: Update base image
run: |
apt update
apt install -qy libkrb5-dev libsasl2-dev
pip install poetry==1.2.2
- uses: actions/checkout@v2
- name: Install package
run: poetry install -vvv
- name: Test base imports
run: poetry run python -c 'from muttlib import dbconn, utils'
- name: Test forecast extra
run: |
poetry install -E forecast -vvv
poetry run python -c 'from muttlib import forecast'
- name: Test gsheetsconn
run: |
poetry install -E gsheets -vvv
poetry run python -c 'from muttlib import gsheetsconn'
- name: Test gdrive
run: |
poetry install -E gdrive -vvv
poetry run python -c 'from muttlib import gdrive'
- name: Run nox
run: |
poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions tests
lint:
runs-on: [self-hosted]
container:
image: python:3.8
steps:
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.2.2
- uses: actions/checkout@v2
- name: Install package
run: poetry install -vvv
- name: Run nox
run: poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions precommit_hooks

docstr-cov:
runs-on: [self-hosted]
container:
image: python:3.8
steps:
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.2.2
- uses: actions/checkout@v2
- name: Install package
run: poetry install -vvv
- name: Run interrogate
run: poetry run interrogate muttlib -c pyproject.toml -vv --generate-badge docs_coverage.svg --badge-style flat

bandit:
runs-on: [self-hosted]
container:
image: python:3.8
steps:
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.2.2
- uses: actions/checkout@v2
- name: Install package
run: poetry install -vvv
- name: Run nox
run: poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions bandit

typing:
runs-on: [self-hosted]
container:
image: python:3.8
steps:
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.2.2
- uses: actions/checkout@v2
- name: Install package
run: poetry install -vvv
- name: Run mypy and check lines
run: |
poetry run mypy ./muttlib --cobertura-xml-report ./
line_rate=$(cat cobertura.xml | grep -oP '(?<=line-rate\W{2})(\d.\d+)(?=\W\s\w+)')
python -c "import sys; exit(float(sys.argv[1]) <= float(sys.argv[2]))" $line_rate $MIN_LINE_RATE
exit_status=$?
exit $exit_status
51 changes: 51 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: validate
on: [pull_request]

jobs:
check_version:
if: github.base_ref == 'master'
runs-on: [self-hosted]
container:
image: python:3.8
steps:
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.2.2
- uses: actions/checkout@v2
- name: Install dependencies
run: pip install packaging
- name: Fetch source ref
run: git fetch origin $GITHUB_HEAD_REF
- name: Fetch target ref
run: git fetch origin $GITHUB_BASE_REF
- name: Check version
run: |
lib_ver=$(git diff origin/$GITHUB_HEAD_REF origin/$GITHUB_BASE_REF -- .bumpversion.cfg | grep "current_version" | cut -d = -f 2 | xargs)
echo "lib_ver=$lib_ver"
python -c "import sys; from packaging import version; exit(not version.parse(sys.argv[1]) > version.parse(sys.argv[2]))" $lib_ver
exit_status=$?
if [ $exit_status -eq 1 ]; then echo "Error comparing versions"; fi;
exit $exit_status
check_changelog:
if: github.base_ref == 'master'
runs-on: [self-hosted]
container:
image: python:3.8
steps:
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.2.2
- uses: actions/checkout@v2
- name: Fetch source ref
run: git fetch origin $GITHUB_HEAD_REF
- name: Fetch target ref
run: git fetch origin $GITHUB_BASE_REF
- name: Check changed lines
run: |
added_lines=$(git diff --numstat origin/$GITHUB_BASE_REF origin/$GITHUB_HEAD_REF -- CHANGELOG.md | awk '{print $1}')
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;
41 changes: 41 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: version
on:
pull_request:
types:
- closed
branches: [main]

jobs:
bump_version:
runs-on: [self-hosted]
container:
image: python:3.8
steps:
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.2.2
- uses: actions/checkout@v2
- name: Set tag output
id: set-tag
run: echo "::set-output name=tag_name::v$(grep current_version .bumpversion.cfg | cut -d= -f2 | xargs)"
- name: Create Tag
uses: actions/github-script@v3
env:
TAG: ${{ steps.set-tag.outputs.tag_name }}
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.set-tag.outputs.tag_name }}",
sha: context.sha
})
- name: Create release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.set-tag.outputs.tag_name }}
bodyFile: './CHANGELOG.md'
token: ${{ secrets.GITHUB_TOKEN }}
187 changes: 0 additions & 187 deletions .gitlab-ci.yml

This file was deleted.

Loading

0 comments on commit d924470

Please sign in to comment.