Skip to content

Commit 71aca52

Browse files
Merge branch 'main' into static-scanning
2 parents 4f240b4 + 715fd03 commit 71aca52

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1144
-245
lines changed

.github/workflows/lint-pr.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Lint PR'
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
name: Validate PR title
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: amannn/action-semantic-pull-request@v4
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/merge.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
server-password: ${{ secrets.OSSRH_PASSWORD }}
3434

3535
- name: Cache local Maven repository
36-
uses: actions/cache@v2
36+
uses: actions/cache@v3
3737
with:
3838
path: ~/.m2/repository
3939
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -50,18 +50,21 @@ jobs:
5050
run: mvn --batch-mode --update-snapshots verify
5151

5252
- name: Upload coverage to Codecov
53-
uses: codecov/codecov-action@v2
53+
uses: codecov/codecov-action@v3
5454
with:
5555
flags: unittests # optional
5656
name: coverage # optional
5757
fail_ci_if_error: true # optional (default = false)
5858
verbose: true # optional (default = false)
59+
60+
# Add -SNAPSHOT before deploy
61+
- name: Add SNAPSHOT
62+
run: mvn versions:set -DnewVersion='${project.version}-SNAPSHOT'
63+
5964
- name: Deploy
6065
run: |
61-
mvn -P gpg_verify \
62-
--no-transfer-progress \
63-
--batch-mode \
64-
--file pom.xml -s release/m2-settings.xml verify deploy
66+
mvn --batch-mode \
67+
--settings release/m2-settings.xml clean deploy
6568
env:
6669
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
6770
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

.github/workflows/pullrequest.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ permissions:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12+
services:
13+
flagd:
14+
image: ghcr.io/open-feature/flagd-testbed:latest
15+
ports:
16+
- 8013:8013
17+
1218
steps:
1319
- name: Check out the code
1420
uses: actions/checkout@v3
@@ -20,18 +26,18 @@ jobs:
2026
cache: maven
2127

2228
- name: Cache local Maven repository
23-
uses: actions/cache@v2
29+
uses: actions/cache@v3
2430
with:
2531
path: ~/.m2/repository
2632
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2733
restore-keys: |
2834
${{ runner.os }}-maven-
2935
3036
- name: Build with Maven
31-
run: mvn --batch-mode --update-snapshots verify
37+
run: mvn --batch-mode --update-snapshots verify # -P integration-test - add this back once we have a compatible flagd
3238

3339
- name: Upload coverage to Codecov
34-
uses: codecov/codecov-action@v2
40+
uses: codecov/codecov-action@v3
3541
with:
3642
flags: unittests # optional
3743
name: coverage # optional

.github/workflows/release.yml

+46-62
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,52 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
6-
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
7-
8-
# maven deploy commands via via https://tech.clevertap.com/automate-releases-to-maven-central-via-github-actions/
9-
10-
name: Release
1+
# This workflow creates a running release please PR, which tracks all changes
2+
# based on semantic PR titles. When that PR is merged, a publish occurs after
3+
# release please increments the version.
114

125
on:
13-
release:
14-
types: [created]
15-
6+
push:
7+
branches:
8+
- main
9+
name: Run Release Please
1610
jobs:
17-
build:
18-
11+
release-please:
1912
runs-on: ubuntu-latest
20-
permissions:
21-
contents: read
22-
packages: write
2313

