Skip to content

Commit

Permalink
GitHub action dat 15968 (#83)
Browse files Browse the repository at this point in the history
* chore(sonar-test-scan.yml): update Maven commands in Sonar test scan workflow

- Change the Maven command from "mvn -B verify -P '!run-proguard' -DskipITs -Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT" to "mvn -B package -P 'sonar,!run-proguard' -DskipTests -Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT" to only package the project and exclude running tests.
- Update the Maven command in the "run" step from "mvn -B verify sonar:sonar -P '!run-proguard' -DskipTests -Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT" to "mvn -B sonar:sonar -P 'sonar,!run-proguard' -DskipTests -Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT" to only run Sonar analysis and exclude running tests.

These changes improve the efficiency of the Sonar test scan workflow by skipping unnecessary steps and focusing on the required tasks.

* fix(sonar-test-scan.yml): remove unnecessary argument '--classfiles' from jacococli.jar command

The '--classfiles' argument is not needed in the jacococli.jar command as it is already configured to use the correct class files directory. Removing this argument improves the clarity and simplicity of the command.

* chore(sonar-test-scan.yml): generate dump classes during the Sonar test scan to improve code coverage accuracy
chore(sonar-test-scan.yml): update jacococli.jar command to include classfiles path for code coverage report generation

* chore(sonar-test-scan.yml): add lt -ltr command to list files in the target directory after jacoco report generation

* refactor(sonar-test-scan.yml): improve file path handling for jacoco.exec files
feat(sonar-test-scan.yml): add support for dynamic module name for jacoco.exec file paths

* fix(sonar-test-scan.yml): update jacococli.jar path to match the location of the tested classes module

* chore(sonar-test-scan.yml): remove unnecessary mkdir command to improve build process efficiency
chore(sonar-test-scan.yml): add ls commands to debug build process and check file structure before and after jacoco merge

* chore(sonar-test-scan.yml): update jacoco unzip command to use quiet mode for less verbose output
chore(sonar-test-scan.yml): remove unnecessary 'lt' command from jacoco report step

* chore(sonar-test-scan.yml): remove unnecessary ls commands to improve readability and reduce noise in the workflow
chore(sonar-test-scan.yml): update jacoco version to v0.8.10 to ensure compatibility with the latest release
chore(sonar-test-scan.yml): update jacoco file paths to match the new jacoco version and project structure

* chore(sonar-test-scan.yml): add command to list files in the target directory for debugging purposes

* chore(sonar-test-scan.yml): add working directory configuration to Sonar test scan jobs

The working directory configuration is added to the Sonar test scan jobs in the `.github/workflows/sonar-test-scan.yml` file. This allows the jobs to run in the specified directory, which is determined by the `testedClassesModuleName` input.

* chore(create-release.yml): update sonar-push.yml version to v0.4.4 for better compatibility and bug fixes
chore(extension-attach-artifact-release.yml): update get_draft_release.sh, sign_artifact.sh, and upload_asset.sh versions to v0.4.4 for better compatibility and bug fixes
chore(extension-release-published.yml): update extension-release-prepare.yml version to v0.4.4 for better compatibility and bug fixes
chore(os-extension-test.yml): update sonar-pull-request.yml version to v0.4.4 for better compatibility and bug fixes
chore(package-deb.yml): update package-deb-pom.xml and related scripts versions to v0.4.4 for better compatibility and bug fixes
chore(pom-release-published.yml): update extension-release-prepare.yml version to v0.4.4 for better compatibility and bug fixes
chore(pro-extension-test.yml): update sonar-pull-request.yml version to v0.4.4 for better compatibility and bug fixes
chore(sonar-test-scan.yml): remove unnecessary ls command and improve code readability
  • Loading branch information
jandroav authored Sep 26, 2023
1 parent 5416260 commit 3614bf0
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
sonar:
uses: liquibase/build-logic/.github/workflows/[email protected].3
uses: liquibase/build-logic/.github/workflows/[email protected].4
secrets: inherit

create-release:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/extension-attach-artifact-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:

- name: Get Reusable Script Files
run: |
curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.3/.github/get_draft_release.sh
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.3/.github/sign_artifact.sh
curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.3/.github/upload_asset.sh
curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.4/.github/get_draft_release.sh
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.4/.github/sign_artifact.sh
curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.4/.github/upload_asset.sh
chmod +x $PWD/.github/get_draft_release.sh
chmod +x $PWD/.github/sign_artifact.sh
chmod +x $PWD/.github/upload_asset.sh
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
- name: Get upload_zip.sh Script File
if: inputs.zip == 'true'
run: |
curl -o $PWD/.github/upload_zip.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.3/.github/upload_zip.sh
curl -o $PWD/.github/upload_zip.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.4/.github/upload_zip.sh
chmod +x $PWD/.github/upload_zip.sh
- name: Attach Zip File to Draft Release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/extension-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ jobs:
maven-release:
needs: release
uses: liquibase/build-logic/.github/workflows/[email protected].3
uses: liquibase/build-logic/.github/workflows/[email protected].4
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/os-extension-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ jobs:
sonar-pr:
needs: [ unit-test ]
uses: liquibase/build-logic/.github/workflows/[email protected].3
uses: liquibase/build-logic/.github/workflows/[email protected].4
secrets: inherit
8 changes: 4 additions & 4 deletions .github/workflows/package-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ jobs:
# Under the src folder is where specific packages files live. The GitHub action inputs will modify the universal package-deb-pom.xml to tell the process which assets to use during the packaging step
mkdir -p $PWD/.github/src/${{ inputs.artifactId }}/deb/control
mkdir -p $PWD/.github/src/${{ inputs.artifactId }}/main/archive
curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/control https://raw.githubusercontent.com/liquibase/build-logic/v0.4.3/src/${{ inputs.artifactId }}/deb/control/control
curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/postinst https://raw.githubusercontent.com/liquibase/build-logic/v0.4.3/src/${{ inputs.artifactId }}/deb/control/postinst
curl -o $PWD/.github/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.3/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh
curl -o $PWD/.github/package-deb-pom.xml https://raw.githubusercontent.com/liquibase/build-logic/v0.4.3/.github/package-deb-pom.xml
curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/control https://raw.githubusercontent.com/liquibase/build-logic/v0.4.4/src/${{ inputs.artifactId }}/deb/control/control
curl -o $PWD/.github/src/${{ inputs.artifactId }}/deb/control/postinst https://raw.githubusercontent.com/liquibase/build-logic/v0.4.4/src/${{ inputs.artifactId }}/deb/control/postinst
curl -o $PWD/.github/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.4/src/${{ inputs.artifactId }}/main/archive/${{ inputs.artifactId }}-env.sh
curl -o $PWD/.github/package-deb-pom.xml https://raw.githubusercontent.com/liquibase/build-logic/v0.4.4/.github/package-deb-pom.xml
- name: Set up Maven
uses: stCarolas/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pom-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ jobs:
maven-release:
needs: release
uses: liquibase/build-logic/.github/workflows/[email protected].3
uses: liquibase/build-logic/.github/workflows/[email protected].4
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/pro-extension-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,5 @@ jobs:
sonar-pr:
needs: [ unit-test ]
uses: liquibase/build-logic/.github/workflows/[email protected].3
uses: liquibase/build-logic/.github/workflows/[email protected].4
secrets: inherit
43 changes: 24 additions & 19 deletions .github/workflows/sonar-test-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,46 +195,49 @@ jobs:
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Generate dump classes
run: |
mvn -B clean install surefire-report:report -P 'sonar,!run-proguard' "-Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT"
working-directory: ./${{ inputs.testedClassesModuleName }}

- name: Merge integration and unit tests reports
if: always()
run: |
mkdir ./liquibase-coverage/target
mv unit-tests/jacoco.exec ./liquibase-coverage/target/jacoco-unit.exec
mv unit-tests/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-unit.exec
if [ -d "integration-tests/mssql" ]; then
mv integration-tests/mssql/jacoco.exec ./liquibase-coverage/target/jacoco-mssql-aggregate.exec
mv integration-tests/mssql/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-mssql-aggregate.exec
fi
if [ -d "integration-tests/mysql" ]; then
mv integration-tests/mysql/jacoco.exec ./liquibase-coverage/target/jacoco-mysql-aggregate.exec
mv integration-tests/mysql/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-mysql-aggregate.exec
fi
if [ -d "integration-tests/oracle" ]; then
mv integration-tests/oracle/jacoco.exec ./liquibase-coverage/target/jacoco-oracle-aggregate.exec
mv integration-tests/oracle/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-oracle-aggregate.exec
fi
if [ -d "integration-tests/postgresql" ]; then
mv integration-tests/postgresql/jacoco.exec ./liquibase-coverage/target/jacoco-postgresql-aggregate.exec
mv integration-tests/postgresql/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-postgresql-aggregate.exec
fi
if [ -d "integration-tests/h2" ]; then
mv integration-tests/h2/jacoco.exec ./liquibase-coverage/target/jacoco-h2-aggregate.exec
mv integration-tests/h2/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-h2-aggregate.exec
fi
if [ -d "integration-tests/hsqldb" ]; then
mv integration-tests/hsqldb/jacoco.exec ./liquibase-coverage/target/jacoco-hsqldb-aggregate.exec
mv integration-tests/hsqldb/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-hsqldb-aggregate.exec
fi
if [ -d "integration-tests/mariadb" ]; then
mv integration-tests/mariadb/jacoco.exec ./liquibase-coverage/target/jacoco-mariadb-aggregate.exec
mv integration-tests/mariadb/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-mariadb-aggregate.exec
fi
if [ -d "integration-tests/sqlite" ]; then
mv integration-tests/sqlite/jacoco.exec ./liquibase-coverage/target/jacoco-sqlite-aggregate.exec
mv integration-tests/sqlite/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-sqlite-aggregate.exec
fi
if [ -d "integration-tests/firebird" ]; then
mv integration-tests/firebird/jacoco.exec ./liquibase-coverage/target/jacoco-firebird-aggregate.exec
mv integration-tests/firebird/jacoco.exec ./${{ inputs.testedClassesModuleName }}/target/jacoco-firebird-aggregate.exec
fi
mvn -B verify -P '!run-proguard' -DskipITs -Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT
wget -q https://github.com/jacoco/jacoco/releases/download/v0.8.10/jacoco-0.8.10.zip
unzip ./jacoco-0.8.10.zip
mv ./lib/jacococli.jar ./liquibase-coverage/target/jacococli.jar
chmod +x ./liquibase-coverage/target/jacococli.jar
cd liquibase-coverage
unzip -qq ./jacoco-0.8.10.zip
mv ./lib/jacococli.jar ./${{ inputs.testedClassesModuleName }}/target/jacococli.jar
chmod +x ./${{ inputs.testedClassesModuleName }}/target/jacococli.jar
cd ./${{ inputs.testedClassesModuleName }}
mvn jacoco:merge@cli-merge-results
cd ./target
java -jar jacococli.jar report aggregate.exec --classfiles=../../${{ inputs.testedClassesModuleName }}/target/classdumps
Expand All @@ -245,8 +248,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.PRO_LICENSE_KEY }}
working-directory: ./${{ inputs.testedClassesModuleName }}
run: |
mvn -B verify sonar:sonar -P '!run-proguard' -DskipTests -Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT \
mvn -B sonar:sonar -P 'sonar,!run-proguard' -DskipTests -Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT \
${{ inputs.mavenArgs }} \
-Dsonar.scm.revision=${{ inputs.thisSha }} \
-Dsonar.token=$SONAR_TOKEN \
Expand All @@ -264,8 +268,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.PRO_LICENSE_KEY }}
working-directory: ./${{ inputs.testedClassesModuleName }}
run: |
mvn -B verify sonar:sonar -P '!run-proguard' -DskipTests -Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT \
mvn -B sonar:sonar -P 'sonar,!run-proguard' -DskipTests -Dliquibase.version=${{ inputs.liquibaseBranchName }}-SNAPSHOT \
${{ inputs.mavenArgs }} \
-Dsonar.scm.revision=${{ inputs.thisSha }} \
-Dsonar.token=$SONAR_TOKEN \
Expand Down

0 comments on commit 3614bf0

Please sign in to comment.