From 19acfef6f64cc17ddc755297d20275afa5cad348 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Mon, 22 Apr 2024 21:05:03 +0200 Subject: [PATCH] ci(github): Run Docker as the GitHub user to simplify code Signed-off-by: Sebastian Schuberth --- .github/workflows/build-and-test.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 9a3f9e6543261..ccb1dbd75ad39 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -146,22 +146,15 @@ jobs: gradle-home-cache-cleanup: true - name: Run functional tests that do require external tools run: | - # Change the ownership of the Gradle user home and the workspace to the user in the Docker container. - sudo chown -R 1000:1000 /home/runner/.gradle - sudo chown -R 1000:1000 ${{ github.workspace }} - # Run the functional tests in the Docker container. docker run \ + -u $(id -u):$(id -g) \ + -v /home/runner:/home/runner \ -v ${{ github.workspace }}:/workspace \ - -v /home/runner/.gradle:/home/ort/.gradle \ -w /workspace \ - --entrypoint=/bin/sh \ + -e GRADLE_USER_HOME=/home/runner/.gradle \ ${{ env.TEST_IMAGE_TAG }} \ - -c "GRADLE_USER_HOME=/home/ort/.gradle ./gradlew --scan -Ptests.include=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport" - - # Change the ownership of the Gradle user home and the workspace back to the user in the GitHub Actions runner. - sudo chown -R 1001:121 /home/runner/.gradle - sudo chown -R 1001:121 ${{ github.workspace }} + -c "./gradlew --scan -Ptests.include=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport" - name: Upload code coverage data uses: codecov/codecov-action@v4 with: