Skip to content

Commit 0f8e986

Browse files
committed
ci(github): Run all tests that require external tools in Docker
Use the more fine-granular (than package-level) `RequiresExternalTool` tag to run all functional tests that require external tools in Docker, and run complementary functional tests in an isolated environment created with Flox, similar to unit tests. Going forward, the plan is to create another Flox environment that only provides the minimal set of required tools, and run functional tests in there instead of / in addition to Docker. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent a23e720 commit 0f8e986

File tree

1 file changed

+10
-26
lines changed

1 file changed

+10
-26
lines changed

.github/workflows/build-and-test.yml

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -88,36 +88,20 @@ jobs:
8888
with:
8989
token: ${{ secrets.CODECOV_TOKEN }}
9090
flags: test-${{ matrix.os }}
91-
funTest-non-docker:
91+
funTest-no-external-tools:
9292
needs: build
9393
runs-on: ubuntu-24.04
9494
steps:
9595
- name: Checkout Repository
9696
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
97-
- name: Set tool version environment variables
98-
run: cat .env.versions >> $GITHUB_ENV
99-
- name: Install required tools
100-
run: |
101-
# Install git-repo.
102-
mkdir -p $HOME/.local/bin
103-
curl https://storage.googleapis.com/git-repo-downloads/repo -o $HOME/.local/bin/repo
104-
chmod a+x $HOME/.local/bin/repo
105-
106-
# Install Askalono for functional tests.
107-
curl -LOs https://github.com/amzn/askalono/releases/download/$ASKALONO_VERSION/askalono-Linux.zip
108-
unzip askalono-Linux.zip -d $HOME/.local/bin
109-
110-
# Install Licensee for functional tests.
111-
echo "gem: --bindir $HOME/.local/bin" > $HOME/.gemrc
112-
gem install --user-install licensee -v $LICENSEE_VERSION
113-
114-
# Install ScanCode for license texts.
115-
curl -Os https://raw.githubusercontent.com/nexB/scancode-toolkit/v$SCANCODE_VERSION/requirements.txt
116-
pipx install --pip-args="--no-cache-dir --constraint requirements.txt" scancode-toolkit==$SCANCODE_VERSION
11797
- name: Setup Gradle
11898
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5
99+
- name: Install Flox
100+
uses: flox/install-flox-action@ba0eb4eb776f1d3b47279d7980f6643caffd8c41 # v2
101+
with:
102+
disable-metrics: true
119103
- name: Run functional tests that do not require external tools
120-
run: ./gradlew --scan -Ptests.exclude=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport
104+
run: env -i "$(which flox)" activate -- ./gradlew --scan -Dkotest.tags=!RequiresExternalTool funTest jacocoFunTestReport
121105
- name: Create Test Summary
122106
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2
123107
with:
@@ -127,8 +111,8 @@ jobs:
127111
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
128112
with:
129113
token: ${{ secrets.CODECOV_TOKEN }}
130-
flags: funTest-non-docker
131-
funTest-docker:
114+
flags: funTest-no-external-tools
115+
funTest-external-tools:
132116
runs-on: ubuntu-24.04
133117
steps:
134118
- name: Checkout Repository
@@ -162,7 +146,7 @@ jobs:
162146
-e HOME=/home/runner \
163147
-e GRADLE_OPTS="$GRADLE_OPTS" \
164148
${{ env.TEST_IMAGE_TAG }} \
165-
-c "./gradlew --scan -Ptests.include=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport"
149+
-c "./gradlew --scan -Dkotest.tags=RequiresExternalTool funTest jacocoFunTestReport"
166150
- name: Create Test Summary
167151
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2
168152
with:
@@ -172,4 +156,4 @@ jobs:
172156
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
173157
with:
174158
token: ${{ secrets.CODECOV_TOKEN }}
175-
flags: funTest-docker
159+
flags: funTest-external-tools

0 commit comments

Comments
 (0)