Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wind57 committed Apr 17, 2024
2 parents d64dd18 + d44edfc commit 2861ea5
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ runs:
steps:

- name: restore test times cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: /tmp/sorted.txt
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
Expand Down Expand Up @@ -117,13 +117,13 @@ runs:
echo "AVERAGE_TIME_PER_INSTANCE=$(echo $average_time_per_instance_json)" >> $GITHUB_ENV
- name: upload test with times
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: tests-with-times-sorted.txt
path: /tmp/tests-with-times-sorted.txt

- name: upload test without times
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: tests-without-times.txt
path: /tmp/tests-without-times.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runs:
run: cat /tmp/tests.txt

- name: upload test
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: tests.txt
path: /tmp/tests.txt
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/composites/pre-test-actions/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ runs:
uses: ./.github/workflows/composites/setup-jdk17
if: env.BASE_BRANCH == 'main'

- name: setup project jdk-8
uses: ./.github/workflows/composites/setup-jdk1.8
if: env.BASE_BRANCH == '2.1.x'

- name: cache local maven repository
uses: ./.github/workflows/composites/cache

Expand All @@ -37,7 +33,7 @@ runs:
uses: ./.github/workflows/composites/build-integration-tests-project

- name: download tests
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: tests.txt
path: /tmp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ runs:
with:
path: |
/tmp/docker/images
key: docker-images-github-cache-${{ hashFiles('**/current-images.txt') }}
- name: print images
shell: bash
run: |
echo 'printing images'
ls /tmp/docker/images
Original file line number Diff line number Diff line change
Expand Up @@ -37,39 +37,17 @@ runs:
TEST_ARG=$(echo ${sliced_array[@]} | sed 's/ /,/g')
echo "$TEST_ARG"
if [[ $baseBranch == "2.1.x" ]]; then
./mvnw -s .settings.xml -pl '-:kubernetes-leader-election-example' -pl '-:kubernetes-hello-world-example' \
-pl '-:kubernetes-reload-example' -pl '-:kubernetes-loadbalancer-example' \
-pl '-:spring-cloud-kubernetes-configserver' -pl '-:spring-cloud-kubernetes-configuration-watcher' \
-pl '-:spring-cloud-kubernetes-discoveryserver' \
-DtestsToRun=${TEST_ARG[@]} \
-e clean install \
-U -P sonar -nsu --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.http.retryHandler.class=standard \
-Dmaven.wagon.http.retryHandler.count=3 \
-Dskip.build.image=true
else
version=$(java -version)
echo "version of java: $version"
./mvnw -s .settings.xml \
-DtestsToRun=${TEST_ARG[@]} \
-DCURRENT_INSTANCE=${CURRENT_INDEX} \
-e clean install \
-P sonar -nsu --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.http.retryHandler.class=standard \
-Dmaven.wagon.http.retryHandler.count=3 \
-Dskip.build.image=true
fi
./mvnw -s .settings.xml \
-DtestsToRun=${TEST_ARG[@]} \
-DCURRENT_INSTANCE=${CURRENT_INDEX} \
-e clean install \
-P sonar -nsu --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.http.retryHandler.class=standard \
-Dmaven.wagon.http.retryHandler.count=3 \
-Dskip.build.image=true
touch /tmp/test_times_${{ env.CURRENT_INDEX }}.txt
Expand All @@ -85,12 +63,10 @@ runs:
- name: show individual test times
shell: bash
if: env.BASE_BRANCH != '2.1.x'
run: cat /tmp/test_times_${{ env.CURRENT_INDEX }}.txt

- name: upload individual tests
if: env.BASE_BRANCH != '2.1.x'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_times_${{ env.CURRENT_INDEX }}.txt
path: /tmp/test_times_${{ env.CURRENT_INDEX }}.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ runs:
steps:

- name: download tests with times
if: env.BASE_BRANCH != '2.1.x'
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: tests-with-times-sorted.txt
path: /tmp/

- name: download tests without times
if: env.BASE_BRANCH != '2.1.x'
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: tests-without-times.txt
path: /tmp/
Expand Down Expand Up @@ -187,12 +185,10 @@ runs:

- name: show individual test times
shell: bash
if: env.BASE_BRANCH != '2.1.x'
run: cat /tmp/test_times_${{ env.CURRENT_INDEX }}.txt

