Skip to content

Commit

Permalink
Merge pull request #23 from pollenjp/release/v1.1.0
Browse files Browse the repository at this point in the history
release v1.1.0
  • Loading branch information
pollenjp authored Aug 31, 2024
2 parents b29f372 + b6681a0 commit ea2000d
Show file tree
Hide file tree
Showing 11 changed files with 1,248 additions and 58 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/lint-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Lint Python
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
UV_VERSION: 0.4.1
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- name: Instal uv
run: |
set -eux -o pipefail -o posix
curl -LsSf https://astral.sh/uv/${{ env.UV_VERSION }}/install.sh | sh
echo PATH="${HOME}/.cargo/bin:${PATH}" >> "${GITHUB_ENV}"
- uses: actions/checkout@v4
- name: Install dependencies
run: uv sync --frozen
- name: Run ruff check
run: uv run ruff check

pyright:
runs-on: ubuntu-latest
steps:
- name: Instal uv
run: |
set -eux -o pipefail -o posix
curl -LsSf https://astral.sh/uv/${{ env.UV_VERSION }}/install.sh | sh
echo PATH="${HOME}/.cargo/bin:${PATH}" >> "${GITHUB_ENV}"
- uses: actions/checkout@v4
- name: Install dependencies
run: uv sync --frozen
- name: Run pyright
run: uv run pyright ./src
19 changes: 10 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
push:
branches:
- main

permissions:
contents: read

env:
UV_VERSION: 0.4.1
jobs:
update_release:
permissions:
Expand Down Expand Up @@ -43,14 +43,15 @@ jobs:
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rye and build package
- name: Instal uv
run: |
set -eux -o pipefail
curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
source "${HOME}/.rye/env"
make build
- name: upload windows dists
set -eux -o pipefail -o posix
curl -LsSf https://astral.sh/uv/${{ env.UV_VERSION }}/install.sh | sh
echo PATH="${HOME}/.cargo/bin:${PATH}" >> "${GITHUB_ENV}"
- uses: actions/checkout@v4
- name: Build
run: uvx --from build pyproject-build --installer uv
- name: upload dists
uses: actions/upload-artifact@v3
with:
name: release-dists
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/release_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ on:
- main-pre
permissions:
contents: read
env:
UV_VERSION: 0.4.1
jobs:
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-pypi
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rye and build package
- name: Instal uv
run: |
set -eux -o pipefail
curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
source "${HOME}/.rye/env"
make build
- name: upload windows dists
set -eux -o pipefail -o posix
curl -LsSf https://astral.sh/uv/${{ env.UV_VERSION }}/install.sh | sh
echo PATH="${HOME}/.cargo/bin:${PATH}" >> "${GITHUB_ENV}"
- uses: actions/checkout@v4
- name: Build
run: uvx --from build pyproject-build --installer uv
- name: upload dists
uses: actions/upload-artifact@v3
with:
name: release-dists
Expand Down
27 changes: 5 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@

.PHONY: lint
lint:
rye run ruff check
rye run pyright
uv run ruff check
uv run pyright

.PHONY: fmt
fmt:
rye run ruff format

.PHONY: test
test:
rye run nox -s test

.PHONY: nox
nox:
rye run nox
uv run ruff format

.PHONY: build
build:
${MAKE} clean
rye build
uvx --from build pyproject-build --installer uv

.PHONY: clean
clean:
rm -rf dist *.egg-info

publish-test:
${MAKE} build
rye publish --verbose --repository testpypi --repository-url https://test.pypi.org/legacy/


publish-prod:
${MAKE} build
rye publish
rm -rf build dist *.egg-info
10 changes: 6 additions & 4 deletions examples/sample1/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

.PHONY: lint
lint:
rye run ansible-lint -vvv
.PHONY: debug
debug:
${MAKE} install
# uv run ansible-lint -vvv
uv run ansible-lint

