-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Requirements** - [ ] I have added test coverage for new or changed functionality No behavioral changes in this PR. - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions Ongoing, have TODO related to API/Java version combinations, but would like to get this portion merged to unblock utilizing release please for a pending bugfix. Planning to fix the matrices in a subsequent PR. **Related issues** SC-234641 **Describe the solution you've provided** Adds CI, docs, publishing, and release please actions.
- Loading branch information
1 parent
caffab8
commit 7103634
Showing
41 changed files
with
635 additions
and
274 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
name: Build Documentation | ||
description: 'Build Documentation.' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build Documentation | ||
shell: bash | ||
run: ./gradlew javadoc |
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,59 @@ | ||
name: CI Workflow | ||
description: 'Shared CI workflow.' | ||
inputs: | ||
run_tests: | ||
description: 'If true, run unit tests, otherwise skip them.' | ||
required: false | ||
default: 'true' | ||
android_api_level: | ||
description: 'The Android API level to use.' | ||
required: true | ||
java_version: | ||
description: 'The Java version to use.' | ||
required: true | ||
java_distribution: | ||
description: 'The Java distribution to use.' | ||
required: false | ||
default: 'temurin' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: ${{ inputs.java_distribution }} | ||
java-version: ${{ inputs.java_version }} | ||
|
||
- name: Setup Android SDK | ||
uses: android-actions/setup-android@v3 | ||
|
||
- name: Build | ||
shell: bash | ||
id: build | ||
run: ./gradlew build jar | ||
|
||
- name: Run Unit Tests | ||
if: inputs.run_tests == 'true' | ||
shell: bash | ||
run: ./gradlew test | ||
|
||
- name: Build contract tests | ||
shell: bash | ||
run: make build-contract-tests | ||
|
||
- name: Perform Instrumented Tests | ||
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 #2.30.1 | ||
with: | ||
api-level: ${{ inputs.android_api_level }} | ||
target: google_apis | ||
emulator-boot-timeout: 900 | ||
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: true | ||
script: | | ||
make start-contract-test-service | ||
make run-contract-tests | ||
./gradlew connectedDebugAndroidTest | ||
- name: Build documentation | ||
uses: ./.github/actions/build-docs |
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,24 @@ | ||
name: Publish Documentation | ||
description: 'Publish the documentation to Github pages' | ||
inputs: | ||
token: | ||
description: 'Token to use for publishing.' | ||
required: true | ||
dry_run: | ||
description: 'Is this a dry run. If so no docs will be published.' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.1 | ||
name: 'Publish to Github pages' | ||
if: ${{ inputs.dry_run == 'false' }} | ||
with: | ||
docs_path: launchdarkly-android-client-sdk/build/docs/javadoc | ||
github_token: ${{ inputs.token }} # For the shared action the token should be a GITHUB_TOKEN | ||
|
||
- name: Dry Run Publish Docs | ||
shell: bash | ||
if: ${{ inputs.dry_run == 'true' }} | ||
run: echo "Dry run. Not publishing docs." |
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,28 @@ | ||
name: Publish Package | ||
description: 'Publish the package to Sonatype' | ||
inputs: | ||
code_signing_keyring: | ||
description: 'The path of the code signing keyring.' | ||
required: true | ||
prerelease: | ||
description: 'Is this a prerelease. If so then it will be published to the staging repository only.' | ||
required: true | ||
dry_run: | ||
description: 'Is this a dry run. If so no package will be published.' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Publish Library | ||
shell: bash | ||
if: ${{ inputs.dry_run == 'false' }} | ||
env: | ||
LD_RELEASE_IS_PRERELEASE: ${{ inputs.prerelease }} | ||
SIGNING_SECRET_KEY_RING_FILE: ${{ inputs.code_signing_keyring }} | ||
run: source $GITHUB_ACTION_PATH/publish.sh | ||
|
||
- name: Dry Run Publish Library | ||
shell: bash | ||
if: ${{ inputs.dry_run == 'true' }} | ||
run: echo "Dry run. Not publishing." |
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,18 @@ | ||
#!/bin/bash | ||
|
||
set -ue | ||
|
||
echo "Publishing to Sonatype" | ||
if [ "${LD_RELEASE_IS_PRERELEASE}" == "true" ]; then | ||
echo "PRERELEASE" | ||
./gradlew publishToSonatype -Psigning.keyId="${SIGNING_KEY_ID}" -Psigning.password="${SIGNING_KEY_PASSPHRASE}" -Psigning.secretKeyRingFile="${SIGNING_SECRET_KEY_RING_FILE}" -PsonatypeUsername="${SONATYPE_USER_NAME}" -PsonatypePassword="${SONATYPE_PASSWORD}" || { | ||
echo "Gradle publish/release failed" >&2 | ||
exit 1 | ||
} | ||
else | ||
echo "RELEASE" | ||
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Psigning.keyId="${SIGNING_KEY_ID}" -Psigning.password="${SIGNING_KEY_PASSPHRASE}" -Psigning.secretKeyRingFile="${SIGNING_SECRET_KEY_RING_FILE}" -PsonatypeUsername="${SONATYPE_USER_NAME}" -PsonatypePassword="${SONATYPE_PASSWORD}" || { | ||
echo "Gradle publish/release failed" >&2 | ||
exit 1 | ||
} | ||
fi |
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,36 @@ | ||
name: Build and Test | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: ['main'] | ||
paths-ignore: | ||
- '**.md' # Do not need to run CI for markdown changes. | ||
pull_request: | ||
branches: [ 'main' ] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
ci-build: | ||
strategy: | ||
matrix: | ||
# TODO: Use full matrices | ||
# android_api_level: ['21','25','30','34'] | ||
# java_version: ['11', '17'] | ||
android_api_level: ['25'] | ||
java_version: ['17'] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# This enables hardware acceleration on large linux runners | ||
- name: Enable KVM group perms | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/ci | ||
with: | ||
android_api_level: ${{ matrix.android_api_level }} | ||
java_version: ${{ matrix.java_version }} |
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,12 @@ | ||
name: Lint PR title | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
lint-pr-title: | ||
uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main |
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,25 @@ | ||
on: | ||
workflow_dispatch: | ||
|
||
name: Publish Docs | ||
jobs: | ||
build-publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # Needed if using OIDC to get release secrets. | ||
contents: write # Needed in this case to write github pages. | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.1 | ||
name: Assume aws role | ||
with: | ||
aws_assume_role: ${{ vars.AWS_ROLE_ARN }} | ||
|
||
- name: Build and Test | ||
uses: ./.github/actions/ci | ||
|
||
- name: Publish Documentation | ||
uses: ./.github/actions/publish-docs | ||
with: | ||
token: ${{secrets.GITHUB_TOKEN}} |
Oops, something went wrong.