Skip to content

Commit 53d5824

Browse files
committedFeb 8, 2024
ci: generate multi-tests
1 parent 1c6ea6b commit 53d5824

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed
 

‎.github/workflows/test.yml

+28-18
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,48 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
select-tests:
12+
runs-on: ubuntu-22.04
13+
concurrency:
14+
group: ${{ github.workflow }}-select-tests-${{ github.event.number || github.ref }}
15+
cancel-in-progress: true
16+
outputs:
17+
tests: ${{ steps.trick.outputs.tests }}
18+
steps:
19+
- name: Trick Renovate
20+
id: trick
21+
shell: bash
22+
run: |
23+
USES=$(cat <<TRICK_RENOVATE
24+
- uses: DanySK/Template-for-Gradle-Plugins@cb970302120bb0b6a01ab495695a9f31babb83c7
25+
- uses: DanySK/Template-for-Kotlin-Multiplatform-Projects@0.1.22
26+
TRICK_RENOVATE
27+
)
28+
export USES="$USES"
29+
ruby -e 'puts "tests=#{ENV["USES"].lines.map { |line| /^-\s+uses:\s+([^\s]+\/[^\s]+)@(.*)\s*$/.match(line) }.map { |match| [match[1], match[2]] }}"' >> $GITHUB_OUTPUT
1130
test:
31+
needs:
32+
- select-tests
1233
strategy:
1334
fail-fast: false
1435
matrix:
1536
os: [ windows-2022, macos-12, ubuntu-22.04 ]
37+
test: ${{ fromJson(needs.select-tests.outputs.tests) }}
1638
runs-on: ${{ matrix.os }}
1739
concurrency:
18-
group: ${{ github.workflow }}-build-${{ matrix.os }}-${{ github.event.number || github.ref }}
40+
group: ${{ github.workflow }}-test-${{ matrix.os }}-${{ matrix.test[0] }}-${{ matrix.test[1] }}-${{ github.event.number || github.ref }}
1941
cancel-in-progress: true
2042
steps:
2143
- name: Checkout
22-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
44+
uses: actions/checkout@v4.1.1
2345
with:
2446
path: 'action'
25-
- name: Trick Renovate
26-
id: trick
27-
shell: bash
28-
run: |
29-
# Idea: the regex matcher of Renovate keeps this string up to date automatically
30-
# The version is extracted and used to access the correct version of the scripts
31-
USES=$(cat <<TRICK_RENOVATE
32-
- uses: DanySK/Template-for-Gradle-Plugins@cb970302120bb0b6a01ab495695a9f31babb83c7
33-
TRICK_RENOVATE
34-
)
35-
echo "Scripts update line: \"$USES\""
36-
echo "Computed version: \"${USES#*@}\""
37-
echo "::set-output name=version::${USES#*@}"
3847
- name: Checkout test repo
3948
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4049
with:
41-
repository: DanySK/Template-for-Gradle-Plugins
50+
repository: ${{ matrix.test[0] }}
4251
path: 'target'
43-
ref: ${{ steps.trick.outputs.version }}
52+
ref: ${{ matrix.test[1] }}
4453
- uses: ./action
4554
with:
4655
build-command: ./gradlew tasks
@@ -61,7 +70,7 @@ jobs:
6170
- name: Checkout
6271
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
6372
with:
64-
token: ${{ secrets.DEPLOYMENT_TOKEN }}
73+
token: ${{ secrets.DEPLOYMENT_TOKEN }}
6574
- name: Semantic Release
6675
env:
6776
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -71,6 +80,7 @@ jobs:
7180
success:
7281
runs-on: ubuntu-22.04
7382
needs:
83+
- select-tests
7484
- test
7585
- release
7686
if: >-

0 commit comments

Comments
 (0)
Please sign in to comment.