Skip to content

Commit 587dd21

Browse files
ci: update CI process (#66)
* ci: update CI process This makes changes to CI and testing for this repo. * Moves to using Nox to test on multiple python version (3.7, 3.8. 3.9. 3.10). This is configured via noxfile.py * Adds pre-commit hooks (.pre-commit-config.yaml) to do linting and testing of code at commit time * Uses pytest-cov to gather coverage info for the repo and upload it to codecov.io * Adds flake8 linting * Adds bandit security scanning * Adds safety dependency scanning * Adds dependabot dependency updates and alerts and a GHA workflow to automatically merge dependabot PRs that pass CI. * Adds a GHA workflow to manage releases using release-please and conventional commits (release-please.yml) * Adds a GHA workflow to upload releases to pypi automatically (release.yml) * Adds a GHA workflow to manage repo settings (repo-manager.yml) * Documents how to use some of these new features in CONTRIBUTING.rst and other docs. * ci: remove repo-manager workflow
1 parent b4565ee commit 587dd21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2042
-411
lines changed

.flake8

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
[flake8]
3+
# Eventually would add D and DAR
4+
select = B,B9,C,E,F,N,RST,S,W
5+
ignore = E203,E501,RST201,RST203,RST301,W503,B902,N805,DAR402
6+
max-line-length = 119
7+
max-complexity = 10
8+
docstring-convention = google
9+
per-file-ignores = tests/*:S101
10+
rst-roles = class,const,func,meth,mod,ref
11+
rst-directives = deprecated

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# .github/workflows
2+
3+
## ISSUE_TEMPLATE
4+
5+
Used as templates when creating new issues in the repo
6+
7+
## Workflows
8+
9+
### constraints.txt
10+
11+
Constraints.txt is a pip install file that constrains some python requirements outside of poetry.
12+
13+
### dependabot-auto-merge.yml
14+
15+
A workflow that runs on PRs that will automatically merge dependabot update PRs that pass testing
16+
17+
### release-please.yml
18+
19+
A workflow that manages releases for the repo. On merges to the main branch, it scans them for [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
20+
and will then create or update a release pr with those changes. The [release-please](https://github.com/googleapis/release-please) docs have more info.
21+
22+
When that release pr is merged, it will build and upload to pypi.
23+
24+
### release.yml
25+
26+
A workflow that runs on the creation of releases to upload the package to pypi
27+
28+
### repo-manager.yml
29+
30+
Works with .github/settings.yml and the [repo-manager Github Action](https://github.com/marketplace/actions/yaml-repo-manager) to configure settings for the repo.
31+
32+
Runs as a cron everyday at 00:02 and on demand with workflow dispatch.
33+
34+
### Required Secrets
35+
36+
* THIS_PAT - a personal access token that has access to create releases on this repo and edit the repo's settings. Used with release-please and repo-manager
37+
* PYPI_TOKEN - a pypi token that can upload to pypi for this package. Used with release
38+
39+
## dependabot.yml
40+
41+
Configures dependabot updates and alerts for this repo
42+
43+
## release-drafter.yml
44+
45+
Configures how release notes are written by release-please
46+
47+
## settings.yaml
48+
49+
repo-manager settings that are configured on the repo

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: pip
8+
directory: "/.github/workflows"
9+
schedule:
10+
interval: daily
11+
- package-ecosystem: pip
12+
directory: "/docs"
13+
schedule:
14+
interval: daily
15+
- package-ecosystem: pip
16+
directory: "/"
17+
schedule:
18+
interval: daily

.github/release-drafter.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
categories:
2+
- title: ":boom: Breaking Changes"
3+
label: "breaking"
4+
- title: ":rocket: Features"
5+
label: "enhancement"
6+
- title: ":fire: Removals and Deprecations"
7+
label: "removal"
8+
- title: ":beetle: Fixes"
9+
label: "bug"
10+
- title: ":racehorse: Performance"
11+
label: "performance"
12+
- title: ":rotating_light: Testing"
13+
label: "testing"
14+
- title: ":construction_worker: Continuous Integration"
15+
label: "ci"
16+
- title: ":books: Documentation"
17+
label: "documentation"
18+
- title: ":hammer: Refactoring"
19+
label: "refactoring"
20+
- title: ":lipstick: Style"
21+
label: "style"
22+
- title: ":package: Dependencies"
23+
labels:
24+
- "dependencies"
25+
- "build"
26+
template: |
27+
## Changes
28+
29+
$CHANGES

.github/workflows/constraints.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pip==22.2.2
2+
nox==2022.1.7
3+
nox-poetry==1.0.1
4+
poetry==1.1.14
5+
virtualenv==20.15.1
6+
poetry-dynamic-versioning==0.17.1
7+
toml==0.10.2
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Auto Merge Dependabot
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
auto-merge:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: ahmadnassri/action-dependabot-auto-merge@v2
12+
with:
13+
target: minor
14+
github-token: ${{ secrets.THIS_PAT }}

.github/workflows/release-please.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
name: release-please
6+
jobs:
7+
release-please:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: google-github-actions/release-please-action@v3
11+
with:
12+
token: ${{ secrets.THIS_PAT }}
13+
release-type: python
14+
package-name: ducks

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release to pypi
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
release:
9+
name: Release
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repository
13+
uses: actions/[email protected]
14+
with:
15+
fetch-depth: 2
16+
17+
- name: Set up Python
18+
uses: actions/[email protected]
19+
with:
20+
python-version: "3.10"
21+
22+
- name: Upgrade pip
23+
run: |
24+
pip install --constraint=.github/workflows/constraints.txt pip
25+
pip --version
26+
27+
- name: Install Poetry
28+
run: |
29+
pip install --constraint=.github/workflows/constraints.txt poetry poetry-dynamic-versioning
30+
poetry --version
31+
32+
- name: Build package
33+
run: |
34+
poetry build --ansi
35+
36+
- name: Publish package on PyPI
37+
uses: pypa/[email protected]
38+
with:
39+
user: __token__
40+
password: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)