Skip to content

Commit

Permalink
chore: merge remote-tracking branch 'starbase/work/use-uv' into work/…
Browse files Browse the repository at this point in the history
…use-uv
  • Loading branch information
lengau committed Sep 19, 2024
2 parents 1fd63d4 + cbba4d7 commit c3db1eb
Show file tree
Hide file tree
Showing 21 changed files with 2,960 additions and 210 deletions.
7 changes: 1 addition & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 80
max_line_length = 88
trim_trailing_whitespace = true

[.editorconfig]
Expand All @@ -29,15 +29,10 @@ 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
15 changes: 6 additions & 9 deletions .github/.jira_sync_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ settings:
components:
- Craft Archives
labels:
- Bug
- Enhancement
- Spike
- Epic
- Triaged
# Adds a comment with the JIRA ID
add_gh_comment: true
# Reflect changes on JIRA
Expand All @@ -16,10 +13,10 @@ settings:
# epic_key: "MTC-296"
jira_project_key: "CRAFT"
status_mapping:
opened: Untriaged
opened: Triaged
closed: done
label_mapping:
Enhancement: Story
Bug: Bug
Spike: Spike
Epic: Epic
enhancement: Story
bug: Bug
spike: Spike
epic: Epic
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- [ ] Have you followed the guidelines for contributing?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `tox`?
- [ ] Have you successfully run `make lint && make test`?

-----
22 changes: 9 additions & 13 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
// Configuration file for RenovateBot: https://docs.renovatebot.com/configuration-options
extends: ["config:recommended", ":semanticCommitTypeAll(build)"],
extends: ["config:recommended", ":semanticCommitTypeAll(build)", ":enablePreCommit"],
labels: ["dependencies"], // For convenient searching in GitHub
baseBranches: ["$default", "/^hotfix\\/.*/"],
pip_requirements: {
Expand Down Expand Up @@ -32,7 +32,11 @@
// Automerge patches, pin changes and digest changes.
// Also groups these changes together.
groupName: "bugfixes",
excludeDepPatterns: ["lint/.*", "types/.*"],
excludeDepPatterns: [
"lint/.*",
"types/.*",
"pyright", // Pyright needs to be done separately.
],
matchUpdateTypes: ["patch", "pin", "digest"],
prPriority: 3, // Patches should go first!
automerge: true
Expand All @@ -57,6 +61,7 @@
//Do all pydantic-related updates together
groupName: "pydantic etc.",
matchPackagePatterns: ["^pydantic"],
matchBaseBranches: ["$default"], // Only do minor releases on main
},
{
// Minor changes can be grouped and automerged for dev dependencies, but are also deprioritised.
Expand Down Expand Up @@ -91,7 +96,8 @@
],
matchUpdateTypes: ["minor", "patch", "pin", "digest"],
prPriority: -1,
automerge: true
automerge: true,
matchBaseBranches: ["$default"], // Not for hotfix branches
},
{
// Documentation related updates
Expand Down Expand Up @@ -135,16 +141,6 @@
"# renovate: datasource=(?<datasource>\\S+)\n\\s+(?<depName>.*?)(\\[[\\w]*\\])*[=><]=?(?<currentValue>.*?)\n"
]
},
{
// .pre-commit-config.yaml version updates
fileMatch: [".pre-commit-config.yaml"],
customType: "regex",
datasourceTemplate: "pypi",
depTypeTemplate: "lint",
matchStrings: [
"- repo: .*/<(?<depName>\\S+)\\s*\\n\\s*rev:\s+\"?v?(?<currentValue>\\S*)\"?",
]
}
],
timezone: "Etc/UTC",
schedule: ["every weekend"],
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@ jobs:
sphinx:
runs-on: ubuntu-latest
steps:
- name: Start UV install
run: |
sudo snap install --classic astral-uv --no-wait
- name: Checkout
uses: actions/checkout@v4
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: Finish UV install
run: |
sudo snap watch --last=install
- name: Lint docs
run: |
make lint-docs
- name: Build docs
run: |
make docs
- name: Upload documentation
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build/
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Release Drafter
uses: release-drafter/release-drafter@v5.25.0
uses: release-drafter/release-drafter@v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144 changes: 104 additions & 40 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,78 +1,142 @@
name: Tests, linting, etc.
name: test
on:
push:
branches:
- "main"
- "feature/*"
- "hotfix/*"
- "release/*"
- "renovate/*"
pull_request:

