-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: updating CICD to support the java sdk internal package (#18)
This PR copies existing java-sdk-internal code from the private repo and takes the same approach as other migrated packages. I made a separate commit for the code copy to make that easier to verify. All code in lib/shared/internal should be identical to the [existing repo ](https://github.com/launchdarkly/java-sdk-internal)with no changes intended. Please check them carefully.
- Loading branch information
1 parent
9f7d64c
commit 82d3710
Showing
83 changed files
with
8,594 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,36 @@ | ||
--- | ||
name: Feature request for the java-sdk-common package | ||
about: Suggest an idea for this project | ||
name: 'Bug report for the java-sdk-common package' | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: 'package: java-sdk-common, enhancement' | ||
labels: 'package: java-sdk-common, bug' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...] | ||
**Is this a support request?** | ||
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the code in this library. If you're not sure whether the problem you are having is specifically related to this library, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/) and clicking "submit a request", or by emailing [email protected]. | ||
|
||
Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above. | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To reproduce** | ||
Steps to reproduce the behavior. | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Logs** | ||
If applicable, add any log output related to your problem. | ||
|
||
**SDK version** | ||
The version of this SDK that you are using. | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
**Language version, developer tools** | ||
For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
**OS/platform** | ||
For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. If your code is running in a browser, please also include the browser type and version. | ||
|
||
**Additional context** | ||
Add any other context about the feature request here. | ||
Add any other context about the problem here. |
20 changes: 20 additions & 0 deletions
20
.github/ISSUE_TEMPLATE/package-sdk-common--feature_request.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request for the java-sdk-common package | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: 'package: java-sdk-common, enhancement' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context about the feature request here. |
4 changes: 2 additions & 2 deletions
4
...MPLATE/package-sdk-commonl--bug_report.md → ...PLATE/package-sdk-internal--bug_report.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.github/ISSUE_TEMPLATE/package-sdk-internal--feature_request.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request for the java-sdk-internal package | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: 'package: java-sdk-internal, enhancement' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: java-sdk-internal | ||
|
||
on: | ||
push: | ||
branches: [main, 'feat/**'] | ||
paths-ignore: | ||
- '**.md' #Do not need to run CI for markdown changes. | ||
pull_request: | ||
branches: [main, 'feat/**'] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
build-test-java-sdk-internal: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Shared CI Steps | ||
uses: ./.github/actions/ci | ||
with: | ||
workspace_path: 'lib/shared/internal' | ||
java_version: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,39 @@ jobs: | |
aws_role: ${{ vars.AWS_ROLE_ARN }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release-sdk-internal: | ||
runs-on: ubuntu-latest | ||
needs: release-please | ||
permissions: | ||
id-token: write | ||
contents: write | ||
pull-requests: write | ||
if: ${{ needs.release-please.outputs.package-sdk-internal-released == 'true'}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: launchdarkly/gh-actions/actions/[email protected] | ||
name: Get secrets | ||
with: | ||
aws_assume_role: ${{ vars.AWS_ROLE_ARN }} | ||
ssm_parameter_pairs: '/production/common/releasing/sonatype/username = SONATYPE_USER_NAME, | ||
/production/common/releasing/sonatype/password = SONATYPE_PASSWORD' | ||
s3_path_pairs: 'launchdarkly-releaser/java/code-signing-keyring.gpg = code-signing-keyring.gpg' | ||
|
||
- uses: ./.github/actions/full-release | ||
with: | ||
workspace_path: lib/shared/internal | ||
dry_run: true #TODO make this false after testing | ||
prerelease: true #TODO make this false after testing | ||
code_signing_keyring: 'code-signing-keyring.gpg' | ||
signing_key_id: ${{ env.SIGNING_KEY_ID }} | ||
signing_key_passphrase: ${{ env.SIGNING_KEY_PASSPHRASE }} | ||
sonatype_username: ${{ env.SONATYPE_USER_NAME }} | ||
sonatype_password: ${{ env.SONATYPE_PASSWORD }} | ||
aws_role: ${{ vars.AWS_ROLE_ARN }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
release-sdk-common: | ||
runs-on: ubuntu-latest | ||
needs: release-please | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"lib/java-server-sdk-otel": "0.1.0", | ||
"lib/shared/common": "2.1.1" | ||
"lib/shared/common": "2.1.1", | ||
"lib/shared/internal": "1.3.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Eclipse project files | ||
.classpath | ||
.project | ||
.settings | ||
|
||
# Intellij project files | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
#Gradle | ||
.gradletasknamecache | ||
.gradle/ | ||
build/ | ||
bin/ | ||
out/ | ||
classes/ | ||
|
||
# Test code that gets temporarily copied by our Android CI build | ||
src/androidTest/java/com/launchdarkly/sdk/internal/**/*.java | ||
!src/androidTest/java/com/launchdarkly/sdk/internal/BaseTest.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Change log | ||
|
||
All notable changes to the project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org). | ||
|
||
## [1.3.0] - 2024-03-13 | ||
### Changed: | ||
- Redact anonymous attributes within feature events | ||
- Always inline contexts for feature events | ||
|
||
## [1.2.1] - 2023-11-14 | ||
### Fixed: | ||
- Fixes NPE when interacting with Context created by use of `copyFrom`. (Thanks, [ | ||
pedroafonsodias](https://github.com/launchdarkly/java-sdk-common/pull/15)) | ||
|
||
## [1.2.0] - 2023-10-11 | ||
### Added: | ||
- Added support for the migration operation event. | ||
- Added support for event sampling for feature events and migration operation events. | ||
|
||
## [1.1.1] - 2023-06-27 | ||
### Changed: | ||
- Bumping Guava version to incorporate CVE fixes. | ||
|
||
## [1.1.0] - 2023-03-21 | ||
### Added: | ||
- Additional query param related functionality to HttpHelpers | ||
|
||
## [1.0.0] - 2022-12-05 | ||
Initial release of this project, for use in the upcoming 6.0.0 release of the LaunchDarkly Java SDK and 4.0.0 release of the LaunchDarkly Android SDK. |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Repository Maintainers | ||
* @launchdarkly/team-sdk-java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Contributing to the LaunchDarkly SDK Java Internal Common Code | ||
|
||
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this project. | ||
|
||
## Submitting bug reports and feature requests | ||
|
||
The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/java-sdk-internal/issues) in the GitHub repository. Bug reports and feature requests specific to this project should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days. | ||
|
||
## Submitting pull requests | ||
|
||
We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days. | ||
|
||
## Access modifiers | ||
|
||
The types in this library are meant to be consumed by our SDK code, and never seen by application developers. However, for any type that will be referenced directly from SDK code (as opposed to an implementation detail that is only referenced from within the `java-sdk-internal` code), the access modifier must be `public`. These types cannot be package-private, because we need to be able to access them from SDK code in multiple packages (e.g. `com.launchdarkly.sdk.server` versus `com.launchdarkly.sdk.android`). | ||
|
||
That means it is technically possible for application code to see these types; the compiler will not stop a developer from referencing them. However: | ||
|
||
1. We are explicitly declaring all APIs in this library to be unsupported for customer use, so any such use is at the developer's own risk. | ||
2. Generated Javadoc documentation for the SDKs will not show these types, since they are in a dependency of the SDK rather than in the main SDK jar (and, in the case of the server-side Java SDK, these classes are obfuscated via shading). | ||
|
||
## Versioning | ||
|
||
The semantic versioning of this package refers to how the package is used from the point of view of internal SDK code. This is intentionally decoupled from the versioning of the SDKs themselves. | ||
|
||
If a feature is added for the SDKs to use, such as a new helper class or a new overload of an existing method, then a minor version increment is appropriate. That does _not_ mean that the SDKs themselves would have a minor version increment, unless they are exposing some new functionality for application code to use. | ||
|
||
If a change is made that is not backward-compatible, so SDK code will need to be modified to be able to use the new release, then a major version increment is appropriate. Again, that does _not_ mean that the SDKs themselves would have a major version increment, unless they have a breaking change from the point of view of application code. | ||
|
||
## Build instructions | ||
|
||
### Prerequisites | ||
|
||
The project builds with [Gradle](https://gradle.org/) and should be built against Java 8. | ||
|
||
### Building | ||
|
||
To build the project without running any tests: | ||
``` | ||
./gradlew jar | ||
``` | ||
|
||
If you wish to clean your working directory between builds, you can clean it by running: | ||
``` | ||
./gradlew clean | ||
``` | ||
|
||
If you wish to use your generated SDK artifact by another Maven/Gradle project such as [java-server-sdk](https://github.com/launchdarkly/java-server-sdk), you will likely want to publish the artifact to your local Maven repository so that your other project can access it. | ||
``` | ||
./gradlew publishToMavenLocal | ||
``` | ||
|
||
### Testing | ||
|
||
To build the project and run all unit tests: | ||
``` | ||
./gradlew test | ||
``` | ||
|
||
## Note on Java version, Android support, and dependencies | ||
|
||
This project can be used both in server-side Java and in Android. Its minimum Java version is 8, but not all Java 8 APIs and syntax are supported in Android. The CI jobs for this project include an Android job that runs all of the unit tests in Android, to verify that no unsupported APIs are being used. | ||
|
||
## Code coverage | ||
|
||
It is important to keep unit test coverage as close to 100% as possible in this project, since the SDK projects will not exercise every `java-sdk-internal` method in their own unit tests. | ||
|
||
You can view the latest code coverage report in CircleCI, as `coverage/html/index.html` in the artifacts for the "Java 11 - Linux - OpenJDK" job. You can also run the report locally with `./gradlew jacocoTestCoverage` and view `./build/reports/jacoco/test`. | ||
|
||
Sometimes a gap in coverage is unavoidable, usually because the compiler requires us to provide a code path for some condition that in practice can't happen and can't be tested, or because of a known issue with the code coverage tool. Please handle all such cases as follows: | ||
|
||
* Mark the code with an explanatory comment beginning with "COVERAGE:". | ||
* Run the code coverage task with `./gradlew jacocoTestCoverageVerification`. It should fail and indicate how many lines of missed coverage exist in the method you modified. | ||
* Add an item in the `knownMissedLinesForMethods` map in `build.gradle` that specifies that number of missed lines for that method signature. | ||
|
||
## Note on dependencies | ||
|
||
Because this project can be used in Android, it's important to avoid heavyweight runtime dependencies. For instance, as convenient as Guava can be, we should not use Guava at all (except possibly in _test_ code) because it is a large library-- and also because if the application does use Guava, we don't want to have to worry about conflicting with whatever version they're using. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2022 Catamorphic, Co. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
Oops, something went wrong.