14+
# Release-please creates a PR that tracks all changes
2415
steps:
25-
- uses: actions/checkout@v3
26-
- name: Set up JDK 8
27-
uses: actions/setup-java@v3
28-
with:
29-
java-version: '8'
30-
distribution: 'temurin'
31-
cache: maven
32-
server-id: ossrh
33-
server-username: ${{ secrets.OSSRH_USERNAME }}
34-
server-password: ${{ secrets.OSSRH_PASSWORD }}
35-
36-
- name: Configure GPG Key
37-
run: |
38-
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
39-
gpg --list-secret-keys --keyid-format LONG
40-
env:
41-
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
42-
43-
- name: Build with Maven
44-
run: |
45-
mvn --batch-mode --update-snapshots verify gpg:sign -Dversion.modifier=''
46-
ls
47-
ls *
48-
gpg --verify target/javasdk-0.1.0-sources.jar.asc target/javasdk-0.1.0-sources.jar
49-
50-
- name: Upload coverage to Codecov
51-
uses: codecov/codecov-action@v2
52-
with:
53-
token: ${{ secrets.CODECOV_TOKEN }}
54-
flags: unittests # optional
55-
name: coverage # optional
56-
fail_ci_if_error: true # optional (default = false)
57-
verbose: true # optional (default = false)
58-
59-
- name: Deploy
60-
run: |
61-
gpg --verify target/javasdk-0.1.0-sources.jar.asc target/javasdk-0.1.0-sources.jar
62-
mvn -P gpg_verify \
63-
--no-transfer-progress \
64-
--batch-mode \
65-
--file pom.xml -s release/m2-settings.xml deploy -Dversion.modifier=''
66-
env:
67-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
68-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
16+
- uses: google-github-actions/release-please-action@v3
17+
id: release
18+
with:
19+
command: manifest
20+
token: ${{secrets.GITHUB_TOKEN}}
21+
default-branch: main
22+
23+
# These steps are only run if this was a merged release-please PR
24+
- name: checkout
25+
if: ${{ steps.release.outputs.releases_created }}
26+
uses: actions/checkout@v3
27+
- name: Set up JDK 8
28+
if: ${{ steps.release.outputs.releases_created }}
29+
uses: actions/setup-java@v3
30+
with:
31+
java-version: '8'
32+
distribution: 'temurin'
33+
cache: maven
34+
server-id: ossrh
35+
server-username: ${{ secrets.OSSRH_USERNAME }}
36+
server-password: ${{ secrets.OSSRH_PASSWORD }}
37+
38+
- name: Configure GPG Key
39+
if: ${{ steps.release.outputs.releases_created }}
40+
run: |
41+
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
42+
env:
43+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
44+
45+
- name: Deploy
46+
if: ${{ steps.release.outputs.releases_created }}
47+
run: |
48+
mvn --batch-mode \
49+
--settings release/m2-settings.xml clean deploy
50+
env:
51+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
52+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "test-harness"]
2+
path = test-harness
3+
url = https://github.com/open-feature/test-harness

