Skip to content
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

Release 0.99.0 #57

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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|<var.* name="version".*|<var name="version" value="'$RELEASE_VERSION'"/>|g' ./documentation/v.list;
sed -ri 's|<instance.* src="akkurate.tree".*|<instance src="akkurate.tree" version="'$RELEASE_VERSION'"/>|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 <johann@pardanaud.com>
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Run tests
on: [ push, pull_request ]
#on: [ push, pull_request ]

jobs:
test:
Expand Down
103 changes: 26 additions & 77 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,157 +1,106 @@

# 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

## [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<Iterable<*>?>`. ([#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
Expand Down
19 changes: 16 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
id("akkurate.version")
id("com.adarshr.test-logger")
}

group = "dev.nesk.akkurate"
version = "0.11.0"

repositories {
mavenCentral()
Expand Down
Loading