Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Escape dependency jar lock file's name (#77) #79

Merged
merged 2 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ubuntu-22.04, windows-2022]
runs-on: ${{ matrix.os }}
permissions:
actions: write
contents: read

steps:
- name: Change Gradle user home
shell: bash
if: ${{ startsWith(matrix.os, 'windows') }}
run: |
GRADLE_USER_HOME=${RUNNER_TEMP}\.gradle
mkdir -p "${GRADLE_USER_HOME}"
echo "GRADLE_USER_HOME=${GRADLE_USER_HOME}" >> ${GITHUB_ENV}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up JDK
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
Expand Down Expand Up @@ -59,17 +69,18 @@ jobs:
JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_PASSWORD: '${{ secrets.JUNIT5_ROBOLECTRIC_EXTENSION_GPG_SIGNING_PASSWORD }}'
- name: Upload unit test report
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
if: ${{ always() && hashFiles('**/test-results/**/*.xml') != '' }}
with:
name: unit-test-report
name: ${{ matrix.os }}-unit-test-report
path: |
${{ github.workspace }}/**/build/reports/tests
${{ github.workspace }}/**/build/test-results
retention-days: 5
- name: Upload coverage report
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
if: ${{ hashFiles('build/reports/kover/report.xml') != '' }}
if: ${{ always() && hashFiles('build/reports/kover/report.xml') != '' }}
with:
name: kover-report
name: ${{ matrix.os }}-kover-report
path: ${{ github.workspace }}/build/reports/kover/report.xml
retention-days: 5
release:
Expand All @@ -94,7 +105,10 @@ jobs:
GIT_USER_EMAIL: ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
junit:
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022 ]
runs-on: ${{ matrix.os }}
needs:
- build
permissions:
Expand All @@ -106,14 +120,18 @@ jobs:
- name: Download unit test report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: unit-test-report
name: ${{ matrix.os }}-unit-test-report
- name: Comment unit test report
if: ${{ hashFiles('**/test-results/**/*.xml') != '' }}
uses: mikepenz/action-junit-report@db71d41eb79864e25ab0337e395c352e84523afe # v4.3.1
with:
report_paths: '**/test-results/**/*.xml'
check_name: Unit test report (${{ matrix.os }})
kover:
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ ubuntu-22.04, windows-2022 ]
runs-on: ${{ matrix.os }}
needs:
- build
permissions:
Expand All @@ -126,23 +144,23 @@ jobs:
- name: Download coverage report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: kover-report
name: ${{ matrix.os }}-kover-report
- name: Comment branch coverage report to PR
uses: mi-kas/kover-report@5f58465b6f395c8fa3adc2665e27250bad87de50 # v1.9
if: ${{ hashFiles('report.xml') != '' }}
with:
path: ${{ github.workspace }}/report.xml
title: Branch Coverage
title: Branch Coverage (${{ matrix.os }})
update-comment: true
min-coverage-overall: 60
min-coverage-changed-files: 70
coverage-counter-type: BRANCH
- name: Comment line coverage report to PR
- name: Comment line coverage report to PR (${{ matrix.os }})
uses: mi-kas/kover-report@5f58465b6f395c8fa3adc2665e27250bad87de50 # v1.9
if: ${{ hashFiles('report.xml') != '' }}
with:
path: ${{ github.workspace }}/report.xml
title: Line Coverage
title: Line Coverage (${{ matrix.os }})
update-comment: true
min-coverage-overall: 60
min-coverage-changed-files: 70
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ internal class JUnit5MavenDependencyResolver private constructor(
}

private fun createLockFile(dependencyJar: DependencyJar): File {
return File(System.getProperty("user.home"), "${dependencyJar.shortName}.lock")
val lockFileName = dependencyJar.shortName.replace(SPECIAL_CHARACTERS_IN_FILE_NAME_REGEX.toRegex(), "_")
return File(System.getProperty("user.home"), "$lockFileName.lock")
}

@Suppress("NestedBlockDepth")
Expand All @@ -83,4 +84,8 @@ internal class JUnit5MavenDependencyResolver private constructor(
lockFile.delete()
}
}

private companion object {
private const val SPECIAL_CHARACTERS_IN_FILE_NAME_REGEX = """[<>:"\\/|\?\*]"""
}
}