Skip to content

Commit

Permalink
ci(github): Revert to running funTests in a GitHub action container
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Apr 17, 2024
1 parent edf431a commit a8a5245
Showing 1 changed file with 23 additions and 26 deletions.
49 changes: 23 additions & 26 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dkotest.assertions.multi-line-diff=unified
REGISTRY: ghcr.io
TEST_IMAGE_TAG: ort:test

jobs:
build:
Expand Down Expand Up @@ -116,13 +115,14 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: funTest-non-docker
funTest-docker:
funTest-docker-build:
runs-on: ubuntu-22.04
outputs:
# Map a step output to a job output.
test_image_tag: ${{ steps.final.outputs.test_image_tag }}
steps:
- name: Checkout Repository
- name: Checkout Actions
uses: actions/checkout@v4
with:
submodules: recursive
- name: Free Disk Space
uses: ./.github/actions/free-disk-space
- name: Set up Docker Buildx
Expand All @@ -131,32 +131,29 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ${{ env.TEST_IMAGE_TAG }}
push: true
tags: ort:run-${{ github.run_id }}
target: all-tools
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:cache
- name: Setup Gradle
- name: Set step output
id: final
run: echo "test_image_tag=ort:run-${{ github.run_id }}" >> "$GITHUB_OUTPUT"
funTest-docker:
needs: funTest-docker-build
runs-on: ubuntu-22.04
container:
image: ${{ needs.funTest-docker-build.outputs.test_image_tag }}
options: --user 1001
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run functional tests that do require external tools
uses: gradle/actions/setup-gradle@v3
with:
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 \
-v ${{ github.workspace }}:/workspace \
-v /home/runner/.gradle:/home/ort/.gradle \
-w /workspace \
--entrypoint=/bin/sh \
${{ 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 }}
arguments: --scan -Ptests.include=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport
- name: Upload code coverage data
uses: codecov/codecov-action@v4
with:
Expand Down

0 comments on commit a8a5245

Please sign in to comment.