Skip to content

Commit

Permalink
Merge pull request #6 from MuttData/MartinCura-patch-1
Browse files Browse the repository at this point in the history
Support python 3.10
  • Loading branch information
MartinCura authored Apr 5, 2023
2 parents 50afed5 + c8e1d59 commit 1e838f5
Show file tree
Hide file tree
Showing 13 changed files with 2,621 additions and 606 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.20
current_version = 1.4.21
commit = False
tag = False

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

env:
MIN_LINE_RATE: 0.2
Expand All @@ -8,99 +8,96 @@ jobs:
run_tests:
runs-on: self-hosted
container:
image: python:3.8
image: python:3.10
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
- name: Update base image
run: |
apt update
apt install -qy libkrb5-dev libsasl2-dev
pip install poetry==1.3.2
- uses: actions/checkout@v2
- name: Install packages and extras
run: poetry install --extras "forecast gsheets gdrive" --with dev
- name: Test base imports
run: poetry run python -c 'from muttlib import dbconn, utils'
- name: Test forecast extra
run: |
poetry run python -c 'from muttlib import forecast'
- name: Test gsheetsconn
run: |
poetry run python -c 'from muttlib import gsheetsconn'
- name: Test gdrive
run: |
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
image: python:3.10
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
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.3.2
- uses: actions/checkout@v2
- name: Install package
run: poetry install -vvv --with dev -E "gdrive gsheets forecast"
- 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
image: python:3.10
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
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.3.2
- uses: actions/checkout@v2
- name: Install package
run: poetry install -vvv --with dev
- 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
image: python:3.10
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
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.3.2
- uses: actions/checkout@v2
- name: Install package
run: poetry install -vvv --with dev
- name: Run nox
run: poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions bandit

typing:
runs-on: [self-hosted]
container:
image: python:3.8
image: python:3.10
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
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.3.2
- uses: actions/checkout@v2
- name: Install package
run: poetry install -vvv --with dev
- 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
72 changes: 36 additions & 36 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,46 @@ jobs:
if: github.base_ref == 'master'
runs-on: [self-hosted]
container:
image: python:3.8
image: python:3.10
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
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.3.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
image: python:3.10
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;
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.3.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;
30 changes: 15 additions & 15 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@ on:
pull_request:
types:
- closed
branches: [main]
branches: [master]

jobs:
bump_version:
runs-on: [self-hosted]
container:
image: python:3.8
image: python:3.10
steps:
- name: Update base image
run: |
apt update
apt install -y libkrb5-dev libsasl2-dev
pip install poetry==1.2.2
pip install poetry==1.3.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 }}
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
})
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 }}
tag: ${{ steps.set-tag.outputs.tag_name }}
bodyFile: "./CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 1e838f5

Please sign in to comment.