Skip to content

Commit

Permalink
test dynamic matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevhen Hrytsai committed May 11, 2024
1 parent 34ed213 commit d053d63
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
21 changes: 2 additions & 19 deletions .github/workflows/dyn-matrices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,9 @@ jobs:
sparse-checkout: |
pom.xml
.github/workflows/matrix.json
sparse-checkout-cone-mode: true
.github/workflows/prepare-matrices.sh
- id: set-matrix
run: |
ls -lah ./
slack_pl_version=$(cat ./pom.xml | grep -oE -m 1 '<version>[0-9][0-9]?\.[0-9]+\.[0-9]+</version>' | grep -oE '[0-9]\.[0-9]+\.[0-9]+')
echo "Slack Plugin Version $slack_pl_version"
if [ ${slack_pl_version%.*.*} -gt 1 ]; then
pl_version='current'
else
pl_version='old'
fi
echo "Matrix key - $pl_version"
echo "unit-tests-matrix=$(jq --compact-output --arg v "$pl_version" '.[$v]."unit-tests"' .github/workflows/matrix.json)" >> $GITHUB_OUTPUT
echo "jira-it-matrix=$(jq --compact-output --arg v "$pl_version" '.[$v]."jira-it"' .github/workflows/matrix.json)" >> $GITHUB_OUTPUT
echo "confluence-it-matrix=$(jq --compact-output --arg v "$pl_version" '.[$v]."confluence-it"' .github/workflows/matrix.json)" >> $GITHUB_OUTPUT
echo "bitbucket-it-matrix=$(jq --compact-output --arg v "$pl_version" '.[$v]."bitbucket-it"' .github/workflows/matrix.json)" >> $GITHUB_OUTPUT
# echo "matrix={\"java-version\":[\"8\",\"11\",\"17\"],\"bitbucket-version\":[\"7.6.0\",\"8.8.0\"],\"exclude\":[{\"java-version\":\"17\",\"bitbucket-version\":\"7.6.0\"}]}" >> $GITHUB_OUTPUT
run: .github/workflows/prepare-matrices.sh

run-tests:
needs: prepare
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/prepare-matrices.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

ls -lah ./
ls -lah .github/workflows

slack_pl_version=$(cat ./pom.xml | grep -oE -m 1 '<version>[0-9][0-9]?\.[0-9]+\.[0-9]+</version>' | grep -oE '[0-9]\.[0-9]+\.[0-9]+')
echo "Slack Plugin Version $slack_pl_version"

# Get slack plugin major version
if [ ${slack_pl_version%.*.*} -gt 1 ]; then
matrix_key='current'
else
matrix_key='old'
fi
echo "Matrix key - $matrix_key"

echo "unit-tests-matrix=$(jq --compact-output --arg v "$matrix_key" '.[$v]."unit-tests"' .github/workflows/matrix.json)" >> $GITHUB_OUTPUT
echo "jira-it-matrix=$(jq --compact-output --arg v "$matrix_key" '.[$v]."jira-it"' .github/workflows/matrix.json)" >> $GITHUB_OUTPUT
echo "confluence-it-matrix=$(jq --compact-output --arg v "$matrix_key" '.[$v]."confluence-it"' .github/workflows/matrix.json)" >> $GITHUB_OUTPUT
echo "bitbucket-it-matrix=$(jq --compact-output --arg v "$matrix_key" '.[$v]."bitbucket-it"' .github/workflows/matrix.json)" >> $GITHUB_OUTPUT

0 comments on commit d053d63

Please sign in to comment.