.release-please-manifest.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{".":"0.2.2"}

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Changelog
2+
3+
## [0.2.2](https://github.com/open-feature/java-sdk/compare/dev.openfeature.javasdk-v0.2.1...dev.openfeature.javasdk-v0.2.2) (2022-09-20)
4+
5+
6+
### Features
7+
8+
* Add asObjectMap to get the EvaluationContext as Map<String,Object> ([#75](https://github.com/open-feature/java-sdk/issues/75)) ([2eec1a5](https://github.com/open-feature/java-sdk/commit/2eec1a5519b9efab7d7f9dc8b1cbd84d9218368b))
9+
10+
## [0.2.1](https://github.com/open-feature/java-sdk/compare/dev.openfeature.javasdk-v0.2.0...dev.openfeature.javasdk-v0.2.1) (2022-09-13)
11+
12+
13+
### Bug Fixes
14+
15+
* isList check in Value checks type of list ([#70](https://github.com/open-feature/java-sdk/issues/70)) ([81ab071](https://github.com/open-feature/java-sdk/commit/81ab0710ea56af65eb65c7f95832b8f58c559a51))
16+
17+
## [0.2.0](https://github.com/open-feature/java-sdk/compare/dev.openfeature.javasdk-v0.1.1...dev.openfeature.javasdk-v0.2.0) (2022-09-13)
18+
19+
20+
### ⚠ BREAKING CHANGES
21+
22+
* use value for object resolver
23+
* use instant not zoneddatetime
24+
25+
### Features
26+
27+
* add object to value wrapper ([0152a1e](https://github.com/open-feature/java-sdk/commit/0152a1eef93ea1b5253ddae78718a9805c98aaf7))
28+
* use instant not zoneddatetime ([3e62414](https://github.com/open-feature/java-sdk/commit/3e6241422266825f267043e4acd116803c4939b0))
29+
* use value for object resolver ([5d26247](https://github.com/open-feature/java-sdk/commit/5d262470e8ec47d2af35f0aabe55e8c969e992ac))

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@open-feature/java-maintainers

README.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.openfeature/javasdk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.openfeature/javasdk)
44
[![javadoc](https://javadoc.io/badge2/dev.openfeature/javasdk/javadoc.svg)](https://javadoc.io/doc/dev.openfeature/javasdk)
55
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
6-
[![Specification](https://img.shields.io/static/v1?label=Specification&message=v0.4.0&color=yellow)](https://github.com/open-feature/spec/tree/v0.4.0)
6+
[![Specification](https://img.shields.io/static/v1?label=Specification&message=v0.5.0&color=yellow)](https://github.com/open-feature/spec/tree/v0.5.0)
77
[![Known Vulnerabilities](https://snyk.io/test/github/open-feature/java-sdk/badge.svg)](https://snyk.io/test/github/open-feature/java-sdk)
88
[![on-merge](https://github.com/open-feature/java-sdk/actions/workflows/merge.yml/badge.svg)](https://github.com/open-feature/java-sdk/actions/workflows/merge.yml)
99
[![codecov](https://codecov.io/gh/open-feature/java-sdk/branch/main/graph/badge.svg?token=XMS9L7PBY1)](https://codecov.io/gh/open-feature/java-sdk)
@@ -61,13 +61,15 @@ class MyClass {
6161
### Add it to your build
6262

6363
#### Maven
64+
<!-- x-release-please-start-version -->
6465
```xml
6566
<dependency>
6667
<groupId>dev.openfeature</groupId>
6768
<artifactId>javasdk</artifactId>
68-
<version>0.1.0</version>
69+
<version>0.2.2</version>
6970
</dependency>
7071
```
72+
<!-- x-release-please-end-version -->
7173

7274
If you would like snapshot builds, this is the relevant repository information:
7375

@@ -85,11 +87,13 @@ If you would like snapshot builds, this is the relevant repository information:
8587
```
8688

8789
#### Gradle
90+
<!-- x-release-please-start-version -->
8891
```groovy
8992
dependencies {
90-
implementation 'dev.openfeature:javasdk:0.1.0'
93+
implementation 'dev.openfeature:javasdk:0.2.2'
9194
}
9295
```
96+
<!-- x-release-please-end-version -->
9397

9498
### Configure it
9599
To configure it, you'll need to add a provider to the global singleton `OpenFeatureAPI`. From there, you can generate a `Client` which is usable by your code. While you'll likely want a provider for your specific backend, we've provided a `NoOpProvider`, which simply returns the default passed in.
@@ -108,6 +112,16 @@ We hold regular meetings which you can see [here](https://github.com/open-featur
108112

109113
We are also present on the `#openfeature` channel in the [CNCF slack](https://slack.cncf.io/).
110114

115+
## Developing
116+
117+
### Integration tests
118+
119+
The continuous integration runs a set of [gherkin integration tests](https://github.com/open-feature/test-harness/blob/main/features/evaluation.feature) using [`flagd`](https://github.com/open-feature/flagd). These tests do not run with the default maven profile. If you'd like to run them locally, you can start the flagd testbed with `docker run -p 8013:8013 ghcr.io/open-feature/flagd-testbed:latest` and then run `mvn test -P integration-test`.
120+
121+
## Releasing
122+
123+
See [releasing](./docs/release.md).
124+
111125
## Contributors
112126

113127
Thanks so much to our contributors.

checkstyle.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
281281
</module>
282282
<module name="JavadocMethod">
283-
<property name="scope" value="public"/>
283+
<property name="accessModifiers" value="public"/>
284284
<property name="allowMissingParamTags" value="true"/>
285285
<property name="allowMissingReturnTag" value="true"/>
286286
<property name="allowedAnnotations" value="Override, Test"/>

docs/release.md

+6-23
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
1-
This is a simple checklist when performing a release.
1+
# Releases
22

3-
1. Ensure we're up-to-date with the current spec via `./spec_finder.py --diff-output --refresh-spec`
4-
2. Update `README.md` with the current spec that we're up to
5-
3. Update `README.md` to keep the install instructions on the right version
6-
4. Update `<version>` in pom.xml
7-
5. Run `mvn verify` to ensure it all works.
8-
6. Commit the results as the new version.
3+
This repo uses _Release Please_ to release packages. Release Please sets up a running PR that tracks all changes in the library, and maintains the versions according to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), generated when [PRs are merged](https://github.com/amannn/action-semantic-pull-request), based on the PR title. The semantics of the PR title are enforced by the `lint-pr.yml` workflow. When Release Please's running PR is merged, a new release is created, and the associated artifacts are published.
94

10-
Then in GitHub, trigger a release.
5+
## Customization of changelog and release notes.
116

12-
1. Go to [github releases](https://github.com/open-feature/java-sdk/releases/new)
13-
2. Name a tag w/ the version you want to release (e.g. `0.1.0`)
14-
3. Click the generate release notes button and write some text about what actually changed.
15-
4. Submit
16-
5. Validate the action which builds the result happened correctly.
7+
If you'd like to add custom content to a release, you can do this by editing the content in a Release Please PR's description. This content will be added to the notes for that release. If you'd like to add content to the changelog, simply push updates to the changelog in the Release Please PR.
178

18-
If something went wrong above, here's how you reset.
19-
1. Save the release notes you wrote.
20-
2. Delete the release.
21-
3. Delete the tag with `git push --delete origin 0.1.0` where 0.1.0 is your tag name.
9+
## Configuration
2210

23-
```shell
24-
gh release delete 0.1.0 -y
25-
git push --delete origin 0.1.0
26-
27-
gh release create 0.1.0 -F /tmp/010-release.md -t 0.1.0
28-
```
11+
The `release-please-config.json` defines the release please configuration. See schema [here](https://github.com/googleapis/release-please/blob/main/schemas/config.json) to understand all the options. We use the "simple" release strategy and annotate the POM with an element to help release please find the correct XML entity to update (the version element). Release Please stores it's understanding of the current version in the `version.txt` file.

0 commit comments

Comments
 (0)