Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
54 changes: 47 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ master ]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -15,16 +18,16 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'

- name: Cache Maven dependencies
uses: actions/cache@v4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand All @@ -42,26 +45,63 @@ jobs:

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: test-results-java-${{ matrix.java-version }}
path: target/surefire-reports/

test-openfeature-provider:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: ['11', '17', '21']

steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'

- name: Cache Maven dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Install core library to local Maven repository
run: mvn install -DskipTests -Dgpg.skip=true

- name: Run OpenFeature provider tests
run: cd openfeature-provider && mvn clean test

- name: Upload test results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: openfeature-test-results-java-${{ matrix.java-version }}
path: openfeature-provider/target/surefire-reports/

code-quality:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

- name: Set up JDK 8
uses: actions/setup-java@v4
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
java-version: '8'
distribution: 'temurin'

- name: Cache Maven dependencies
uses: actions/cache@v4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand Down
107 changes: 107 additions & 0 deletions .github/workflows/release-openfeature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Release OpenFeature Provider to Maven Central

on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.0)'
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'

- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
echo "allow-preset-passphrase" >> ~/.gnupg/gpg-agent.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
gpg --list-secret-keys --keyid-format LONG

- name: Configure Maven settings
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
run: |
mkdir -p ~/.m2
cat > ~/.m2/settings.xml << EOF
<settings>
<servers>
<server>
<id>central</id>
<username>${MAVEN_CENTRAL_USERNAME}</username>
<password>${MAVEN_CENTRAL_TOKEN}</password>
</server>
</servers>
</settings>
EOF

- name: Set version
id: set-version
run: |
VERSION=${{ github.event.inputs.version }}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
cd openfeature-provider
mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false

- name: Build and install Main SDK locally
run: mvn clean install -DskipTests -Dgpg.skip=true

- name: Run tests - OpenFeature Provider
run: |
cd openfeature-provider
mvn clean test

- name: Deploy OpenFeature Provider to Maven Central
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
cd openfeature-provider
mvn clean deploy -Dgpg.passphrase=$GPG_PASSPHRASE

verify:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +13 to +87
needs: release
runs-on: ubuntu-latest
if: success()

steps:
- name: Wait for Maven Central sync
run: sleep 300 # Wait 5 minutes for synchronization

- name: Verify artifact on Maven Central
run: |
VERSION=${{ needs.release.outputs.version }}

RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://repo1.maven.org/maven2/com/mixpanel/mixpanel-java-openfeature/${VERSION}/mixpanel-java-openfeature-${VERSION}.jar)
if [ $RESPONSE -eq 200 ]; then
echo "✅ OpenFeature Provider successfully published to Maven Central"
else
echo "⚠️ OpenFeature Provider not yet available on Maven Central (HTTP $RESPONSE)"
fi

echo "Note: Artifacts may take up to 30 minutes to appear on Maven Central"

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment on lines +88 to +107
Loading
Loading