jobs:
linters:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Configure environment
- name: Install tools
run: |
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::"
make setup
- name: Run Linters
run: tox run -m lint
tests:
run: |
make -k lint
- name: conventional commits
uses: webiny/[email protected]
with:
allowed-commit-types: "build,chore,ci,docs,feat,fix,perf,refactor,style,test"
unit:
strategy:
matrix:
platform: [ubuntu-20.04, ubuntu-22.04]
platform: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-latest, macos-latest]
resolution: [highest]
include:
- platform: ubuntu-latest
resolution: lowest
runs-on: ${{ matrix.platform }}
env:
UV_CACHE_DIR: ${{ github.workspace }}/.cache/uv
steps:
- uses: actions/cache@v4
id: cache-uv
with:
path: ${{ env.UV_CACHE_DIR }}
key: ${{ matrix.platform }}-uv-${{ matrix.resolution }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python versions on ${{ matrix.platform }}
uses: actions/setup-python@v4
- name: Install tools
shell: bash
run: |
make setup
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12
3.13-dev
- name: Configure environment
- name: Configure venv and test
shell: bash
run: |
for python_version in 3.10 3.11 3.12 3.13; do
echo "::group::Python $python_version (install)"
uv sync --python=$python_version --reinstall --resolution=${{ matrix.resolution }}
echo "::endgroup::"
echo "::group::Python $python_version (test)"
make test-unit
echo "::endgroup::"
done
env:
PYTEST_ADDOPTS: "--no-header -vv -rN"
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
name: coverage-unit-${{ matrix.python-version }}-${{ matrix.platform }}
files: .coverage*.xml
- name: Upload test results
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: results-unit-${{ matrix.python-version }}-${{ matrix.platform }}-${{ matrix.resolution }}
path: |
./.results.*.xml
./.coverage.*.xml
integration:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
resolution: [highest]
include:
- platform: ubuntu-latest
resolution: lowest
runs-on: ${{ matrix.platform }}
env:
UV_CACHE_DIR: ${{ github.workspace }}/.cache/uv
steps:
- uses: actions/cache@v4
id: cache-uv
with:
path: ${{ env.UV_CACHE_DIR }}
key: ${{ matrix.platform }}-uv-${{ matrix.resolution }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install tools
shell: bash
run: |
echo "::group::pip install"
python -m pip install 'tox>=4' tox-gh
make setup
- name: Set up Python
if: ${{ runner.os != 'Linux' }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Configure venv and test
shell: bash
run: |
echo "::group::Sync"
uv sync --reinstall --resolution=${{ matrix.resolution }}
echo "::endgroup::"
echo "::group::Test"
make test-integration
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
env:
PYTEST_ADDOPTS: "--no-header -vv -rN"
- name: Upload code coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
directory: ./results/
files: coverage*.xml
name: coverage-integration-${{ matrix.python-version }}-${{ matrix.platform }}
files: .coverage*.xml
- name: Upload test results
if: success() || failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.platform }}
path: results/
name: results-integration-${{ matrix.python-version }}-${{ matrix.platform }}-${{ matrix.resolution }}
path: |
./.results.*.xml
./.coverage.*.xml
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
.results.*.xml

# Translations
*.mo
Expand Down Expand Up @@ -138,4 +139,7 @@ dmypy.json
.envrc

# Ignore version module generated by setuptools_scm
craft_archives/_version.py
/*/_version.py

# Visual Studio Code
.vscode/
13 changes: 5 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: "v4.6.0"
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -12,19 +12,16 @@ repos:
- id: check-toml
- id: fix-byte-order-marker
- id: mixed-line-ending
- repo: https://github.com/charliermarsh/ruff-pre-commit
# renovate: datasource=pypi;depName=ruff
rev: "v0.0.267"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.5"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
# renovate: datasource=pypi;depName=black
rev: "23.3.0"
rev: "24.8.0"
hooks:
- id: black
- repo: https://github.com/adrienverge/yamllint.git
# renovate: datasource=pypi;depName=yamllint
rev: "v1.31.0"
rev: "v1.35.1"
hooks:
- id: yamllint
Loading

0 comments on commit c3db1eb

Please sign in to comment.