Skip to content

Commit

Permalink
Build with JDK5 and deploy from GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Godin committed Apr 9, 2024
1 parent 337c80f commit 4e7caa2
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 38 deletions.
18 changes: 3 additions & 15 deletions .azure-pipelines/azure-pipelines.yml
Expand Up @@ -87,21 +87,9 @@ jobs:
else
export JAVA_HOME=$JAVA_HOME_17_X64
fi
if [[ "$BUILD_SOURCEBRANCH" == "refs/heads/master" && "$JDK_VERSION" == "5" ]]; then
.maven/bin/mvn -V -B -e --no-transfer-progress -f org.jacoco.build \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION \
deploy:deploy -DdeployAtEnd \
--toolchains=toolchains.xml --settings=.azure-pipelines/maven-settings.xml
elif [[ "$BUILD_SOURCEBRANCH" == "refs/heads/master" && "$JDK_VERSION" == "11" ]]; then
.maven/bin/mvn -V -B -e --no-transfer-progress -f org.jacoco.build \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION \
sonar:sonar \
--toolchains=toolchains.xml --settings=.azure-pipelines/maven-settings.xml
else
.maven/bin/mvn -V -B -e --no-transfer-progress \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION -Decj=${ECJ:-} \
--toolchains=toolchains.xml
fi
.maven/bin/mvn -V -B -e --no-transfer-progress \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION -Decj=${ECJ:-} \
--toolchains=toolchains.xml
displayName: Build
env:
SONARQUBE_TOKEN: $(SONARQUBE_TOKEN)
Expand Down
23 changes: 0 additions & 23 deletions .azure-pipelines/maven-settings.xml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -46,6 +46,72 @@ jobs:
mvn -V -B -e --no-transfer-progress \
verify -Djdk.version=${{ matrix.jdk }} -Dbytecode.version=${{ matrix.jdk }} \
--toolchains=toolchains.xml
JDK5:
name: JDK 5
runs-on: ubuntu-20.04
# TODO repository and ref
environment: ${{ (github.repository == 'jacoco/jacoco' && github.ref == 'refs/heads/master') && 'snapshot' || null }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: Godin/github-action-setup-java/setup-java@main
with:
version: 5
- uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: 'zulu'
java-version: |
17
server-id: sonatype-nexus-snapshots
server-username: SONATYPE_USERNAME
server-password: SONATYPE_PASSWORD
- name: 'Generate toolchains.xml'
env:
JDK_VERSION: 5
JDK_HOME_VARIABLE_NAME: JAVA_HOME_5_X64
run: |
echo "
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<id>$JDK_VERSION</id>
<version>$JDK_VERSION</version>
</provides>
<configuration>
<jdkHome>${!JDK_HOME_VARIABLE_NAME}</jdkHome>
</configuration>
</toolchain>
</toolchains>
" > toolchains.xml
- name: 'Build'
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
run: |
if [[ "$GITHUB_REPOSITORY" == "jacoco/jacoco" && "$GITHUB_REF" == "refs/heads/master" ]]; then
mvn -V -B -e --no-transfer-progress \
verify -Djdk.version=5 -Dbytecode.version=5 \
-f org.jacoco.build \
deploy:deploy -DdeployAtEnd \
sonar:sonar -Dsonar.organization=default -Dsonar.host.url=https://sonarcloud.io \
--toolchains=toolchains.xml
else
mvn -V -B -e --no-transfer-progress \
verify -Djdk.version=5 -Dbytecode.version=5 \
--toolchains=toolchains.xml
fi
- name: 'Trigger deployments of sites'
if: ${{ (github.repository == 'jacoco/jacoco' && github.ref == 'refs/heads/master') }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
github.rest.repos.createDispatchEvent({
owner: 'jacoco',
repo: 'www.eclemma.org',
event_type: "JaCoCo build",
})
Windows:
runs-on: windows-2022
steps:
Expand Down

0 comments on commit 4e7caa2

Please sign in to comment.