Code coverage was not working in HTTP proc in Java #3988
Workflow file for this run
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
name: Build | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- 'master' | |
- 'release-*' | |
push: | |
branches: | |
- 'master' | |
- 'beta' | |
- 'release-*' | |
- 'beta-corona' | |
jobs: | |
build: | |
name: Build | |
env: | |
GIT_REF: ${{ github.ref }} | |
GIT_SHA: ${{ github.sha }} | |
POM_PATH: ./pom.xml | |
runs-on: ubuntu-latest | |
outputs: | |
MAVEN_VERSION: ${{ steps.buildVariables.outputs.MAVEN_VERSION }} | |
LAST_COMMITTER: ${{ steps.buildVariables.outputs.LAST_COMMITTER }} | |
COMMIT_MESSAGE: ${{ steps.buildVariables.outputs.COMMIT_MESSAGE }} | |
SHOULD_DEPLOY: ${{ steps.buildVariables.outputs.SHOULD_DEPLOY }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ vars.JAVA_VERSION }} | |
distribution: 'temurin' | |
gpg-private-key: ${{ secrets.MAVEN_GPG_BUILDER_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Setup Maven | |
uses: stCarolas/[email protected] | |
with: | |
maven-version: ${{ vars.MAVEN_VERSION }} | |
- name: Setup Maven settings | |
uses: whelk-io/maven-settings-xml-action@v14 | |
with: | |
repositories: '[{ "id": "github-genexuslabs", "url": "https://maven.pkg.github.com/genexuslabs/*", "releases": { "enabled": "true" }, "snapshots": { "enabled": "true" } }]' | |
servers: '[ | |
{ "id": "github-genexuslabs", "username": "genexusbot", "password": "${{ secrets.SECURE_TOKEN }}" }, | |
{ "id": "azure-devops", "username": "genexuslabs", "password": "${env.AZURE_ARTIFACTS_TOKEN}" }, | |
{ "id": "ossrh", "username": "${env.MAVEN_USERNAME}", "password": "${env.MAVEN_PASSWORD}" }, | |
{ "id": "gpg.passphrase", "passphrase": "${env.MAVEN_GPG_PASSPHRASE}" } | |
]' | |
- name: Calculate build variables | |
id: buildVariables | |
run: | | |
currentVersion="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" | |
semVerComponents=( ${currentVersion//-/ } ) | |
semVerComponents=${semVerComponents[0]} | |
semVerComponents=( ${semVerComponents//./ } ) | |
pomMajorNumber=${semVerComponents[0]} | |
pomMinorNumber=${semVerComponents[1]} | |
[[ $(git branch --show-current) ]] && branch="$(git symbolic-ref --short HEAD)" || branch=“DETACHED_HEAD“ | |
timestamp=$(date --utc +%Y%m%d%H%M%S) | |
SHOULD_DEPLOY='false' | |
SHOULD_DEPLOY_MAVEN_CENTRAL='false' | |
case "$branch" in | |
master) | |
echo "## Is MASTER branch" | |
versionChangelist="-stable.$timestamp-SNAPSHOT" | |
SHOULD_DEPLOY='true' | |
;; | |
beta) | |
echo "## Is BETA branch, add +100 to major number" | |
pomMajorNumber=$(expr $pomMajorNumber + 100) | |
versionChangelist="-trunk.$timestamp-SNAPSHOT" | |
SHOULD_DEPLOY='true' | |
;; | |
beta-corona) | |
echo "## Is BETA-CORONA branch, use fixed version" | |
pomMajorNumber="116" | |
pomMinorNumber="0" | |
pomPatchNumber="$(git rev-list --count origin/master..)" | |
SHOULD_DEPLOY='true' | |
;; | |
release-*) | |
echo "## Is RELEASE/UPGRADE branch, use pom.xml version modifing patch number" | |
pomPatchNumber="$(git rev-list --count origin/master..)" | |
SHOULD_DEPLOY='true' | |
SHOULD_DEPLOY_MAVEN_CENTRAL='true' | |
;; | |
*) | |
echo "## Is a feature branch, use pom.xml version as is" | |
;; | |
esac | |
if [ -z "$pomPatchNumber" ]; then | |
newVersion="$pomMajorNumber.$pomMinorNumber" | |
else | |
newVersion="$pomMajorNumber.$pomMinorNumber.$pomPatchNumber" | |
fi | |
# Add current commit's SHA to pom.xml | |
GIT_HASH=$(git rev-parse HEAD) | |
scmversion="<vcm_hash>$GIT_HASH</vcm_hash>" | |
scmv=$(echo $scmversion | sed 's/\//\\\//g') | |
sed -i "/<\/properties>/ s/.*/ ${scmv}\n&/" pom.xml | |
echo "Project version: $newVersion" | |
echo "Version changelist: $versionChangelist" | |
MAVEN_VERSION="$newVersion$versionChangelist" | |
echo "Full project version: $MAVEN_VERSION" | |
LastCommitter=$(git log -1 --pretty=format:%an) | |
CommitMessage=$(git log -1 --pretty=%B) | |
echo "LAST_COMMITTER=$LastCommitter" >> $GITHUB_OUTPUT | |
# Handling a multi-line output value | |
OUTPUT_MESSAGE_EOF="eof${MAVEN_VERSION}" | |
echo "COMMIT_MESSAGE<<$OUTPUT_MESSAGE_EOF" >> $GITHUB_OUTPUT | |
echo "$CommitMessage" >> $GITHUB_OUTPUT | |
echo "$OUTPUT_MESSAGE_EOF" >> $GITHUB_OUTPUT | |
echo "newVersion=$newVersion" >> $GITHUB_OUTPUT | |
echo "versionChangelist=$versionChangelist" >> $GITHUB_OUTPUT | |
echo "MAVEN_VERSION=$MAVEN_VERSION" >> $GITHUB_OUTPUT | |
echo "SHOULD_DEPLOY=$SHOULD_DEPLOY" >> $GITHUB_OUTPUT | |
echo "SHOULD_DEPLOY_MAVEN_CENTRAL=$SHOULD_DEPLOY_MAVEN_CENTRAL" >> $GITHUB_OUTPUT | |
- name: Validate build | |
run: mvn -B validate -Drevision=${{ steps.buildVariables.outputs.newVersion }} -Dchangelist=${{ steps.buildVariables.outputs.versionChangelist }} -Dsha1=${{ github.sha }} --file $POM_PATH -P ci-cd | |
- name: Build | |
run: mvn -B compile -Drevision=${{ steps.buildVariables.outputs.newVersion }} -Dchangelist=${{ steps.buildVariables.outputs.versionChangelist }} -Dsha1=${{ github.sha }} --file $POM_PATH -P ci-cd | |
- name: Test | |
run: mvn -B test -Drevision=${{ steps.buildVariables.outputs.newVersion }} -Dchangelist=${{ steps.buildVariables.outputs.versionChangelist }} -Dsha1=${{ github.sha }} --file $POM_PATH -P ci-cd | |
- name: Package | |
run: mvn -B -DskipTests package -Drevision=${{ steps.buildVariables.outputs.newVersion }} -Dchangelist=${{ steps.buildVariables.outputs.versionChangelist }} -Dsha1=${{ github.sha }} --file $POM_PATH -P ci-cd | |
- name: Deploy to Azure Artifacts | |
if: steps.buildVariables.outputs.SHOULD_DEPLOY == 'true' | |
run: mvn -B -DskipTests deploy -Drevision=${{ steps.buildVariables.outputs.newVersion }} -Dchangelist=${{ steps.buildVariables.outputs.versionChangelist }} -Dsha1=${{ github.sha }} -DdeployAtEnd=true --file "$POM_PATH" -P ci-cd -P deploy-to-azure | |
env: | |
AZURE_ARTIFACTS_TOKEN: ${{ secrets.AZURE_ARTIFACTS_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_BUILDER_PASSPHRASE }} | |
- name: Deploy to Maven Central | |
if: steps.buildVariables.outputs.SHOULD_DEPLOY_MAVEN_CENTRAL == 'true' | |
run: mvn -B -DskipTests deploy -Drevision=${{ steps.buildVariables.outputs.newVersion }} -Dchangelist=${{ steps.buildVariables.outputs.versionChangelist }} -Dsha1=${{ github.sha }} -DdeployAtEnd=true --file "$POM_PATH" -P ci-cd -P deploy-to-maven-central | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_OSSRH_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_BUILDER_PASSPHRASE }} | |
update-genexus-dependency: | |
concurrency: | |
group: build-${{ github.ref }} | |
cancel-in-progress: true | |
uses: genexuslabs/build-genexus-reusable-workflow/.github/workflows/update-genexus-dep-version.yml@main | |
needs: build | |
if: github.repository_owner == 'genexuslabs' && needs.build.outputs.SHOULD_DEPLOY == 'true' | |
with: | |
VERSION: ${{ needs.build.outputs.MAVEN_VERSION }} | |
PACKAGE_NAMES: ${{ needs.build.outputs.PACKAGES_NAME }} | |
COMMIT_MESSAGE: ${{ needs.build.outputs.COMMIT_MESSAGE }} | |
COMMITTER: ${{ needs.build.outputs.LAST_COMMITTER }} | |
secrets: inherit |