.PHONY: install
install:
rm -rf .venv
rye sync
uv sync
12 changes: 3 additions & 9 deletions examples/sample1/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ dependencies = [
"ansible-lint-custom-strict-naming @ file:///${PROJECT_ROOT}/../..",
]
readme = "README.md"
requires-python = ">= 3.11"
requires-python = ">= 3.12"

[build-system]
# use pdm for relative path dependencies
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[tool.rye]
managed = true
dev-dependencies = []

# [[tool.rye.sources]]
# name = "testpypi"
# url = "https://test.pypi.org/simple/"
# type = "index"
[tool.uv]
environments = ["platform_system != 'Windows'"]
526 changes: 526 additions & 0 deletions examples/sample1/uv.lock

Large diffs are not rendered by default.

36 changes: 29 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
[project]
name = "ansible-lint-custom-strict-naming"
version = "1.0.1"
version = "1.1.0"
description = "Add your description here"
authors = [{ name = "pollenjp", email = "polleninjp@gmail.com" }]
dependencies = ["ansible-lint>=6.21.1"]
dependencies = ["ansible-lint>=6.24.0; sys_platform != 'Windows'"]
readme = "README.md"
requires-python = ">= 3.11"
requires-python = ">= 3.12"
classifiers = [
"Development Status :: 1 - Planning",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.urls]
Expand All @@ -27,14 +28,15 @@ packages = [
"ansiblelint.rules.custom.ansible_lint_custom_strict_naming",
]

[tool.uv]
# https://github.com/astral-sh/uv/issues/6127#issuecomment-2298975659
environments = ["platform_system != 'Windows'"]
dev-dependencies = ["pyright>=1.1.378", "ruff>=0.6.3"]

[tool.setuptools.package-dir]
"ansible_lint_custom_strict_naming" = "src/ansible_lint_custom_strict_naming"
"ansiblelint.rules.custom.ansible_lint_custom_strict_naming" = "src/rules"

[tool.rye]
managed = true
dev-dependencies = ["ruff>=0.6.2", "pyright>=1.1.377"]

[tool.hatch.metadata]
allow-direct-references = true

Expand Down Expand Up @@ -87,3 +89,23 @@ ban-relative-imports = "all"
[tool.ruff.lint.isort]
known-first-party = ["pollenjp_infra_ansible"]
force-single-line = true

[tool.pyright]
pythonVersion = "3.12"
typeCheckingMode = "strict"
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#diagnostic-settings-defaults
# 明示的にオフ
reportMissingTypeStubs = true
reportUnknownMemberType = "error"
reportUntypedFunctionDecorator = "error"
deprecateTypingAliases = true
reportCallInDefaultInitializer = "error"
reportImplicitOverride = "error"
reportImplicitStringConcatenation = "error"
reportImportCycles = "error"
reportMissingSuperCall = "error"
reportPropertyTypeMismatch = "error"
reportShadowedImports = "error"
reportUninitializedInstanceVariable = "error"
reportUnnecessaryTypeIgnoreComment = "error"
reportUnusedCallResult = "error"
1 change: 1 addition & 0 deletions src/rules/register_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class RegisterPrefix(AnsibleLintRule):
description = DESCRIPTION
tags: t.ClassVar[list[str]] = ["formatting"] # pyright: ignore[reportIncompatibleVariableOverride]

@t.override
def matchtask(self, task: Task, file: Lintable | None = None) -> bool | str:
if (task_result := task.get("register")) is None:
return False
Expand Down
1 change: 1 addition & 0 deletions src/rules/var_name_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class VarNamePrefix(AnsibleLintRule):
description = DESCRIPTION
tags: t.ClassVar[list[str]] = ["formatting"] # pyright: ignore[reportIncompatibleVariableOverride]

@t.override
def matchtask(self, task: Task, file: Lintable | None = None) -> UnmatchedType:
match task.action:
case "ansible.builtin.set_fact":
Expand Down
Loading

0 comments on commit ea2000d

Please sign in to comment.