- name: upload individual tests
if: env.BASE_BRANCH != '2.1.x'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_times_${{ env.CURRENT_INDEX }}.txt
path: /tmp/test_times_${{ env.CURRENT_INDEX }}.txt
9 changes: 0 additions & 9 deletions .github/workflows/composites/setup-jdk1.8/action.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/composites/setup-jdk17/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: setup project with jdk-17
runs:
using: "composite"
steps:
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
9 changes: 2 additions & 7 deletions .github/workflows/composites/test-times/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ runs:

# we omit the name, as such all artifacts are downloaded
- name: download all artifacts
if: env.BASE_BRANCH != '2.1.x'
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: /tmp/all-artifacts

- name: show all artifacts
if: env.BASE_BRANCH != '2.1.x'
shell: bash
run: ls -l /tmp/all-artifacts

- name: merge all artifacts into a single file and sort by time
if: env.BASE_BRANCH != '2.1.x'
shell: bash
run: |
arr=($(find /tmp/all-artifacts/ -type f -name "test_times*"))
Expand All @@ -41,7 +38,6 @@ runs:
cat /tmp/sorted.txt
- name: show all tests in a sorted manner
if: env.BASE_BRANCH != '2.1.x'
shell: bash
run: cat /tmp/sorted.txt

Expand All @@ -51,8 +47,7 @@ runs:
# 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
uses: actions/cache/save@v3
if: env.BASE_BRANCH != '2.1.x'
uses: actions/cache/save@v4
with:
path: /tmp/sorted.txt
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
32 changes: 8 additions & 24 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: github-workflow

on:
push:
branches: [ main, 2.1.x, 3.0.x ]
branches: [ main, 3.0.x ]
pull_request:
branches: [ main, 2.1.x, 3.0.x ]
branches: [ main, 3.0.x ]

jobs:
build:
Expand All @@ -27,7 +27,7 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: set env variables
uses: ./.github/workflows/composites/env-variables
Expand All @@ -37,10 +37,6 @@ jobs:
uses: ./.github/workflows/composites/setup-jdk17
if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x'

- name: setup project jdk-8
uses: ./.github/workflows/composites/setup-jdk1.8
if: env.BASE_BRANCH == '2.1.x'

- name: cache local maven repository
uses: ./.github/workflows/composites/cache

Expand All @@ -61,8 +57,7 @@ jobs:

- name: restore test times cache if it exists
id: restore_test_times_cache
if: env.BASE_BRANCH != '2.1.x'
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: /tmp/sorted.txt
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
Expand Down Expand Up @@ -110,7 +105,7 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: clean space
uses: ./.github/workflows/composites/clean-space
Expand All @@ -122,10 +117,6 @@ jobs:
uses: ./.github/workflows/composites/setup-jdk17
if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x'

- name: setup project jdk-8
uses: ./.github/workflows/composites/setup-jdk1.8
if: env.BASE_BRANCH == '2.1.x'

- name: pre-test-actions
uses: ./.github/workflows/composites/pre-test-actions

Expand Down Expand Up @@ -158,7 +149,7 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: clean space
uses: ./.github/workflows/composites/clean-space
Expand All @@ -170,10 +161,6 @@ jobs:
uses: ./.github/workflows/composites/setup-jdk17
if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x'

- name: setup project jdk-8
uses: ./.github/workflows/composites/setup-jdk1.8
if: env.BASE_BRANCH == '2.1.x'

- name: pre-test-actions
uses: ./.github/workflows/composites/pre-test-actions

Expand All @@ -190,7 +177,6 @@ jobs:
- name: run and save individual test times
env:
CURRENT_INDEX: ${{ matrix.current_index }}
if: env.BASE_BRANCH != '2.1.x'
uses: ./.github/workflows/composites/run-and-save-test-times-when-cache-missing

save_test_times_when_cache_missing:
Expand All @@ -200,10 +186,9 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: compute and save running time of tests
if: env.BASE_BRANCH != '2.1.x'
uses: ./.github/workflows/composites/test-times

save_test_times_when_cache_present:
Expand All @@ -213,8 +198,7 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: compute and save running time of tests
if: env.BASE_BRANCH != '2.1.x'
uses: ./.github/workflows/composites/test-times

0 comments on commit 2861ea5

Please sign in to comment.