diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index 75702bc2..00000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,44 +0,0 @@ -name-template: v$RESOLVED_VERSION -tag-template: v$RESOLVED_VERSION -template: | - ## Release Notes - - $CHANGES - - ## Contributors - - $CONTRIBUTORS - -change-template: "- $TITLE @$AUTHOR ([#$NUMBER](https://github.com/MatthewMckee4/karva/pull/$NUMBER))" - -categories: - - title: Bug Fixes - label: bug - - title: Reporting - label: reporting - - title: Extensions - labels: - - "extensions/fixtures" - - "extensions/tags" - - title: Discovery - label: discovery - - title: CLI - label: cli - - title: Documentation - label: documentation - -version-resolver: - default: patch - -exclude-contributors: - - dependabot - - dependabot[bot] - -include-labels: - - bug - - reporting - - extensions/fixtures - - extensions/tags - - discovery - - cli - - documentation diff --git a/.github/workflows/build.yml b/.github/workflows/build-wheels.yml similarity index 88% rename from .github/workflows/build.yml rename to .github/workflows/build-wheels.yml index d5f4dbf6..7f846777 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-wheels.yml @@ -1,12 +1,15 @@ -name: Build / Release PyPI +name: Build Wheels on: - push: - tags: - - v[0-9]*.[0-9]*.[0-9]* - workflow_call: + pull_request: + paths: + # When we change pyproject.toml, we want to ensure that the maturin builds still work. + - pyproject.toml + # And when we change this workflow itself... + - .github/workflows/build-wheels.yml + permissions: {} jobs: @@ -168,23 +171,3 @@ jobs: with: name: wheels-sdist path: dist - - release: - name: "release" - - runs-on: ubuntu-latest - - if: startsWith(github.ref, 'refs/tags/') - - needs: [linux, musllinux, windows, macos, sdist] - - steps: - - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - - - name: Publish to PyPI - uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4 - env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --non-interactive --skip-existing wheels-*/* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f54bfee7..5b51c215 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,14 +265,6 @@ jobs: run: cargo codspeed run --bench ${{ matrix.project }} mode: walltime - build-binaries: - name: "build binaries" - - needs: determine_changes - if: ${{ (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }} - - uses: ./.github/workflows/build.yml - project-diff: name: "run project diff" diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 51238353..00000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Release Drafter and Labels - -on: - push: - branches: - - main - - pull_request: - types: [edited, opened, reopened, synchronize, unlabeled, labeled] - -permissions: - contents: read - -jobs: - update_release_draft: - permissions: - contents: write - pull-requests: write - - runs-on: ubuntu-latest - - steps: - - uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - require_label: - if: github.event.pull_request - - needs: [update_release_draft] - - runs-on: ubuntu-latest - - permissions: - issues: write - pull-requests: write - - steps: - - name: Wait for labels to be added - # Don't shout at the PR author right away - run: sleep 20 - - - uses: mheap/github-action-required-labels@8afbe8ae6ab7647d0c9f0cfa7c2f939650d22509 # v5.5.1 - with: - mode: minimum - count: 1 - labels: ".+" - add_comment: true - use_regex: true - message: "Please add a label to this pull request." diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07cb86d9..68341037 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,46 +1,146 @@ name: Release on: - push: - tags: - - v[0-9]*.[0-9]*.[0-9]* + workflow_dispatch: + inputs: + tag: + description: "Tag to release (e.g., 1.0.0)" + required: true + default: dry-run + type: string env: PYTHON_VERSION: "3.14" +permissions: {} + jobs: - release_github: + generate-release: + name: Generate release metadata runs-on: ubuntu-latest + outputs: + release-metadata: ${{ steps.seal-generate.outputs.metadata }} + tag: ${{ github.event.inputs.tag }} + + steps: + - name: Checkout repository + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 + with: + persist-credentials: false + + - name: Install seal + run: | + curl --proto '=https' --tlsv1.2 -LsSf https://github.com/MatthewMckee4/seal/releases/download/0.0.1-alpha.5/seal-installer.sh | sh + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + + - name: Generate release metadata + id: seal-generate + run: | + METADATA=$(seal generate release) + { + echo "metadata<> "$GITHUB_OUTPUT" + echo "Release metadata:" + echo "$METADATA" - permissions: - contents: write + build-wheels: + name: Build wheels + needs: generate-release + if: github.event_name == 'workflow_dispatch' + uses: ./.github/workflows/build-wheels.yml + + create-release: + name: Create GitHub release + runs-on: ubuntu-latest + needs: [generate-release, build-wheels] + if: github.event_name == 'workflow_dispatch' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + - name: Checkout repository + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 with: persist-credentials: false - - name: Publish Latest Draft + - name: Download all wheels + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + pattern: wheels-*/* + + - name: Parse release metadata + id: parse-metadata + env: + METADATA: ${{ needs.generate-release.outputs.release-metadata }} run: | - if gh release list | grep Draft; then - old_version="$(gh release list | grep Draft | head -1 | cut -f1)" - new_version="${GITHUB_REF_NAME}" - body=$(gh release view "$old_version" --json body -q ".body" | sed "s/\.\.\.$old_version/...$new_version/g") - gh release delete "$old_version" - gh release create "$new_version" --title "${GITHUB_REF_NAME}" --notes "$body"; - else - gh release create "$new_version" --title "${GITHUB_REF_NAME}"; - fi + TITLE=$(echo "$METADATA" | jq -r '.title') + BODY=$(echo "$METADATA" | jq -r '.body') + PRERELEASE=$(echo "$METADATA" | jq -r '.prerelease') + + { + echo "title=$TITLE" + echo "prerelease=$PRERELEASE" + } >> "$GITHUB_OUTPUT" + + # Save body to file to handle multiline content + echo "$BODY" > "$RUNNER_TEMP/release-notes.txt" + + - name: Create git tag env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ needs.generate-release.outputs.tag }} + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag "$TAG" + git push origin "$TAG" - publish-docs: + - name: Create GitHub release + env: + TAG: ${{ needs.generate-release.outputs.tag }} + TITLE: ${{ steps.parse-metadata.outputs.title }} + PRERELEASE: ${{ steps.parse-metadata.outputs.prerelease }} + run: | + ARGS=( + "$TAG" + --title "$TITLE" + --notes-file "$RUNNER_TEMP/release-notes.txt" + ) + + if [ "$PRERELEASE" = "true" ]; then + ARGS+=(--prerelease) + fi + + ARGS+=(wheels-*/*) + + gh release create "${ARGS[@]}" + + publish-pypi: + name: Publish to PyPI runs-on: ubuntu-latest + needs: [generate-release, build-wheels, create-release] + if: github.event_name == 'workflow_dispatch' + + steps: + - name: Download all wheels + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + pattern: wheels-* - name: Docs builder and publisher + - name: Publish to PyPI + uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + with: + command: upload + args: --non-interactive --skip-existing wheels-*/* - permissions: - contents: write + publish-docs: + name: Publish documentation + runs-on: ubuntu-latest + needs: create-release + if: github.event_name == 'workflow_dispatch' steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..e69de29b diff --git a/Cargo.lock b/Cargo.lock index 5993726b..6f23b39a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1144,7 +1144,7 @@ dependencies = [ [[package]] name = "karva" -version = "0.1.11" +version = "0.0.0" dependencies = [ "karva_cli", "karva_core", @@ -1166,7 +1166,7 @@ dependencies = [ [[package]] name = "karva_cli" -version = "0.1.11" +version = "0.0.0" dependencies = [ "anyhow", "argfile", @@ -2725,7 +2725,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] diff --git a/README.md b/README.md index 92c8c5a1..4f6f9759 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Karva (0.1.11) +# Karva (0.0.0) [![codecov](https://codecov.io/gh/MatthewMckee4/karva/graph/badge.svg?token=VELHBTE1L9)](https://codecov.io/gh/MatthewMckee4/karva) ![PyPI - Version](https://img.shields.io/pypi/v/karva) @@ -6,11 +6,11 @@ > [!NOTE] > > Sadly, this will not be very well maintained and should not be used for anything important. -> I wanted to see if I could make a better `pytest`. But unless I completely diverge from the +> I wanted to see if I could make a better `pytest`. But unless I completely diverge from the > current architecture and basically start again, and try to make a better `pytest-xdist`, the > performance of this will not be much better than `pytest`, let alone `pytest-xdist`. > -> Thanks for taking an interest! Perhaps I will have a proper go at this in the future. +> Thanks for taking an interest! Perhaps I will have a proper go at this in the future. A Python test framework, written in Rust. diff --git a/crates/karva/Cargo.toml b/crates/karva/Cargo.toml index 6ddc87c3..c3ce3a43 100644 --- a/crates/karva/Cargo.toml +++ b/crates/karva/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "karva" -version = "0.1.11" +version = "0.0.0" edition = { workspace = true } rust-version = { workspace = true } diff --git a/crates/karva_cli/Cargo.toml b/crates/karva_cli/Cargo.toml index 67b2f78d..382bc846 100644 --- a/crates/karva_cli/Cargo.toml +++ b/crates/karva_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "karva_cli" -version = "0.1.11" +version = "0.0.0" default-run = "karva" edition = { workspace = true } diff --git a/crates/karva_core/src/collection/models.rs b/crates/karva_core/src/collection/models.rs index 5b8c8e8f..48b29957 100644 --- a/crates/karva_core/src/collection/models.rs +++ b/crates/karva_core/src/collection/models.rs @@ -65,7 +65,7 @@ impl CollectedModule { pub struct CollectedPackage { pub(crate) path: Utf8PathBuf, pub(crate) modules: HashMap, - pub(crate) packages: HashMap, + pub(crate) packages: HashMap, pub(crate) configuration_module_path: Option, } diff --git a/crates/karva_core/src/discovery/models/package.rs b/crates/karva_core/src/discovery/models/package.rs index 707c9e95..ce5cc900 100644 --- a/crates/karva_core/src/discovery/models/package.rs +++ b/crates/karva_core/src/discovery/models/package.rs @@ -9,7 +9,7 @@ use crate::{discovery::DiscoveredModule, name::ModulePath}; pub struct DiscoveredPackage { path: Utf8PathBuf, modules: HashMap, - packages: HashMap, + packages: HashMap, configuration_module_path: Option, } diff --git a/crates/karva_core/src/normalize/models/package.rs b/crates/karva_core/src/normalize/models/package.rs index ee5ceb01..2aa04e16 100644 --- a/crates/karva_core/src/normalize/models/package.rs +++ b/crates/karva_core/src/normalize/models/package.rs @@ -8,7 +8,7 @@ use crate::{extensions::fixtures::NormalizedFixture, normalize::models::Normaliz pub struct NormalizedPackage { pub(crate) modules: HashMap, - pub(crate) packages: HashMap, + pub(crate) packages: HashMap, pub(crate) auto_use_fixtures: Arc>, } diff --git a/crates/karva_projects/src/real_world_projects.rs b/crates/karva_projects/src/real_world_projects.rs index fe2b46cb..a4470dc8 100644 --- a/crates/karva_projects/src/real_world_projects.rs +++ b/crates/karva_projects/src/real_world_projects.rs @@ -409,7 +409,7 @@ pub static PYDANTIC_PROJECT: RealWorldProject<'static> = RealWorldProject { name: "pydantic", // Skip recursive test that fails crashes karva and pytest. repository: "https://github.com/MatthewMckee4/pydantic", - commit: "17fc29cd471dd728866a729f08e0b6557cb9340b", + commit: "95068e360c8921db3b342e368154fab925fa299e", paths: &["tests"], dependencies: &[ "pytest", diff --git a/pyproject.toml b/pyproject.toml index 165ff29c..ea325e80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = ["maturin>=1.7,<2.0"] [project] name = "karva" -version = "0.1.11" +version = "0.0.0" description = "A Python test framework, written in Rust." authors = [{ name = "Matthew McKee", email = "matthewmckee4@yahoo.co.uk" }] license = { file = "LICENSE" } @@ -127,7 +127,7 @@ message_template = "Bump to v{new_version}" tag_template = "v{new_version}" [tool.tbump.version] -current = "0.1.11" +current = "0.0.0" regex = ''' (?P\d+) \. diff --git a/python/karva/__init__.py b/python/karva/__init__.py index d0344196..1fc6b27c 100644 --- a/python/karva/__init__.py +++ b/python/karva/__init__.py @@ -13,7 +13,7 @@ tags, ) -__version__ = "0.1.11" +__version__ = "0.0.0" __all__: list[str] = [ "FailError", diff --git a/seal.toml b/seal.toml new file mode 100644 index 00000000..bb00c847 --- /dev/null +++ b/seal.toml @@ -0,0 +1,31 @@ +[release] +current-version = "0.0.0" + +version-files = [ + "README.md", + "crates/karva/Cargo.toml", + "crates/karva_python/Cargo.toml", + "pyproject.toml", + "python/karva/__init__.py", + { path = "dist-workspace.toml", field = "workspace.version", format = "toml" } +] + +commit-message = "Release v{version}" +branch-name = "release/v{version}" +push = true +confirm = true + +[changelog.section-labels] +"Bug Fixes" = ["bug"] +"Reporting" = ["reporting"] +"Extensions" = ["extensions/fixtures", "extensions/tags"] +"Configuration" = ["configuration"] +"Discovery" = ["discovery"] +"CLI" = ["cli"] +"Documentation" = ["documentation"] + +[changelog] +ignore-contributors = ["dependabot[bot]"] +ignore-labels = ["internal", "ci", "duplicate", "rust", "wontfix", "needs-decision"] +include-contributors = true +changelog-heading = "{version}"