open-consul/.github/scripts/set_test_package_matrix.sh

12 lines
489 B
Bash
Raw Normal View History

Github Actions Migration - move go-tests workflows to GHA (#16761) * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * making on pull_request * Update .github/scripts/rerun_fails_report.sh Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * make runs-on required * removing go-version param that is not used. * removing go-version param that is not used. * Modify build-distros to use medium runners (#16773) * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * trying mediums * adding in script * fixing runs-on to be parameter * fixing merge conflict * changing to on push * removing whitespace * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * changing back to on pull_request --------- Co-authored-by: Dan Bond <danbond@protonmail.com> * Github Actions Migration - move verify-ci workflows to GHA (#16777) * add verify-ci workflow * adding comment and changing to on pull request. * changing to pull_requests * changing to pull_request * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * [NET-3029] Migrate frontend to GHA (#16731) * changing set up to a small * using consuls own custom runner pool. --------- Co-authored-by: Dan Bond <danbond@protonmail.com>
2023-03-28 21:29:27 +00:00
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
Github Actions Migration - move go-tests workflows to GHA (#16761) * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * making on pull_request * Update .github/scripts/rerun_fails_report.sh Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * make runs-on required * removing go-version param that is not used. * removing go-version param that is not used. * Modify build-distros to use medium runners (#16773) * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * trying mediums * adding in script * fixing runs-on to be parameter * fixing merge conflict * changing to on push * removing whitespace * go-tests workflow * add test splitting to go-tests * fix re-reun fails report path * fix re-reun fails report path another place * fixing tests for32bit and race * use script file to generate runners * fixing run path * add checkout * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * passing runs-on * setting up runs-on as a parameter to check-go-mod * changing back to on pull_request --------- Co-authored-by: Dan Bond <danbond@protonmail.com> * Github Actions Migration - move verify-ci workflows to GHA (#16777) * add verify-ci workflow * adding comment and changing to on pull request. * changing to pull_requests * changing to pull_request * Apply suggestions from code review Co-authored-by: Dan Bond <danbond@protonmail.com> * [NET-3029] Migrate frontend to GHA (#16731) * changing set up to a small * using consuls own custom runner pool. --------- Co-authored-by: Dan Bond <danbond@protonmail.com>
2023-03-28 21:29:27 +00:00
set -euo pipefail
export RUNNER_COUNT=$1
# set matrix var to list of unique packages containing tests
matrix="$(go list -json="ImportPath,TestGoFiles" ./... | jq --compact-output '. | select(.TestGoFiles != null) | .ImportPath' | jq --slurp --compact-output '.' | jq --argjson runnercount $RUNNER_COUNT -cM '[_nwise(length / $runnercount | floor)]'))"
echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"