From c98d60b464aba5d46a622f2f32497004d3c85bd0 Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Thu, 19 Dec 2024 22:56:33 +0100 Subject: [PATCH 01/14] wip --- .github/workflows/release.yml | 46 +++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 4 ++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..914e2d4b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Release a new version of Akkurate +on: push +# workflow_dispatch: +# inputs: +# version: +# description: 'The version number to use' +# required: true +# type: string + +jobs: + create-release-pr: + name: Create a pull request for the release + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Install chan CLI + run: npm install -g @geut/chan + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Write a new release to CHANGELOG.md + env: + RELEASE_VERSION: 0.99.0 + run: chan release $RELEASE_VERSION --release-prefix="" + + - name: Update Akkurate's version in build files + env: + RELEASE_VERSION: 0.99.0 + run: | + sed -ri 's|version *= *".*|version = "'$RELEASE_VERSION'"|g' ./buildSrc/src/main/kotlin/akkurate.base-conventions.gradle.kts; + sed -ri 's|CONFIG_JSON_VERSION *:.*|CONFIG_JSON_VERSION: '$RELEASE_VERSION'|g' ./.github/workflows/deploy-website.yml; + sed -ri 's||g' ./documentation/v.list; + sed -ri 's||g' ./documentation/writerside.cfg; + + - run: git diff +# - name: Commit and push +# uses: stefanzweifel/git-auto-commit-action@v5 +# with: +# commit_message: release ${{ inputs.version }} +# branch: release/${{ inputs.version }} +# create_branch: true +# commit_author: Johann Pardanaud +# tagging_message: ${{ inputs.version }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed8566e4..732085cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,9 @@ standard library; however, we still recommend you to create an issue just to be ## Code style -Before submitting your changes, make sure you've applied code formatting and removed unused imports. +Before submitting your changes, make sure you've applied code +formatting [using IntelliJ](https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html), and you've optimized +imports. ## Testing From 737a8dba11ee698dd603deb94a3fe91ff466f3ab Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Fri, 20 Dec 2024 21:34:01 +0100 Subject: [PATCH 02/14] wip update changelog --- CHANGELOG.md | 97 +++++++++++----------------------------------------- 1 file changed, 20 insertions(+), 77 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 053c6433..5e8a7aa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,156 +1,99 @@ - # Changelog - All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - ## [0.11.0] - 2024-12-09 - ### Added - -- Ktor integration to automatically validate received payloads. ([#43](https://github.com/nesk/akkurate/issues/43)) +- Ktor integration to automatically validate received payloads. ([#43](https://github.com/nesk/akkurate/issues/43)) - Public constructors for `ConstraintViolationSet` and `ConstraintViolation`. ## [0.10.0] - 2024-09-24 - ### Added - - [kotlinx-datetime](https://github.com/Kotlin/kotlinx-datetime) integration to validate multiplatform date and time. ([#42](https://github.com/nesk/akkurate/issues/42)) - New `akkurate-test` artifact to test custom constraints. - New constraints to validate types of the [kotlin.time](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/) package. ### Fixed - - Add a `or equal to zero` suffix to the default message for `isNegativeOrZero` and `isPositiveOrZero` constraints. ## [0.9.1] - 2024-09-12 - ### Fixed - - Fix name clashes when generating validatable accessors from the common code. ## [0.9.0] - 2024-08-30 - -### ⚠️ Breaking changes - -- [The `ConstraintViolationSet.equals` method](https://akkurate.dev/api/akkurate-core/dev.nesk.akkurate.constraints/-constraint-violation-set/equals.html) is now symmetric and matches [what's in the specification.](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/equals.html) - ### Added - - Support Kotlin Multiplatform and all its targets ([#33](https://github.com/nesk/akkurate/issues/33)) ### Changed +- **⚠️ BREAKING ⚠️** [The `ConstraintViolationSet.equals` method](https://akkurate.dev/api/akkurate-core/dev.nesk.akkurate.constraints/-constraint-violation-set/equals.html) is now symmetric and matches [what's in the specification.](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/equals.html) +- The default violation message of the [`isInstanceOf`](https://akkurate.dev/api/akkurate-core/dev.nesk.akkurate.constraints.builders/is-instance-of.html) and [`isNotInstanceOf`](https://akkurate.dev/api/akkurate-core/dev.nesk.akkurate.constraints.builders/is-not-instance-of.html) constraints now display the simple name of the type, instead of the qualified one. +- [The `Validate` annotation](https://akkurate.dev/api/akkurate-core/dev.nesk.akkurate.annotations/-validate/index.html) has been moved from the `akkurate-ksp-plugin` artifact to the `akkurate-core` one. -- The default violation message of the [`isInstanceOf`](https://akkurate.dev/api/akkurate-core/dev.nesk.akkurate.constraints.builders/is-instance-of.html) and [`isNotInstanceOf`](https://akkurate.dev/api/akkurate-core/dev.nesk.akkurate.constraints.builders/is-not-instance-of.html) constraints now display the simple name of the type, instead of the qualified one. -- [The `Validate` annotation](https://akkurate.dev/api/akkurate-core/dev.nesk.akkurate.annotations/-validate/index.html) has been moved from the `akkurate-ksp-plugin` artifact to the `akkurate-core` one. - -## [0.8.0] - +## [0.8.0] - 2024-05-24 ### Added - - Support transforming a value before validating it ([#26](https://github.com/nesk/akkurate/issues/26)) - New constraint to ensure a collection doesn't contain duplicated elements ([#28](https://github.com/nesk/akkurate/issues/28)) - New constraints to check if a value is an instance of some type ([#27](https://github.com/nesk/akkurate/issues/27)) - New accessors to easily validate a specific index of a collection ([#29](https://github.com/nesk/akkurate/issues/29)) -## [0.7.0] - -### ⚠️ Breaking changes - +## [0.7.0] - 2024-02-09 +### Changed - [Scope control](https://kotlinlang.org/docs/type-safe-builders.html#scope-control-dslmarker) has been implemented for Akkurate's DSL ([#25](https://github.com/nesk/akkurate/issues/25)) ### Fixed - - Accessors for mutable properties are no longer improperly cast. ([#22](https://github.com/nesk/akkurate/issues/22)) ## [0.6.0] - 2023-12-12 - ### Added - -- Arrow integration to convert Akkurate validation results to typed errors ([#20](https://github.com/nesk/akkurate/issues/20)) +- Arrow integration to convert Akkurate validation results to typed errors ([#20](https://github.com/nesk/akkurate/issues/20)) ## [0.5.0] - 2023-11-28 - ### Added - - New configuration option to fail on the first constraint violation ([#19](https://github.com/nesk/akkurate/issues/19)) ## [0.4.0] - 2023-10-30 - -### ⚠️ Breaking changes - -- The `Configuration` class is now instantiated through a builder DSL ([#13](https://github.com/nesk/akkurate/issues/13)) -- Mark the API of the KSP plugin as experimental ([#13](https://github.com/nesk/akkurate/issues/13)) -- Remove unused `MutablePath` type alias - ### Added - - Support iterating over nullable iterables, like `Validatable?>`. ([#16](https://github.com/nesk/akkurate/issues/16)) - Add constraints to validate additional JVM types: `LocalDate`, `Duration` and `Period` ([#7](https://github.com/nesk/akkurate/issues/7)) -## [0.3.0] - 2023-10-16 - -### ⚠️ Breaking changes - -- Validation accessors are generated only for public properties. ([#11](https://github.com/nesk/akkurate/issues/11) [#15](https://github.com/nesk/akkurate/issues/15)) -- Accessors are now generated for the properties of the implemented interface when possible, not for the implementation. ([#11](https://github.com/nesk/akkurate/issues/11)) +### Changed +- **⚠️ BREAKING ⚠️** The `Configuration` class is now instantiated through a builder DSL ([#13](https://github.com/nesk/akkurate/issues/13)) +- **⚠️ BREAKING ⚠️** Mark the API of the KSP plugin as experimental ([#13](https://github.com/nesk/akkurate/issues/13)) +- **⚠️ BREAKING ⚠️** Remove unused `MutablePath` type alias +## [0.3.0] - 2023-10-16 ### Added - - Provide built-in accessors for `kotlin` and `kotlin.collections` packages ([#11](https://github.com/nesk/akkurate/issues/11)) - Support generating accessors for generic types ([#10](https://github.com/nesk/akkurate/issues/10)) - A KDoc is provided for each validatable accessor ([#6](https://github.com/nesk/akkurate/issues/6)) ### Fixed - -- Validatable accessors are no longer generated for extension properties +- Validatable accessors are no longer generated for extension properties - Skip the generation of accessors in the `kotlin` package, avoiding compilation failures. ### Changed - +- **⚠️ BREAKING ⚠️** Validation accessors are generated only for public properties. ([#11](https://github.com/nesk/akkurate/issues/11) [#15](https://github.com/nesk/akkurate/issues/15)) +- **⚠️ BREAKING ⚠️** Accessors are now generated for the properties of the implemented interface when possible, not for the implementation. ([#11](https://github.com/nesk/akkurate/issues/11)) - Propagate the `@Validate` annotation to the nested classes ([#11](https://github.com/nesk/akkurate/issues/11)) ## [0.2.0] - 2023-09-26 - -### ⚠️ Breaking changes - -- Change visibility of `ValidateAnnotationProcessor.validatableOfFunction` to private. ([#12](https://github.com/nesk/akkurate/issues/12)) -- Change visibility of `ValidateAnnotationProcessor.validatableClass` to private. ([#12](https://github.com/nesk/akkurate/issues/12)) - ### Added - -- Add new constraints ([#3](https://github.com/nesk/akkurate/issues/3)): - - `CharSequence` - - `hasLengthEqualTo` / `hasLengthNotEqualTo` - - `isBlank` / `isNotBlank` - - `isMatching` / `isNotMatching` - - `kotlin.collections` - - `hasSizeNotEqualTo` - - `isEmpty` / `isNotEmpty` - - `isContaining` / `isNotContaining` - - `Map` - - `isContainingKey` / `isNotContainingKey` - - `isContainingValue` / `isNotContainingValue` +- Add new constraints to `CharSequence`, `kotlin.collections` and `Map`. ([#3](https://github.com/nesk/akkurate/issues/3)) ### Changed - -- Enable [Explicit API Mode](https://kotlinlang.org/docs/jvm-api-guidelines-backward-compatibility.html#explicit-api-mode) for the KSP plugin. ([#12](https://github.com/nesk/akkurate/issues/12)) +- **⚠️ BREAKING ⚠️** Change visibility of `ValidateAnnotationProcessor.validatableOfFunction` to private. ([#12](https://github.com/nesk/akkurate/issues/12)) +- **⚠️ BREAKING ⚠️** Change visibility of `ValidateAnnotationProcessor.validatableClass` to private. ([#12](https://github.com/nesk/akkurate/issues/12)) +- Enable [Explicit API Mode](https://kotlinlang.org/docs/jvm-api-guidelines-backward-compatibility.html#explicit-api-mode) for the KSP plugin. ([#12](https://github.com/nesk/akkurate/issues/12)) ## [0.1.1] - 2023-09-21 - ### Fixed - - The target version of generated JVM bytecode is now 1.8 instead of 11. ([#5](https://github.com/nesk/akkurate/issues/5)) - Suppress the warning about useless casts in generated accessors. ([#8](https://github.com/nesk/akkurate/issues/8)) ## [0.1.0] - 2023-09-12 - -First release - [Unreleased]: https://github.com/nesk/akkurate/compare/0.11.0...HEAD [0.11.0]: https://github.com/nesk/akkurate/compare/0.10.0...0.11.0 [0.10.0]: https://github.com/nesk/akkurate/compare/0.9.1...0.10.0 From 671e6fc63d849f5108af835d1f42a86391b18e8a Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Fri, 20 Dec 2024 21:41:43 +0100 Subject: [PATCH 03/14] wip --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 914e2d4b..086e75b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,11 +23,13 @@ jobs: - name: Write a new release to CHANGELOG.md env: +# RELEASE_VERSION: ${{ inputs.version }} RELEASE_VERSION: 0.99.0 run: chan release $RELEASE_VERSION --release-prefix="" - name: Update Akkurate's version in build files env: +# RELEASE_VERSION: ${{ inputs.version }} RELEASE_VERSION: 0.99.0 run: | sed -ri 's|version *= *".*|version = "'$RELEASE_VERSION'"|g' ./buildSrc/src/main/kotlin/akkurate.base-conventions.gradle.kts; From acc4c07da021e1aa7b6d69335a84a390664e58b3 Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Fri, 20 Dec 2024 21:41:49 +0100 Subject: [PATCH 04/14] WIP TO DELETE --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e8a7aa3..4afad5ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- test + ## [0.11.0] - 2024-12-09 ### Added - Ktor integration to automatically validate received payloads. ([#43](https://github.com/nesk/akkurate/issues/43)) From c5abf89d1d051d6dc7fbdfcb7551d6b6a93134c1 Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Fri, 20 Dec 2024 22:10:20 +0100 Subject: [PATCH 05/14] wip --- .github/workflows/release.yml | 19 +++++++++---------- CONTRIBUTING.md | 3 ++- .../akkurate.base-conventions.gradle.kts | 2 +- .../main/kotlin/akkurate.version.gradle.kts | 1 + 4 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 buildSrc/src/main/kotlin/akkurate.version.gradle.kts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 086e75b4..fd5808c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,17 +32,16 @@ jobs: # RELEASE_VERSION: ${{ inputs.version }} RELEASE_VERSION: 0.99.0 run: | - sed -ri 's|version *= *".*|version = "'$RELEASE_VERSION'"|g' ./buildSrc/src/main/kotlin/akkurate.base-conventions.gradle.kts; + echo 'version = "'$RELEASE_VERSION'"' > ./buildSrc/src/main/kotlin/akkurate.version.gradle.kts; sed -ri 's|CONFIG_JSON_VERSION *:.*|CONFIG_JSON_VERSION: '$RELEASE_VERSION'|g' ./.github/workflows/deploy-website.yml; sed -ri 's||g' ./documentation/v.list; sed -ri 's||g' ./documentation/writerside.cfg; - - run: git diff -# - name: Commit and push -# uses: stefanzweifel/git-auto-commit-action@v5 -# with: -# commit_message: release ${{ inputs.version }} -# branch: release/${{ inputs.version }} -# create_branch: true -# commit_author: Johann Pardanaud -# tagging_message: ${{ inputs.version }} + - name: Commit and push + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: release ${{ inputs.version }} + branch: release/${{ inputs.version }} + create_branch: true + commit_author: Johann Pardanaud + tagging_message: ${{ inputs.version }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 732085cc..27d18a83 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,8 @@ imports. ## Testing -When making some changes to existing code, make sure **all the tests** still pass, and adapt them when needed. +When making some changes to existing code, make sure **all the tests** still pass by running `./gradlew allTests test`, +and adapt them when needed. If you're fixing a bug, create a new test reproducing the bug to avoid future regressions. diff --git a/buildSrc/src/main/kotlin/akkurate.base-conventions.gradle.kts b/buildSrc/src/main/kotlin/akkurate.base-conventions.gradle.kts index 7efdb287..a5c0eff8 100644 --- a/buildSrc/src/main/kotlin/akkurate.base-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/akkurate.base-conventions.gradle.kts @@ -1,9 +1,9 @@ plugins { + id("akkurate.version") id("com.adarshr.test-logger") } group = "dev.nesk.akkurate" -version = "0.11.0" repositories { mavenCentral() diff --git a/buildSrc/src/main/kotlin/akkurate.version.gradle.kts b/buildSrc/src/main/kotlin/akkurate.version.gradle.kts new file mode 100644 index 00000000..ea402e72 --- /dev/null +++ b/buildSrc/src/main/kotlin/akkurate.version.gradle.kts @@ -0,0 +1 @@ +version = "0.11.0" From 06e4c89c20e586d7a977d07592251f914d6f8fe6 Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Fri, 20 Dec 2024 22:27:04 +0100 Subject: [PATCH 06/14] wip --- .github/workflows/release.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd5808c2..193ef6ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,11 +37,18 @@ jobs: sed -ri 's||g' ./documentation/v.list; sed -ri 's||g' ./documentation/writerside.cfg; - - name: Commit and push - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: release ${{ inputs.version }} - branch: release/${{ inputs.version }} - create_branch: true - commit_author: Johann Pardanaud - tagging_message: ${{ inputs.version }} +# - name: Commit and push +# uses: stefanzweifel/git-auto-commit-action@v5 +# with: +# commit_message: release ${{ inputs.version }} +# branch: release/${{ inputs.version }} +# create_branch: true +# commit_author: Johann Pardanaud +# tagging_message: ${{ inputs.version }} + + - name: Create a draft release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# RELEASE_VERSION: ${{ inputs.version }} + RELEASE_VERSION: 0.99.0 + run: chan show $RELEASE_VERSION | tail -n +2 | gh release create $RELEASE_VERSION --title "Akkurate $RELEASE_VERSION" --draft --notes-file - From 35bdb0b02d69516c12a9b05dae4ffd1e73491e13 Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Sat, 21 Dec 2024 16:43:18 +0100 Subject: [PATCH 07/14] wip sign + publish --- .github/workflows/deploy-website.yml | 2 +- .github/workflows/release.yml | 94 ++++++++++++------- .github/workflows/test.yml | 2 +- CONTRIBUTING.md | 2 +- ...kkurate.kmp-library-conventions.gradle.kts | 2 +- ...akkurate.publishing-conventions.gradle.kts | 36 +++---- 6 files changed, 74 insertions(+), 64 deletions(-) diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index ed111055..3fbbd5f3 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -1,5 +1,5 @@ name: Deploy documentation and API reference -on: [ push, pull_request ] +#on: [ push, pull_request ] # Gives the workflow permissions to clone the repo and create a page deployment permissions: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 193ef6ad..d3fffd66 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,52 +3,74 @@ on: push # workflow_dispatch: # inputs: # version: -# description: 'The version number to use' +# description: 'The version number to use (ex: 1.22.3)' # required: true # type: string +#env: +# RELEASE_VERSION: ${{ inputs.version }} jobs: - create-release-pr: - name: Create a pull request for the release - runs-on: ubuntu-latest - permissions: - contents: write +# create-release-pr: +# name: Create a pull request for the release +# runs-on: ubuntu-latest +# permissions: +# contents: write +# +# steps: +# - name: Install chan CLI +# run: npm install -g @geut/chan +# +# - name: Checkout repository +# uses: actions/checkout@v4 +# +# - name: Write a new release to CHANGELOG.md +# run: chan release $RELEASE_VERSION --release-prefix="" +# +# - name: Update Akkurate's version in build files +# run: | +# echo 'version = "'$RELEASE_VERSION'"' > ./buildSrc/src/main/kotlin/akkurate.version.gradle.kts; +# sed -ri 's|CONFIG_JSON_VERSION *:.*|CONFIG_JSON_VERSION: '$RELEASE_VERSION'|g' ./.github/workflows/deploy-website.yml; +# sed -ri 's||g' ./documentation/v.list; +# sed -ri 's||g' ./documentation/writerside.cfg; +# +## - name: Commit and push +## uses: stefanzweifel/git-auto-commit-action@v5 +## with: +## commit_message: release ${{ inputs.version }} +## branch: release/${{ inputs.version }} +## create_branch: true +## commit_author: Johann Pardanaud +## tagging_message: ${{ inputs.version }} +# +# - name: Create a draft release +# env: +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# run: chan show $RELEASE_VERSION | tail -n +2 | gh release create $RELEASE_VERSION --title "Akkurate $RELEASE_VERSION" --draft --notes-file - + publish: + name: Publish to Maven Central Repository + runs-on: macos-latest steps: - - name: Install chan CLI - run: npm install -g @geut/chan - - name: Checkout repository uses: actions/checkout@v4 - - name: Write a new release to CHANGELOG.md - env: -# RELEASE_VERSION: ${{ inputs.version }} - RELEASE_VERSION: 0.99.0 - run: chan release $RELEASE_VERSION --release-prefix="" + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 8 - - name: Update Akkurate's version in build files - env: -# RELEASE_VERSION: ${{ inputs.version }} - RELEASE_VERSION: 0.99.0 - run: | - echo 'version = "'$RELEASE_VERSION'"' > ./buildSrc/src/main/kotlin/akkurate.version.gradle.kts; - sed -ri 's|CONFIG_JSON_VERSION *:.*|CONFIG_JSON_VERSION: '$RELEASE_VERSION'|g' ./.github/workflows/deploy-website.yml; - sed -ri 's||g' ./documentation/v.list; - sed -ri 's||g' ./documentation/writerside.cfg; + - name: Validate Gradle wrapper + uses: gradle/actions/wrapper-validation@v3 -# - name: Commit and push -# uses: stefanzweifel/git-auto-commit-action@v5 -# with: -# commit_message: release ${{ inputs.version }} -# branch: release/${{ inputs.version }} -# create_branch: true -# commit_author: Johann Pardanaud -# tagging_message: ${{ inputs.version }} + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 - - name: Create a draft release + - name: Publish to Maven Central Repository env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# RELEASE_VERSION: ${{ inputs.version }} - RELEASE_VERSION: 0.99.0 - run: chan show $RELEASE_VERSION | tail -n +2 | gh release create $RELEASE_VERSION --title "Akkurate $RELEASE_VERSION" --draft --notes-file - + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} + SONATYPE_URL: ${{ vars.SONATYPE_URL }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + run: ./gradlew publish diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9e00a095..5836820d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,5 @@ name: Run tests -on: [ push, pull_request ] +#on: [ push, pull_request ] jobs: test: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 27d18a83..433c43e1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,4 +20,4 @@ and adapt them when needed. If you're fixing a bug, create a new test reproducing the bug to avoid future regressions. New code should be tested with a significant code coverage score (you can check it by using **Run | Run with Coverage** -in IntelliJ). +in IntelliJ). diff --git a/buildSrc/src/main/kotlin/akkurate.kmp-library-conventions.gradle.kts b/buildSrc/src/main/kotlin/akkurate.kmp-library-conventions.gradle.kts index 6d4b2821..bcae5f03 100644 --- a/buildSrc/src/main/kotlin/akkurate.kmp-library-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/akkurate.kmp-library-conventions.gradle.kts @@ -7,7 +7,7 @@ plugins { kotlin { explicitApi() - jvmToolchain(8) +// jvmToolchain(8) sourceSets { all { diff --git a/buildSrc/src/main/kotlin/akkurate.publishing-conventions.gradle.kts b/buildSrc/src/main/kotlin/akkurate.publishing-conventions.gradle.kts index be282290..d46227c6 100644 --- a/buildSrc/src/main/kotlin/akkurate.publishing-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/akkurate.publishing-conventions.gradle.kts @@ -4,41 +4,29 @@ plugins { signing } -ext["signing.keyId"] = System.getenv("SIGNING_KEY_ID") -ext["signing.password"] = System.getenv("SIGNING_PASSWORD") -ext["signing.secretKeyRingFile"] = System.getenv("SIGNING_SECRET_KEY_RING_FILE") -ext["sonatypeUsername"] = System.getenv("SONATYPE_USERNAME") -ext["sonatypePassword"] = System.getenv("SONATYPE_PASSWORD") - -fun hasExtra(name: String) = ext[name] != null -fun getExtra(name: String) = ext[name]?.toString() - publishing { // Configure maven central repository repositories { maven { name = "sonatype" - credentials { - username = getExtra("sonatypeUsername") - password = getExtra("sonatypePassword") - } - val isSnapshot = project.version.toString().endsWith("-SNAPSHOT") - if (isSnapshot) { - setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/") - } else { - setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") + System.getenv("SONATYPE_URL")?.let { setUrl(it) } + + credentials { + username = System.getenv("SONATYPE_USERNAME") + password = System.getenv("SONATYPE_PASSWORD") } } } } -// Signing artifacts. Signing.* extra properties values will be used -if (hasExtra("signing.keyId") && - hasExtra("signing.password") && - hasExtra("signing.secretKeyRingFile") -) { - signing { +// Signing artifacts +signing { + val signingKey: String? by project + val signingPassword: String? by project + useInMemoryPgpKeys(signingKey, signingPassword) + + if (signingKey !== null && signingPassword !== null) { sign(publishing.publications) } } From 5981b3fbfdcd7e168539bc4d8656493ae5bf74c1 Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Sun, 22 Dec 2024 14:56:51 +0100 Subject: [PATCH 08/14] wip sign + publish --- .github/workflows/release.yml | 97 +++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 45 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3fffd66..bd7bd3cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,51 +1,58 @@ name: Release a new version of Akkurate -on: push -# workflow_dispatch: -# inputs: -# version: -# description: 'The version number to use (ex: 1.22.3)' -# required: true -# type: string -#env: -# RELEASE_VERSION: ${{ inputs.version }} +on: + workflow_dispatch: + inputs: + version: + description: 'The version number to use (ex: 1.22.3)' + required: true + type: string +env: + RELEASE_VERSION: ${{ inputs.version }} jobs: -# create-release-pr: -# name: Create a pull request for the release -# runs-on: ubuntu-latest -# permissions: -# contents: write -# -# steps: -# - name: Install chan CLI -# run: npm install -g @geut/chan -# -# - name: Checkout repository -# uses: actions/checkout@v4 -# -# - name: Write a new release to CHANGELOG.md -# run: chan release $RELEASE_VERSION --release-prefix="" -# -# - name: Update Akkurate's version in build files -# run: | -# echo 'version = "'$RELEASE_VERSION'"' > ./buildSrc/src/main/kotlin/akkurate.version.gradle.kts; -# sed -ri 's|CONFIG_JSON_VERSION *:.*|CONFIG_JSON_VERSION: '$RELEASE_VERSION'|g' ./.github/workflows/deploy-website.yml; -# sed -ri 's||g' ./documentation/v.list; -# sed -ri 's||g' ./documentation/writerside.cfg; -# -## - name: Commit and push -## uses: stefanzweifel/git-auto-commit-action@v5 -## with: -## commit_message: release ${{ inputs.version }} -## branch: release/${{ inputs.version }} -## create_branch: true -## commit_author: Johann Pardanaud -## tagging_message: ${{ inputs.version }} -# -# - name: Create a draft release -# env: -# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# run: chan show $RELEASE_VERSION | tail -n +2 | gh release create $RELEASE_VERSION --title "Akkurate $RELEASE_VERSION" --draft --notes-file - + create-release-pr: + name: Create a Pull Request for the release + runs-on: ubuntu-latest + + steps: + - name: Install chan CLI + run: npm install -g @geut/chan + + - name: Checkout repository + uses: actions/checkout@v4 + with: + # This token allows committing modifications on workflow files (read/write on Contents and Workflows permissions) + token: ${{ secrets.RELEASE_TOKEN }} + + - name: Write a new release to CHANGELOG.md + run: chan release $RELEASE_VERSION --release-prefix="" + + - name: Update Akkurate's version in build files + run: | + echo 'version = "'$RELEASE_VERSION'"' > ./buildSrc/src/main/kotlin/akkurate.version.gradle.kts; + sed -ri 's|CONFIG_JSON_VERSION *:.*|CONFIG_JSON_VERSION: '$RELEASE_VERSION'|g' ./.github/workflows/deploy-website.yml; + sed -ri 's||g' ./documentation/v.list; + sed -ri 's||g' ./documentation/writerside.cfg; + + - name: Commit and push + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: release ${{ inputs.version }} + branch: release/${{ inputs.version }} + create_branch: true + commit_author: Johann Pardanaud + tagging_message: ${{ inputs.version }} + + - name: Create a draft release + env: + GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} + # The tail command is used to remove an unnecessary title from the changelog. + run: chan show $RELEASE_VERSION | tail -n +2 | gh release create $RELEASE_VERSION --title "Akkurate $RELEASE_VERSION" --draft --notes-file - + + - name: Create a Pull Request + env: + GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} + run: gh pr create --assignee nesk --base main --head release/$RELEASE_VERSION --title "Release $RELEASE_VERSION" --body "New release" -d publish: name: Publish to Maven Central Repository From bdee4c574ea8bbf319b07804c417a12d88ec4a4a Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Sun, 22 Dec 2024 16:12:19 +0100 Subject: [PATCH 09/14] wip --- .../src/main/kotlin/akkurate.kmp-library-conventions.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/akkurate.kmp-library-conventions.gradle.kts b/buildSrc/src/main/kotlin/akkurate.kmp-library-conventions.gradle.kts index bcae5f03..6d4b2821 100644 --- a/buildSrc/src/main/kotlin/akkurate.kmp-library-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/akkurate.kmp-library-conventions.gradle.kts @@ -7,7 +7,7 @@ plugins { kotlin { explicitApi() -// jvmToolchain(8) + jvmToolchain(8) sourceSets { all { From ae1ae30d35e30506cf53cf4384bbfb439e80a42e Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Thu, 26 Dec 2024 12:36:02 +0100 Subject: [PATCH 10/14] wip --- .github/workflows/release.yml | 31 +++++++++++++++++++++++++++---- CONTRIBUTING.md | 10 ++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd7bd3cf..8d87eb63 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ env: jobs: create-release-pr: - name: Create a Pull Request for the release + name: Create a pull request for the release runs-on: ubuntu-latest steps: @@ -21,7 +21,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: - # This token allows committing modifications on workflow files (read/write on Contents and Workflows permissions) + # This token allows committing modifications on workflow files (read/write on Contents, Pull Requests, and Workflows permissions) token: ${{ secrets.RELEASE_TOKEN }} - name: Write a new release to CHANGELOG.md @@ -49,10 +49,33 @@ jobs: # The tail command is used to remove an unnecessary title from the changelog. run: chan show $RELEASE_VERSION | tail -n +2 | gh release create $RELEASE_VERSION --title "Akkurate $RELEASE_VERSION" --draft --notes-file - - - name: Create a Pull Request + - name: Create a pull request env: GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} - run: gh pr create --assignee nesk --base main --head release/$RELEASE_VERSION --title "Release $RELEASE_VERSION" --body "New release" -d + run: | + gh pr create --assignee nesk --base main --head release/$RELEASE_VERSION --title "Release $RELEASE_VERSION" --body "This a pull request for releasing version $RELEASE_VERSION of Akkurate. + + ### Before merging this pull-request + #### Maven Central Repository + Head to the [Nexus Repository Manager](https://s01.oss.sonatype.org/#stagingRepositories) and verify if the newly created staging repository is valid, meaning: + + - all the artifacts are present (root directories starting with `akkurate-` in the sources); + - each artifact is built for nearly [all multiplatform targets](https://kotlinlang.org/docs/multiplatform-dsl-reference.html#targets); + - and all the files are signed with multiple `.asc` variations. + + If everything is compliant to this checklist, close the repository, then release it. + + #### GitHub release + Open the draft release created on GitHub. You can edit the description of the release to add any additional content you want, _but leave the changelog as-is._ Once you're satisfied, publish the release. + + #### Finalize everything + Once everything above is done, you can merge this pull request. + + ### Aborting the release + In case you want to cancel everything and restart from a clean slate: + + - Delete the tag and the branch: `git push --delete origin $RELEASE_VERSION release/$RELEASE_VERSION` + - Delete the release: `gh release delete $RELEASE_VERSION`" publish: name: Publish to Maven Central Repository diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 433c43e1..4beac48c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,3 +21,13 @@ If you're fixing a bug, create a new test reproducing the bug to avoid future re New code should be tested with a significant code coverage score (you can check it by using **Run | Run with Coverage** in IntelliJ). + +## Releasing + +The release process is almost entirely automated. You only have to +trigger [the release workflow](.github/workflows/release.yml) +and then follow the instructions of the created pull request. + +```shell +gh workflow run release.yml -f version=1.2.3 +``` From ea74e68595b8f33eae1b37134a50dc1a3cdce948 Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Thu, 26 Dec 2024 12:40:21 +0100 Subject: [PATCH 11/14] wip --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d87eb63..f28b6d74 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release a new version of Akkurate +name: Release new version on: workflow_dispatch: inputs: From d33fb33a9ddffbf999ad2f52ca564c13a02e204c Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Thu, 26 Dec 2024 13:00:28 +0100 Subject: [PATCH 12/14] wip --- .github/workflows/release.yml | 12 ++++++------ CONTRIBUTING.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f28b6d74..8e20a899 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release new version +name: Release a new version on: workflow_dispatch: inputs: @@ -11,7 +11,7 @@ env: jobs: create-release-pr: - name: Create a pull request for the release + name: Create a release and a pull request runs-on: ubuntu-latest steps: @@ -59,9 +59,9 @@ jobs: #### Maven Central Repository Head to the [Nexus Repository Manager](https://s01.oss.sonatype.org/#stagingRepositories) and verify if the newly created staging repository is valid, meaning: - - all the artifacts are present (root directories starting with `akkurate-` in the sources); + - all the artifacts are present (root directories starting with \`akkurate-\` in the sources); - each artifact is built for nearly [all multiplatform targets](https://kotlinlang.org/docs/multiplatform-dsl-reference.html#targets); - - and all the files are signed with multiple `.asc` variations. + - and all the files are signed with multiple \`.asc\` variations. If everything is compliant to this checklist, close the repository, then release it. @@ -74,8 +74,8 @@ jobs: ### Aborting the release In case you want to cancel everything and restart from a clean slate: - - Delete the tag and the branch: `git push --delete origin $RELEASE_VERSION release/$RELEASE_VERSION` - - Delete the release: `gh release delete $RELEASE_VERSION`" + - Delete the tag and the branch: \`git push --delete origin $RELEASE_VERSION release/$RELEASE_VERSION\` + - Delete the release: \`gh release delete $RELEASE_VERSION\`" publish: name: Publish to Maven Central Repository diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4beac48c..fa7b7771 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,5 +29,5 @@ trigger [the release workflow](.github/workflows/release.yml) and then follow the instructions of the created pull request. ```shell -gh workflow run release.yml -f version=1.2.3 +gh workflow run release.yml -f version=1.22.3 ``` From 3c046c7c7388cff35a86b5bf625e10c94e5d72de Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Thu, 26 Dec 2024 13:02:28 +0100 Subject: [PATCH 13/14] wip --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e20a899..678cfeff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,8 +74,8 @@ jobs: ### Aborting the release In case you want to cancel everything and restart from a clean slate: - - Delete the tag and the branch: \`git push --delete origin $RELEASE_VERSION release/$RELEASE_VERSION\` - - Delete the release: \`gh release delete $RELEASE_VERSION\`" + - Delete the release: \`gh release delete $RELEASE_VERSION\` + - Delete the tag and the branch: \`git push --delete origin $RELEASE_VERSION release/$RELEASE_VERSION\`" publish: name: Publish to Maven Central Repository From 81fa6c3f997f4556f11c5df0e36fff381b64dbce Mon Sep 17 00:00:00 2001 From: Johann Pardanaud Date: Thu, 26 Dec 2024 12:03:30 +0000 Subject: [PATCH 14/14] release 0.99.0 --- .github/workflows/deploy-website.yml | 2 +- CHANGELOG.md | 5 ++++- buildSrc/src/main/kotlin/akkurate.version.gradle.kts | 2 +- documentation/v.list | 2 +- documentation/writerside.cfg | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index 3fbbd5f3..78607482 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -21,7 +21,7 @@ env: ALGOLIA_INDEX_NAME: akkurate ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }} CONFIG_JSON_PRODUCT: AKKURATE - CONFIG_JSON_VERSION: 0.11.0 + CONFIG_JSON_VERSION: 0.99.0 jobs: build-documentation: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4afad5ee..0b86bd2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [0.99.0] - 2024-12-26 ### Added - test @@ -97,7 +99,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Suppress the warning about useless casts in generated accessors. ([#8](https://github.com/nesk/akkurate/issues/8)) ## [0.1.0] - 2023-09-12 -[Unreleased]: https://github.com/nesk/akkurate/compare/0.11.0...HEAD +[Unreleased]: https://github.com/nesk/akkurate/compare/0.99.0...HEAD +[0.99.0]: https://github.com/nesk/akkurate/compare/0.11.0...0.99.0 [0.11.0]: https://github.com/nesk/akkurate/compare/0.10.0...0.11.0 [0.10.0]: https://github.com/nesk/akkurate/compare/0.9.1...0.10.0 [0.9.1]: https://github.com/nesk/akkurate/compare/0.9.0...0.9.1 diff --git a/buildSrc/src/main/kotlin/akkurate.version.gradle.kts b/buildSrc/src/main/kotlin/akkurate.version.gradle.kts index ea402e72..96056837 100644 --- a/buildSrc/src/main/kotlin/akkurate.version.gradle.kts +++ b/buildSrc/src/main/kotlin/akkurate.version.gradle.kts @@ -1 +1 @@ -version = "0.11.0" +version = "0.99.0" diff --git a/documentation/v.list b/documentation/v.list index 4d0376c6..ee8c07b8 100644 --- a/documentation/v.list +++ b/documentation/v.list @@ -2,7 +2,7 @@ - + diff --git a/documentation/writerside.cfg b/documentation/writerside.cfg index bfd95a98..47bcdefa 100644 --- a/documentation/writerside.cfg +++ b/documentation/writerside.cfg @@ -4,5 +4,5 @@ - +