diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..bc018d0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,40 @@ +name: Bug report +description: The extension gives a wrong result, an error or no result. +labels: [bug] +body: + - type: input + id: inkscape + attributes: + label: Inkscape version + description: Help > About Inkscape shows the version. + placeholder: 1.4.4 (dcaf3e7d9e) + validations: + required: true + - type: input + id: system + attributes: + label: Operating system + placeholder: Ubuntu 24.04, Windows 11, macOS 15 + validations: + required: true + - type: dropdown + id: mode + attributes: + label: Output mode + options: + - Clipped copies + - Merged outlines + validations: + required: true + - type: textarea + id: problem + attributes: + label: What happened + description: Tell what you expected and what you got. Copy the full text of an error message. + validations: + required: true + - type: textarea + id: file + attributes: + label: SVG file + description: Attach a small SVG file that shows the problem. Drag the file into this box. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..409219a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + # Updates the SHA pins and their version comments in the workflows. + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + target-branch: develop + commit-message: + prefix: ci(repo) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0f6d1d2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release + +# Makes a draft GitHub release with the extension zip for each version tag. +on: + push: + tags: ["v*"] + +permissions: {} + +jobs: + release: + runs-on: ubuntu-24.04 + permissions: + contents: write # Create the release and upload the zip + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 # The main check below needs the history + persist-credentials: false + - name: Check the tag against main and the version + run: | + git merge-base --is-ancestor "$GITHUB_SHA" origin/main || { echo "Tag $GITHUB_REF_NAME is not on main"; exit 1; } + version=$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])') + test "$GITHUB_REF_NAME" = "v$version" || { echo "Tag $GITHUB_REF_NAME does not match version $version"; exit 1; } + echo "VERSION=$version" >> "$GITHUB_ENV" + # Same files as the zip of v0.1.1: no top folder, so users extract it into the extensions folder. + - name: Make the zip + run: git archive --format=zip -o "flatternpattern-$VERSION.zip" HEAD LICENSE flatternpattern.inx ./*.py + - name: Write the release notes + run: | + # Release pages show each line break, so join the wrapped lines of a list item. + # Leading blank lines are skipped, so a section with no text gives an empty file. + awk -v v="## [$VERSION]" ' + index($0, v) == 1 {on = 1; next} + /^## \[|^\[.*\]: / {on = 0} + !on || (!n && /^$/) {next} + /^ +[^ ]/ && !/^ *([-*+]|[0-9]+\.) / && n {sub(/^ +/, ""); line[n] = line[n] " " $0; next} + {line[++n] = $0} + END {for (i = 1; i <= n; i++) print line[i]} + ' CHANGELOG.md > notes.md + test -s notes.md || { echo "CHANGELOG.md has no section for $VERSION"; exit 1; } + # Link to the README so the install steps stay in one place. + printf '\n### Install\n\nDownload `flatternpattern-%s.zip`, then follow the [install steps](%s/blob/%s/README.md#install).\n' \ + "$VERSION" "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" >> notes.md + # A draft lets the maintainer read the notes before the release is public. + - name: Create the draft release + env: + GH_TOKEN: ${{ github.token }} + run: gh release create "$GITHUB_REF_NAME" "flatternpattern-$VERSION.zip" --draft --title "$GITHUB_REF_NAME" --notes-file notes.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..af0750b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,28 @@ +# Contributing + +Thank you for your help. To report a problem, use the +[issue form](https://github.com/weiss-d/FlatternPattern/issues/new/choose). + +## Change the code + +1. Set up the tools and run the tests. The + [Development](README.md#development) section of the README gives the steps. +2. Make a branch from `develop`. +3. Add a test for each change in behavior. For a change in the output, also + add a small SVG file to `tests/data/flatten/`. The render tests compare + the input and the output of each file in this folder. +4. Open the pull request against `develop`, not `main`. + +CI runs the linters and all tests for each pull request. + +## Commit messages + +Use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) +format: `(): `. The pre-commit hook checks the +format. + +- Write the description in lowercase and in the imperative mood. +- Use one scope from this list: `inx`, `core`, `resolve`, `tiling`, + `clipped`, `merged`, `cleanup`, `tests`, `docs`, `repo`. + +Example: `fix(tiling): include stroke box in tile culling`. diff --git a/README.md b/README.md index 2826223..ef2a720 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,10 @@ each pull request. The test job uses Ubuntu 24.04 and Inkscape 1.4.4 from the Inkscape PPA. The developer also runs the tests before each push of a version change. +A second workflow runs all tests with the nightly build of Inkscape 1.5 from +the Inkscape trunk PPA. It runs for each push to `main`, each pull request +and each Monday. Its result does not block a merge. + The coverage badge at the top of this file shows the part of the statements in the extension code that the tests run. The value comes from the last CI run on `main`. @@ -291,6 +295,11 @@ another folder, set the `INKSCAPE_EXTENSIONS_DIR` environment variable. The render tests need the `inkscape` and `rsvg-convert` commands. If a command is not available, pytest skips the tests that need it. +To make a release, push a tag `vX.Y.Z` on a commit on `main`. The tag must +match the version in `pyproject.toml`, and `CHANGELOG.md` must have a section +for it. The release workflow then makes a draft release with the zip file. +Read the draft and publish it on GitHub. + `docs/spike-merged-mode.md` records the test of the Inkscape actions that the merged outlines mode uses.