diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml
index ed111055..78607482 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:
@@ -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/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..678cfeff
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,106 @@
+name: Release a new 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 release and a pull request
+ 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, Pull Requests, 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 "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 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
+ runs-on: macos-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Set up JDK 8
+ uses: actions/setup-java@v4
+ with:
+ distribution: zulu
+ java-version: 8
+
+ - name: Validate Gradle wrapper
+ uses: gradle/actions/wrapper-validation@v3
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v4
+
+ - name: Publish to Maven Central Repository
+ env:
+ 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/CHANGELOG.md b/CHANGELOG.md
index 053c6433..0b86bd2a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,4 @@
-
# 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
@@ -8,150 +6,101 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
-## [0.11.0] - 2024-12-09
-
+## [0.99.0] - 2024-12-26
### Added
+- test
-- Ktor integration to automatically validate received payloads. ([#43](https://github.com/nesk/akkurate/issues/43))
+## [0.11.0] - 2024-12-09
+### Added
+- 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
+[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/CONTRIBUTING.md b/CONTRIBUTING.md
index ed8566e4..fa7b7771 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,13 +8,26 @@ 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
-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.
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).
+
+## 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.22.3
+```
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.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)
}
}
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..96056837
--- /dev/null
+++ b/buildSrc/src/main/kotlin/akkurate.version.gradle.kts
@@ -0,0 +1 @@
+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 @@
-
+