Improve finding tests (1) (#1420)
This commit is contained in:
@@ -3,14 +3,26 @@ description: maven-build-with-dry-run-for-tests
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: maven-build-with-dry-run-for-tests
|
||||
|
||||
- name: run 'package' on the project
|
||||
shell: bash
|
||||
run: |
|
||||
# find all the tests that are supposed to be run, but don't actually run them.
|
||||
# this is achieved via: 'spring.cloud.k8s.skip.tests=true' in DisabledTestsCondition
|
||||
./mvnw test -B -Dskip.build.image=true -Dspring.cloud.k8s.skip.tests=true \
|
||||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=error \
|
||||
-T 1C -q > /tmp/tests.txt
|
||||
./mvnw install -B \
|
||||
-Dskip.build.image=true \
|
||||
-DskipTests -DskipITs \
|
||||
-T 1C -q
|
||||
|
||||
- name: find all classpath entries
|
||||
shell: bash
|
||||
run: |
|
||||
./mvnw -q exec:exec -Dexec.classpathScope="test" -Dexec.executable="echo" -Dexec.args="%classpath" | tr : "\n" > /tmp/deps.txt
|
||||
|
||||
- name: find all tests
|
||||
shell: bash
|
||||
run: |
|
||||
cd spring-cloud-kubernetes-test-support
|
||||
.././mvnw -q exec:java -Dexec.mainClass="org.springframework.cloud.kubernetes.tests.discovery.TestsDiscovery" > /tmp/tests.txt
|
||||
cd ..
|
||||
|
||||
- name: show result
|
||||
if: always()
|
||||
|
||||
@@ -8,8 +8,8 @@ runs:
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: /tmp/sorted.txt
|
||||
key: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-${{ github.run_id }}
|
||||
restore-keys: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-
|
||||
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
|
||||
restore-keys: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-
|
||||
|
||||
- name: show cached test times
|
||||
shell: bash
|
||||
@@ -138,7 +138,7 @@ runs:
|
||||
# the previous cache will contain more tests then we currently have, so some
|
||||
# matrix instances will have no tests to run
|
||||
if [[ "$sum" -eq "0" ]]; then
|
||||
echo "no tests to run in current index, most probably this PR removed some tests"
|
||||
echo "no tests (with known times) to run in current index"
|
||||
tests_to_run_in_current_index='none'
|
||||
fi
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ runs:
|
||||
|
||||
# save with the current run_id, but restore it without it. This means two things:
|
||||
# 1) if we re-run, cache will be available
|
||||
# 2) if there is a new run, we restore as '${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-'
|
||||
# 2) if there is a new run, we restore as '${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-'
|
||||
# meaning there could be many of them already present and this is not an exact match
|
||||
# github in this case will pick up the latest one, exactly what we want.
|
||||
- name: save test times in cache
|
||||
@@ -55,4 +55,4 @@ runs:
|
||||
if: env.BASE_BRANCH != '2.1.x'
|
||||
with:
|
||||
path: /tmp/sorted.txt
|
||||
key: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-${{ github.run_id }}
|
||||
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
|
||||
|
||||
4
.github/workflows/maven.yaml
vendored
4
.github/workflows/maven.yaml
vendored
@@ -67,8 +67,8 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: /tmp/sorted.txt
|
||||
key: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-${{ github.run_id }}
|
||||
restore-keys: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-
|
||||
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
|
||||
restore-keys: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-
|
||||
|
||||
- name: check test times cache exists
|
||||
id: check_files
|
||||
|
||||
Reference in New Issue
Block a user