-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
894 additions
and
507 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Editor configuration options. | ||
# See: https://spec.editorconfig.org/ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 80 | ||
trim_trailing_whitespace = true | ||
|
||
[.editorconfig] | ||
max_line_length = off | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[{*.py,*.pyi}] | ||
max_line_length = 88 | ||
|
||
[{*.bash,*.sh,*.zsh}] | ||
indent_size = 2 | ||
tab_width = 2 | ||
|
||
[{*.har,*.json,*.json5}] | ||
indent_size = 2 | ||
max_line_length = off | ||
|
||
[{*.markdown,*.md,*.rst}] | ||
max_line_length = off | ||
ij_visual_guides = none | ||
|
||
[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}] | ||
max_line_length = off | ||
|
||
[{*.ini, *.cfg}] | ||
max_line_length = off | ||
|
||
[{*.yaml,*.yml}] | ||
indent_size = 2 | ||
max_line_length = off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
- [ ] Have you followed the guidelines for contributing? | ||
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? | ||
|
||
----- | ||
- [ ] Have you successfully run `tox`? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
// Configuration file for RenovateBot: https://docs.renovatebot.com/configuration-options | ||
extends: ["config:base"], | ||
labels: ["dependencies"], // For convenient searching in GitHub | ||
pip_requirements: { | ||
fileMatch: ["^tox.ini$", "(^|/)requirements([\\w-]*)\\.txt$"] | ||
}, | ||
packageRules: [ | ||
{ | ||
// Automerge patches, pin changes and digest changes. | ||
// Also groups these changes together. | ||
groupName: "bugfixes", | ||
excludePackagePrefixes: ["dev", "lint", "types"], | ||
matchUpdateTypes: ["patch", "pin", "digest"], | ||
prPriority: 3, // Patches should go first! | ||
automerge: true | ||
}, | ||
{ | ||
// Update all internal packages in one higher-priority PR | ||
groupName: "internal packages", | ||
matchPackagePrefixes: ["craft-", "snap-"], | ||
matchLanguages: ["python"], | ||
prPriority: 2 | ||
}, | ||
{ | ||
// GitHub Actions are higher priority to update than most dependencies. | ||
groupName: "GitHub Actions", | ||
matchManagers: ["github-actions"], | ||
prPriority: 1, | ||
automerge: true, | ||
}, | ||
// Everything not in one of these rules gets priority 0 and falls here. | ||
{ | ||
// Minor changes can be grouped and automerged for dev dependencies, but are also deprioritised. | ||
groupName: "development dependencies (non-major)", | ||
groupSlug: "dev-dependencies", | ||
matchPackagePrefixes: [ | ||
"dev", | ||
"lint", | ||
"types" | ||
], | ||
excludePackagePatterns: ["ruff"], | ||
matchUpdateTypes: ["minor", "patch", "pin", "digest"], | ||
prPriority: -1, | ||
automerge: true | ||
}, | ||
{ | ||
// Documentation related updates | ||
groupName: "documentation dependencies", | ||
groupSlug: "doc-dependencies", | ||
matchPackageNames: ["Sphinx"], | ||
matchPackagePatterns: ["^[Ss]phinx.*$", "^furo$"], | ||
matchPackagePrefixes: ["docs"], | ||
}, | ||
{ | ||
// Other major dependencies get deprioritised below minor dev dependencies. | ||
matchUpdateTypes: ["major"], | ||
prPriority: -2 | ||
}, | ||
{ | ||
// Major dev dependencies are stone last, but grouped. | ||
groupName: "development dependencies (major versions)", | ||
groupSlug: "dev-dependencies", | ||
matchDepTypes: ["devDependencies"], | ||
matchUpdateTypes: ["major"], | ||
prPriority: -3 | ||
}, | ||
{ | ||
// Ruff is still unstable, so update it separately. | ||
groupName: "ruff", | ||
matchPackagePatterns: ["^(lint/)?ruff$"], | ||
prPriority: -3 | ||
} | ||
], | ||
regexManagers: [ | ||
{ | ||
// tox.ini can get updates too if we specify for each package. | ||
fileMatch: ["tox.ini"], | ||
depTypeTemplate: "devDependencies", | ||
matchStrings: [ | ||
"# renovate: datasource=(?<datasource>\\S+)\n\\s+(?<depName>.*?)(\\[[\\w]*\\])*[=><]=?(?<currentValue>.*?)\n" | ||
] | ||
}, | ||
{ | ||
// .pre-commit-config.yaml version updates | ||
fileMatch: [".pre-commit-config.yaml"], | ||
depTypeTemplate: "devDependencies", | ||
matchStrings: [ | ||
"# renovate: datasource=(?<datasource>\\S+);\\s*depName=(?<depName>.*?)\n\s+rev: \"v?(?<currentValue>.*?)\"" | ||
] | ||
} | ||
], | ||
timezone: "Etc/UTC", | ||
automergeSchedule: "every weekend", | ||
schedule: "every weekend", | ||
prConcurrentLimit: 2, // No more than 2 open PRs at a time. | ||
prCreation: "not-pending", // Wait until status checks have completed before raising the PR | ||
prNotPendingHours: 4, // ...unless the status checks have been running for 4+ hours. | ||
prHourlyLimit: 1, // No more than 1 PR per hour. | ||
stabilityDays: 2 // Wait 2 days from release before updating. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Documentation | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "feature/*" | ||
- "hotfix/*" | ||
- "release/*" | ||
pull_request: | ||
paths: | ||
- "docs/**" | ||
- "pyproject.toml" | ||
- ".github/workflows/docs.yaml" | ||
|
||
jobs: | ||
sphinx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install Tox | ||
run: pip install tox | ||
- name: Lint documentation | ||
run: tox run -e lint-docs | ||
- name: Build documentation | ||
run: tox run -e build-docs | ||
- name: Upload documentation | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: docs | ||
path: docs/_build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,79 @@ | ||
name: Tests | ||
|
||
name: Tests, linting, etc. | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- "main" | ||
- "feature/*" | ||
- "hotfix/*" | ||
- "release/*" | ||
pull_request: | ||
|
||
jobs: | ||
linters: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install python packages and dependencies | ||
run: | | ||
pip install -U -e .[dev] | ||
- name: Run black | ||
run: | | ||
make test-black | ||
- name: Run codespell | ||
run: | | ||
make test-codespell | ||
- name: Run flake8 | ||
run: | | ||
make test-flake8 | ||
- name: Run isort | ||
run: | | ||
make test-isort | ||
- name: Run mypy | ||
run: | | ||
make test-mypy | ||
- name: Run pydocstyle | ||
python-version: '3.10' | ||
- name: Configure environment | ||
run: | | ||
make test-pydocstyle | ||
- name: Run pylint | ||
run: | | ||
make test-pylint | ||
- name: Run pyright | ||
run: | | ||
sudo snap install --classic node | ||
sudo snap install --classic pyright | ||
make test-pyright | ||
echo "::group::Begin snap install" | ||
echo "Installing snaps in the background while running apt and pip..." | ||
sudo snap install --no-wait --classic pyright | ||
sudo snap install --no-wait shellcheck | ||
echo "::endgroup::" | ||
echo "::group::pip install" | ||
python -m pip install 'tox>=4' tox-gh | ||
echo "::endgroup::" | ||
echo "::group::Create virtual environments for linting processes." | ||
tox run -m lint --notest | ||
echo "::endgroup::" | ||
echo "::group::Wait for snap to complete" | ||
snap watch --last=install | ||
echo "::endgroup::" | ||
- name: Run Linters | ||
run: tox run -m lint | ||
tests: | ||
strategy: | ||
matrix: | ||
os: [macos-11, macos-12, ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022] | ||
python-version: [3.8, 3.9, "3.10", "3.11", "3.12-dev"] | ||
|
||
runs-on: ${{ matrix.os }} | ||
platform: [macos-latest, ubuntu-20.04, ubuntu-22.04, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} | ||
uses: actions/setup-python@v2 | ||
- name: Set up Python versions on ${{ matrix.platform }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install generic dependencies and craft-cli | ||
python-version: | | ||
3.8 | ||
3.9 | ||
3.10 | ||
3.11 | ||
3.12-dev | ||
- name: Configure environment | ||
run: | | ||
pip install -U -e .[dev] | ||
- name: Run unit tests | ||
run: | | ||
make test-units | ||
- name: Run integration tests | ||
run: | | ||
make test-integrations | ||
echo "::group::pip install" | ||
python -m pip install 'tox>=4' tox-gh | ||
echo "::endgroup::" | ||
mkdir -p results | ||
- name: Setup Tox environments | ||
run: tox run -m tests --notest | ||
- name: Test with tox | ||
run: tox run-parallel --parallel all --parallel-no-spinner --skip-pkg-install --result-json results/tox-${{ matrix.platform }}.json -m tests -- --no-header --quiet -rN | ||
- name: Upload code coverage | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
directory: ./results/ | ||
files: coverage*.xml | ||
- name: Upload test results | ||
if: success() || failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-results-${{ matrix.platform }} | ||
path: results/ |
Oops, something went wrong.