Update build scripts to use BUILD_CLI_DIST_ONLY
This commit is contained in:
34
.ci/build.sh
34
.ci/build.sh
@ -107,7 +107,7 @@ function build() {
|
||||
pmd_ci_log_group_end
|
||||
|
||||
# release is published only for the case b) pmd-cli/pmd-dist release
|
||||
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" == *-dist ]]; then
|
||||
if pmd_ci_maven_isReleaseBuild && [ "${BUILD_CLI_DIST_ONLY}" = "true" ]; then
|
||||
pmd_ci_log_group_start "Publishing Release"
|
||||
pmd_ci_gh_releases_publishRelease "$GH_RELEASE"
|
||||
pmd_ci_sourceforge_selectDefault "${PMD_CI_MAVEN_PROJECT_VERSION}"
|
||||
@ -117,7 +117,7 @@ function build() {
|
||||
|
||||
# create a baseline for snapshot builds (when pmd-dist is built)
|
||||
# or for release builds for case b) when pmd-cli/pmd-dist is released
|
||||
if pmd_ci_maven_isSnapshotBuild || [[ "${PMD_CI_TAG}" == *-dist ]]; then
|
||||
if pmd_ci_maven_isSnapshotBuild || [ "${BUILD_CLI_DIST_ONLY}" = "true" ]; then
|
||||
pmd_ci_log_group_start "Creating new baseline for regression tester"
|
||||
regression_tester_setup_ci
|
||||
regression_tester_uploadBaseline
|
||||
@ -141,7 +141,7 @@ function build() {
|
||||
-Dpmd.skip \
|
||||
--show-version --errors --batch-mode \
|
||||
clean package \
|
||||
sonar:sonar -Dsonar.login="${SONAR_TOKEN}" -Psonar,cli-dist
|
||||
sonar:sonar -Dsonar.login="${SONAR_TOKEN}" -Psonar
|
||||
pmd_ci_log_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
|
||||
pmd_ci_log_group_end
|
||||
|
||||
@ -157,7 +157,7 @@ function build() {
|
||||
-DrepoToken="${COVERALLS_REPO_TOKEN}" \
|
||||
--show-version --errors --batch-mode \
|
||||
clean package jacoco:report \
|
||||
coveralls:report -Pcoveralls,cli-dist
|
||||
coveralls:report -Pcoveralls
|
||||
pmd_ci_log_success "New coveralls result: https://coveralls.io/github/pmd/pmd"
|
||||
pmd_ci_log_group_end
|
||||
fi
|
||||
@ -185,16 +185,16 @@ function pmd_ci_build_run() {
|
||||
mvn_profiles="${mvn_profiles},pmd-release"
|
||||
|
||||
# There are two possible (release) builds:
|
||||
if [[ "${PMD_CI_TAG}" != *-dist ]]; then
|
||||
# a) pmd-core and languages modules
|
||||
./mvnw clean deploy -P"${mvn_profiles}",'!cli-dist' --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
|
||||
if [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
|
||||
# a) everything without pmd-cli and pmd-dist
|
||||
./mvnw clean deploy -P"${mvn_profiles}" -Dskip-cli-dist --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
|
||||
else
|
||||
# b) pmd-cli and pmd-dist
|
||||
./mvnw clean deploy -P"${mvn_profiles},cli-dist" -pl pmd-cli,pmd-dist --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
|
||||
# b) only pmd-cli and pmd-dist
|
||||
./mvnw clean deploy -P"${mvn_profiles}" -pl pmd-cli,pmd-dist --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
|
||||
fi
|
||||
else
|
||||
pmd_ci_log_info "This is a snapshot build"
|
||||
./mvnw clean deploy -P"${mvn_profiles},cli-dist" --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
|
||||
./mvnw clean deploy -P"${mvn_profiles}" --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
|
||||
fi
|
||||
|
||||
}
|
||||
@ -214,15 +214,15 @@ function pmd_ci_deploy_build_artifacts() {
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
|
||||
fi
|
||||
|
||||
# release build case a): only pmd-core and language modules released
|
||||
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" != *-dist ]]; then
|
||||
# release build case a): everything without pmd-cli and pmd-dist is released
|
||||
if pmd_ci_maven_isReleaseBuild && [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
|
||||
# create a draft github release
|
||||
pmd_ci_gh_releases_createDraftRelease "${PMD_CI_TAG}" "$(git rev-list -n 1 "${PMD_CI_TAG}")"
|
||||
GH_RELEASE="$RESULT"
|
||||
fi
|
||||
|
||||
# release build case b): pmd-cli and pmd-dist are released
|
||||
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" == *-dist ]]; then
|
||||
# release build case b): only pmd-cli and pmd-dist are released
|
||||
if pmd_ci_maven_isReleaseBuild && [ "${BUILD_CLI_DIST_ONLY}" = "true" ]; then
|
||||
# Deploy to sourceforge files https://sourceforge.net/projects/pmd/files/pmd/
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-bin.zip"
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-src.zip"
|
||||
@ -254,7 +254,7 @@ function pmd_ci_build_and_upload_doc() {
|
||||
pmd_doc_create_archive
|
||||
|
||||
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "docs/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-doc.zip"
|
||||
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" != *-dist ]]; then
|
||||
if pmd_ci_maven_isReleaseBuild && [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
|
||||
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "docs/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-doc.zip"
|
||||
fi
|
||||
|
||||
@ -263,7 +263,7 @@ function pmd_ci_build_and_upload_doc() {
|
||||
# Deploy javadoc to https://docs.pmd-code.org/apidocs/*/${PMD_CI_MAVEN_PROJECT_VERSION}/
|
||||
pmd_code_uploadJavadoc "${PMD_CI_MAVEN_PROJECT_VERSION}" "$(pwd)"
|
||||
|
||||
if pmd_ci_maven_isSnapshotBuild || [[ "${PMD_CI_TAG}" != *-dist ]]; then
|
||||
if pmd_ci_maven_isSnapshotBuild || [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
|
||||
# render release notes
|
||||
# updating github release text
|
||||
rm -f .bundle/config
|
||||
@ -289,7 +289,7 @@ function pmd_ci_build_and_upload_doc() {
|
||||
pmd_ci_sourceforge_rsyncSnapshotDocumentation "${PMD_CI_MAVEN_PROJECT_VERSION}" "snapshot"
|
||||
fi
|
||||
|
||||
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" != *-dist ]]; then
|
||||
if pmd_ci_maven_isReleaseBuild && [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
|
||||
# documentation is already uploaded to https://docs.pmd-code.org/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
|
||||
# we only need to setup symlinks for the released version
|
||||
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "latest"
|
||||
|
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@ -14,6 +14,12 @@ on:
|
||||
# build it monthly: At 04:00 on day-of-month 1.
|
||||
- cron: '0 4 1 * *'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_cli_dist_only:
|
||||
description: "Build only modules cli and dist"
|
||||
required: true
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
@ -68,6 +74,7 @@ jobs:
|
||||
run: .ci/build.sh
|
||||
shell: bash
|
||||
env:
|
||||
BUILD_CLI_DIST_ONLY: ${{ inputs.build_cli_dist_only }}
|
||||
PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Workaround actions/upload-artifact#176
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# abort the script on the first failing sub command
|
||||
set -e
|
||||
|
||||
# Make sure, everything is English...
|
||||
@ -165,13 +167,32 @@ git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
|
||||
fi
|
||||
)
|
||||
|
||||
./mvnw -B release:clean release:prepare \
|
||||
-Dtag="pmd_releases/${RELEASE_VERSION}" \
|
||||
-DreleaseVersion="${RELEASE_VERSION}" \
|
||||
-DdevelopmentVersion="${DEVELOPMENT_VERSION}" \
|
||||
-DscmCommentPrefix="[release] " \
|
||||
-Darguments='-Pgenerate-rule-docs,!cli-dist' \
|
||||
'-Pgenerate-rule-docs,!cli-dist'
|
||||
# check that there are no uncommitted changes
|
||||
UNCOMMITTED_CHANGES=$(git status --short --untracked-files=no)
|
||||
if [ -n "${UNCOMMITTED_CHANGES}" ]; then
|
||||
echo "There are uncommitted changes:"
|
||||
echo "${UNCOMMITTED_CHANGES}"
|
||||
exit 1
|
||||
fi
|
||||
# check that there are no SNAPSHOT dependencies -> done by the enforcer plugin, see enforce-no-snapshots
|
||||
echo "Change version in the POMs to ${RELEASE_VERSION} and update build timestamp"
|
||||
./mvnw --quiet versions:set -DnewVersion="${RELEASE_VERSION}" -DgenerateBackupPoms=false -DupdateBuildOutputTimestampPolicy=always
|
||||
echo "Transform the SCM information in the POM"
|
||||
sed -i "s|<tag>.\+</tag>|<tag>pmd_releases/${RELEASE_VERSION}</tag>|" pom.xml
|
||||
echo "Run the project tests against the changed POMs to confirm everything is in running order (skipping cli and dist)"
|
||||
./mvnw clean verify -Dskip-cli-dist -Pgenerate-rule-docs
|
||||
echo "Commit and create tag"
|
||||
git commit -a -m "[release] prepare release pmd_releases/${RELEASE_VERSION}"
|
||||
git tag -m "[release] copy for tag pmd_releases/${RELEASE_VERSION}" "pmd_releases/${RELEASE_VERSION}"
|
||||
echo "Update POMs to set the new development version ${DEVELOPMENT_VERSION}"
|
||||
./mvnw --quiet versions:set -DnewVersion="${DEVELOPMENT_VERSION}" -DgenerateBackupPoms=false -DupdateBuildOutputTimestampPolicy=never
|
||||
sed -i "s|<tag>.\+</tag>|<tag>HEAD</tag>|" pom.xml
|
||||
echo "Commit"
|
||||
git commit -a -m "[release] prepare for next development iteration"
|
||||
echo "Push branch and tag pmd_releases/${RELEASE_VERSION}"
|
||||
git push origin "${CURRENT_BRANCH}"
|
||||
git push origin tag "pmd_releases/${RELEASE_VERSION}"
|
||||
|
||||
|
||||
echo
|
||||
echo "Tag has been pushed.... now check github actions: <https://github.com/pmd/pmd/actions>"
|
||||
@ -232,9 +253,8 @@ This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
EOF
|
||||
|
||||
git commit -a -m "Prepare next development version [skip ci]"
|
||||
git commit -a -m "[release] Prepare next development version [skip ci]"
|
||||
git push origin "${CURRENT_BRANCH}"
|
||||
./mvnw -B release:clean
|
||||
|
||||
echo
|
||||
echo
|
||||
@ -248,28 +268,19 @@ echo "<https://github.com/pmd/pmd-designer/blob/master/releasing.md>"
|
||||
echo
|
||||
echo "Press enter to continue when pmd-designer is available in maven-central..."
|
||||
echo "<https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd-ui/maven-metadata.xml>."
|
||||
echo
|
||||
echo "Note: If there is no new pmd-designer release needed, you can directly proceed."
|
||||
read -r
|
||||
|
||||
echo
|
||||
echo "Continuing with release of pmd-cli and pmd-dist..."
|
||||
git checkout "pmd_releases/${RELEASE_VERSION}"
|
||||
./mvnw versions:update-parent -DparentVersion="${RELEASE_VERSION}" -DskipResolution=true -DgenerateBackupPoms=false -pl pmd-cli,pmd-dist
|
||||
git add pmd-cli/pom.xml pmd-dist/pom.xml
|
||||
git commit -m "[release] prepare release pmd_releases/${RELEASE_VERSION}-dist"
|
||||
git tag -m "[release] copy for tag pmd_releases/${RELEASE_VERSION}-dist" "pmd_releases/${RELEASE_VERSION}-dist"
|
||||
git push origin tag "pmd_releases/${RELEASE_VERSION}-dist"
|
||||
git checkout master
|
||||
# make sure parent reference is correct
|
||||
./mvnw versions:update-parent -DparentVersion="${DEVELOPMENT_VERSION}" -DskipResolution=true -DgenerateBackupPoms=false -pl pmd-cli,pmd-dist
|
||||
git add pmd-cli/pom.xml pmd-dist/pom.xml
|
||||
changes=$(git status --porcelain 2>/dev/null | grep -c -E "^[AMDRC]" || true)
|
||||
if [ "$changes" -gt 0 ]; then
|
||||
git commit -m "Prepare next development version [skip ci]"
|
||||
git push origin "${CURRENT_BRANCH}"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Second tag 'pmd_releases/${RELEASE_VERSION}-dist' has been pushed ... now check github actions: <https://github.com/pmd/pmd/actions>"
|
||||
echo "Go to <https://github.com/pmd/pmd/actions/workflows/build.yml> and manually trigger a new build"
|
||||
echo "from tag 'pmd_releases/${RELEASE_VERSION}' and with option 'Build only modules cli and dist' checked."
|
||||
echo
|
||||
echo "This triggers the second stage release and eventually publishes the release on GitHub."
|
||||
echo
|
||||
echo "Now check github actions: <https://github.com/pmd/pmd/actions>"
|
||||
echo
|
||||
echo
|
||||
echo "Verify the new release on github: <https://github.com/pmd/pmd/releases/tag/pmd_releases/${RELEASE_VERSION}>"
|
||||
@ -297,5 +308,3 @@ echo "------------------------------------------"
|
||||
echo "Done."
|
||||
echo "------------------------------------------"
|
||||
echo
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user