Skip to content

record network request bodies and headers in trace (#8551) #3

record network request bodies and headers in trace (#8551)

record network request bodies and headers in trace (#8551) #3

Workflow file for this run

name: 'Java SDK'
on:
workflow_dispatch:
inputs:
action:
description: 'Action'
required: true
default: 'none'
type: choice
options:
- none
- build
- test
- deploy
push:
branches: ['main']
tags: ['sdk/highlight-java/**']
pull_request:
types: [opened, reopened, synchronize, assigned, review_requested]
paths:
- 'sdk/highlight-java/**'
- '.github/workflows/java-sdk.yml'
permissions:
checks: write
defaults:
run:
working-directory: ./sdk/highlight-java
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
deploy: ${{ steps.deploy.outputs.deploy }}
build: ${{ steps.build.outputs.build }}
test: ${{ steps.test.outputs.test }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Deployment running
id: deploy
env:
GITHUB_EVENT_REF: ${{ startsWith(github.event.ref, 'refs/tags/sdk/highlight-java/') }}
INPUTS_ACTION: ${{ inputs.action }}
run: |
running=$(if [ "$GITHUB_EVENT_REF" = "true" ] || [ "$INPUTS_ACTION" = "deploy" ]; then echo true; else echo false; fi)
echo "deploy=$running" >> "$GITHUB_OUTPUT"
echo "Is deployment running: $running"
- name: Build running
id: build
env:
DEPLOY_RUNNING: ${{ steps.deploy.outputs.deploy }}
INPUTS_ACTION: ${{ inputs.action }}
run: |
running=$(if [ "$INPUTS_ACTION" != "test" ] || [ "$DEPLOY_RUNNING" == "true" ]; then echo true; else echo false; fi)
echo "build=$running" >> "$GITHUB_OUTPUT"
echo "Is build running: $running"
- name: Test running
id: test
env:
DEPLOY_RUNNING: ${{ steps.deploy.outputs.deploy }}
INPUTS_ACTION: ${{ inputs.action }}
run: |
running=$(if [ "$INPUTS_ACTION" != "build" ] || [ "$DEPLOY_RUNNING" == "true" ]; then echo true; else echo false; fi)
echo "test=$running" >> "$GITHUB_OUTPUT"
echo "Is test running: $running"
- name: Build version
id: version
env:
DEPLOY_RUNNING: ${{ steps.deploy.outputs.deploy }}
run: |
# Get latest tag version
version=$(git describe --match "sdk/highlight-java/v*" --abbrev=0 --tags $(git rev-list --tags --max-count=1) | cut -d "v" -f3)
# Returning default when no git tag was found
version=$(if [ "$version" != "" ]; then echo $version; else echo "0.0.0"; fi)
# Adding github runner number only when no deployment is running
version=$(if [ "$DEPLOY_RUNNING" == "true" ]; then echo "$version"; else echo "$version"-b$GITHUB_RUN_NUMBER; fi)
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Build version: $version"
build:
name: Build
runs-on: ubuntu-latest
needs: setup
if: ${{ needs.setup.outputs.build == 'true' }}
defaults:
run:
working-directory: ./sdk/highlight-java
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Build
run: |
mvn clean package --batch-mode -DskipTests -Drevision=${{needs.setup.outputs.version}}
mv ./highlight-sdk/target/highlight-sdk-*.jar ./
- name: Publish build artifacts
uses: actions/upload-artifact@v4
with:
name: highlight-java-sdk
path: ./sdk/highlight-java/highlight-sdk-*.jar
test:
name: Test
runs-on: ubuntu-latest
needs: setup
if: ${{ needs.setup.outputs.test == 'true' }}
defaults:
run:
working-directory: ./sdk/highlight-java
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Test
run: mvn clean test --batch-mode -Dmaven.test.failure.ignore=true -Drevision=${{needs.setup.outputs.version}}
- name: Upload Test Report
uses: actions/upload-artifact@v4
if: always()
with:
name: junit-test-results
path: '**/target/surefire-reports/TEST-*.xml'
retention-days: 1
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
with:
commit: ${{github.event.workflow_run.head_sha}}
report_paths: '**/target/surefire-reports/TEST-*.xml'
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [setup, build, test]
if: ${{ needs.setup.outputs.deploy == 'true' }}
defaults:
run:
working-directory: ./sdk/highlight-java
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to the Maven Central Repository
run: mvn clean deploy --no-transfer-progress -Drevision=${{needs.setup.outputs.version}}
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}