-
Notifications
You must be signed in to change notification settings - Fork 5
feat: replace poetry with uv #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
|
|
||
| [tool.commitizen] | ||
| version_files = ["pyproject.toml:version"] | ||
| version = "2.8.28" | ||
| tag_format = "v$version" | ||
| name = "cz_customize" | ||
|
|
||
| [tool.commitizen.customize] | ||
| message_template = "{{prefix}}{% if scope %}({{scope}}){% endif %}: {{subject}}{% if body %}\n\n{{body}}{% endif %}{% if is_breaking_change %}\n\nBREAKING CHANGE: {{footer}}{% else %}\n\n{{footer}}{% endif %}" | ||
|
|
||
| bump_pattern = "^(BREAKING[\\-\\ ]CHANGE|feat|fix|refactor|perf|ci|docs|style|test|chore|revert|build)(\\(.+\\))?(!)?" | ||
| change_type_order = [ | ||
| "BREAKING CHANGE", | ||
| "Feat", | ||
| "Fix", | ||
| "Refactor", | ||
| "Perf", | ||
| "CI", | ||
| "Docs", | ||
| "Technical", | ||
| "Tests", | ||
| ] | ||
| bump_message = "bump: version $current_version → $new_version" | ||
| schema = "<type>(<scope>): <subject>\n<BLANK LINE>\n<body>\n<BLANK LINE>\n(BREAKING CHANGE: )<footer>" | ||
| schema_pattern = "(?s)(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\\(\\S+\\))?!?:( [^\\n\\r]+)((\\n\\n.*)|(\\s*))?$" | ||
| commit_parser = "^(?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE|ci|docs|style|test|chore|revert|build)(?:\\((?P<scope>[^()\\r\\n]*)\\)|\\()?(?P<breaking>!)?:\\s(?P<message>.*)?" | ||
| version_parser = "(?P<version>([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?(\\w+)?)" | ||
| changelog_pattern = "^(BREAKING[\\-\\ ]CHANGE|feat|fix|refactor|perf|ci|docs|style|test|chore|revert|build)(\\(.+\\))?(!)?" # same as bump_pattern | ||
| [tool.commitizen.customize.bump_map] | ||
| "^.+!$" = "MAJOR" | ||
| "^BREAKING[\\-\\ ]CHANGE" = "MAJOR" | ||
| "^feat" = "MINOR" | ||
| "^fix" = "PATCH" | ||
| "^refactor" = "PATCH" | ||
| "^perf" = "PATCH" | ||
| "^ci" = "PATCH" | ||
| "^docs" = "PATCH" | ||
| "^style" = "PATCH" | ||
| "^test" = "PATCH" | ||
| "^chore" = "PATCH" | ||
| "^revert" = "PATCH" | ||
| "^build" = "PATCH" | ||
|
|
||
| [tool.commitizen.customize.change_type_map] | ||
| "feat" = "Feat" | ||
| "fix" = "Fix" | ||
| "refactor" = "Refactor" | ||
| "perf" = "Perf" | ||
| "ci" = "CI" | ||
| "docs" = "Docs" | ||
| "style" = "Technical" | ||
| "test" = "Tests" | ||
| "chore" = "Technical" | ||
| "revert" = "Fix" | ||
| "build" = "Technical" | ||
|
|
||
| [[tool.commitizen.customize.questions]] | ||
| type = "list" | ||
| name = "prefix" | ||
| message = "Select the type of change you are committing" | ||
| choices = [ | ||
| { value = "fix", name = "fix: A bug fix. Correlates with PATCH in SemVer", key = "x" }, | ||
| { value = "feat", name = "feat: A new feature. Correlates with MINOR in SemVer", key = "f" }, | ||
| { value = "docs", name = "docs: Documentation only changes", key = "d" }, | ||
| { value = "style", name = "style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)", key = "s" }, | ||
| { value = "refactor", name = "refactor: A code change that neither fixes a bug nor adds a feature", key = "r" }, | ||
| { value = "perf", name = "perf: A code change that improves performance", key = "p" }, | ||
| { value = "test", name = "test: Adding missing or correcting existing tests", key = "t" }, | ||
| { value = "build", name = "build: Changes that affect the build system or external dependencies (example scopes: pip, docker, npm)", key = "b" }, | ||
| { value = "ci", name = "ci: Changes to our CI configuration files and scripts (example scopes: GitLabCI)", key = "c" }, | ||
| ] | ||
|
|
||
| [[tool.commitizen.customize.questions]] | ||
| type = "input" | ||
| name = "scope" | ||
| message = "What is the scope of this change? ((story number, class or file name): (press [enter] to skip)\n" | ||
|
|
||
| [[tool.commitizen.customize.questions]] | ||
| type = "input" | ||
| name = "subject" | ||
| message = "Write a short and imperative summary of the code changes: (lower case and no period)\n" | ||
|
|
||
| [[tool.commitizen.customize.questions]] | ||
| type = "input" | ||
| name = "body" | ||
| message = "Provide additional contextual information about the code changes: (press [enter] to skip)\n" | ||
|
|
||
| [[tool.commitizen.customize.questions]] | ||
| type = "confirm" | ||
| message = "Is this a BREAKING CHANGE? Correlates with MAJOR in SemVer" | ||
| name = "is_breaking_change" | ||
| default = false | ||
|
|
||
| [[tool.commitizen.customize.questions]] | ||
| type = "input" | ||
| name = "footer" | ||
| message = "Footer. Information about Breaking Changes and reference issues that this commit closes: (press [enter] to skip)\n" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ jobs: | |
| steps: | ||
| - name: Dependabot metadata | ||
| id: metadata | ||
| uses: dependabot/[email protected] | ||
| uses: dependabot/fetch-metadata@a3e5f86ae9f2f49b441498973ddec20035d326b8 # v1.1.1 | ||
| with: | ||
| github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
| - name: Enable auto-merge for Dependabot PRs | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # This workflow builds the package, installs it, and tests basic functionality | ||
|
|
||
| name: Build and Test Package | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| branches: ["main"] | ||
|
|
||
| jobs: | ||
| test-build-package: | ||
| name: Test package build | ||
| runs-on: ubuntu-latest | ||
| if: "!startsWith(github.event.head_commit.message, 'bump:')" | ||
|
|
||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f # v6.4.1 | ||
|
|
||
| - name: Build the package | ||
| run: uv build | ||
|
|
||
| - name: List built artifacts | ||
| run: ls -la dist/ | ||
|
|
||
| - name: Install the built wheel | ||
| run: | | ||
| uv venv | ||
| # Find the wheel file and install it | ||
| WHEEL_FILE=$(ls dist/*.whl | head -1) | ||
| echo "Installing wheel: $WHEEL_FILE" | ||
| uv pip install "$WHEEL_FILE" | ||
|
|
||
| - name: Test --version flag | ||
| run: | | ||
| # Test that the CLI is available and --version works | ||
| uv run twyn --version | ||
|
|
||
| should-test-docker-build: | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always testing if the docker image can be built would result in very slow builds. Instead, we only try to build it if there were any changes in the Dockerfile or .dockerignore files (the latter does not exist yet, but it's more future proof this way). |
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| name: Check if should `test_docker_build` run | ||
| runs-on: ubuntu-latest | ||
| if: "!startsWith(github.event.head_commit.message, 'bump:')" | ||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Check if Dockerfile changed | ||
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | ||
| id: dockerfile-changes | ||
| with: | ||
| filters: | | ||
| dockerfile: | ||
| - 'Dockerfile' | ||
| - '.dockerignore' | ||
| outputs: | ||
| docker: ${{ steps.dockerfile-changes.outputs.dockerfile }} | ||
|
|
||
| test-docker-build: | ||
| needs: [should-test-docker-build] | ||
| name: Test Docker build | ||
| runs-on: ubuntu-latest | ||
| if: needs.should-test-docker-build.outputs.docker == 'true' && !startsWith(github.event.head_commit.message, 'bump:') | ||
| permissions: | ||
| contents: read | ||
| packages: read | ||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | ||
|
|
||
| - name: Extract metadata (tags, labels) for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0 | ||
| with: | ||
| images: elementsinteractive/twyn | ||
|
|
||
| - name: Build Docker image | ||
| uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| push: false | ||
| platforms: linux/amd64,linux/arm64 | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=registry,ref=ghcr.io/elementsinteractive/twyn:buildcache | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll try to use cache in case it exists. This cache is ONLY created when publishing the package. We should never override this cache from a PR. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| on: | ||
| pull_request_target: | ||
| types: [ opened, edited ] | ||
| types: [opened, edited] | ||
| name: conventional-release-labels | ||
| jobs: | ||
| label: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: bcoe/conventional-release-labels@v1 | ||
| - uses: bcoe/conventional-release-labels@886f696738527c7be444262c327c89436dfb95a8 #v1.3.1 | ||
| with: | ||
| type_labels: '{"feat": "feature", "fix": "fix", "breaking": "breaking", "ci": "CI"}' | ||
| type_labels: '{"feat": "feature", "fix": "fix", "BREAKING CHANGE": "breaking", "ci": "CI", "build": "build", "refactor": "refactor", "test": "test"}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved
commitizenlogic to this fileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does cz.toml require a
[tool.commitizen]section? isn't that apyproject.tomlthing? I would expect options here to beflat.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd make sense yeah. Based on the docs it is expected this way though.