You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2022/10/14 20:52:54 UTC
[accumulo] branch main updated: Make use of GitHub Actions environment files (#3024)
This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 04ac8b222d Make use of GitHub Actions environment files (#3024)
04ac8b222d is described below
commit 04ac8b222d866fab2552087cbffa150c2d402a3c
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Fri Oct 14 16:52:49 2022 -0400
Make use of GitHub Actions environment files (#3024)
set-output was previously used to create the IT matrix, but it is now
deprecated. So, this change makes use of the environment files instead.
See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
Note: the emitted key=value should not quote the value, or else it will be
parsed as a String instead of a JSON type. This took me so long to figure
out, so I'm sharing it here. Also, if you change the name of the output
property, make sure you update the mapping of the step output to the job
output to use the new name.
---
.github/workflows/maven-full-its.yaml | 2 +-
contrib/ci/it-matrix.sh | 42 ++++++++++++++++++++++++-----------
2 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/.github/workflows/maven-full-its.yaml b/.github/workflows/maven-full-its.yaml
index 047ded2fee..a70eea19a7 100644
--- a/.github/workflows/maven-full-its.yaml
+++ b/.github/workflows/maven-full-its.yaml
@@ -72,7 +72,7 @@ jobs:
needs: fastbuild
timeout-minutes: 5
outputs:
- matrix: ${{ steps.set-matrix.outputs.matrix }}
+ matrix: ${{ steps.set-matrix.outputs.CUSTOM_MATRIX }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
diff --git a/contrib/ci/it-matrix.sh b/contrib/ci/it-matrix.sh
index f84c93fc57..6e0f809ce6 100755
--- a/contrib/ci/it-matrix.sh
+++ b/contrib/ci/it-matrix.sh
@@ -22,16 +22,32 @@ testsPerJob=15
if [[ -n $1 && $1 =~ ^[0-9]*$ ]]; then
testsPerJob=$1
fi
-echo "Creating matrix (tests per job: $testsPerJob)..."
-
-gitRootDir=$(git rev-parse --show-toplevel)
-# this only works because our test paths don't have spaces; we should keep it that way
-count=0
-echo -n '::set-output name=matrix::{"profile":['
-for x in $(find "$gitRootDir" -name '*IT.java' -exec basename '{}' .java \; | sort -u | xargs -n "$testsPerJob" | tr ' ' ','); do
- [[ $count -gt 0 ]] && echo -n ','
- echo -n "{\"name\":\"task_$count\",\"its\":\"$x\"}"
- ((count = count + 1))
-done
-echo ']}'
-echo "Finished creating matrix ($count tasks)"
+
+# set these to /dev/null if they aren't defined in the environment
+GITHUB_OUTPUT="${GITHUB_OUTPUT:-/dev/null}"
+GITHUB_STEP_SUMMARY="${GITHUB_STEP_SUMMARY:-/dev/null}"
+
+function createTestMatrix() {
+
+ local count=0
+ local chunk=$1
+ local batch
+ local gitRootDir
+
+ { echo "Creating matrix (tests per job: $chunk)..." | tee -a "$GITHUB_STEP_SUMMARY"; } 1>&2
+
+ gitRootDir=$(git rev-parse --show-toplevel)
+
+ # this only works because our test paths don't have spaces; we should keep it that way
+ echo -n '{"profile":['
+ for batch in $(find "$gitRootDir" -name '*IT.java' -exec basename '{}' .java \; | sort -u | xargs -n "$chunk" | tr ' ' ','); do
+ [[ $count -gt 0 ]] && echo -n ','
+ echo -n '{"name":"task_'"$count"'","its":"'"$batch"'"}'
+ ((count = count + 1))
+ done
+ echo ']}'
+
+ { echo "Finished creating matrix ($count tasks)" | tee "$GITHUB_STEP_SUMMARY"; } 1>&2
+}
+
+echo "CUSTOM_MATRIX=$(createTestMatrix "$testsPerJob")" | tee -a "$GITHUB_OUTPUT"