Skip to content

Commit d764067

Browse files
committed
[FEATURE] Add major version processing
1 parent 6ee2a5e commit d764067

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.github/workflows/compute.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
value: ${{ jobs.compute.outputs.os }}
88
coverage:
99
value: ${{ jobs.compute.outputs.coverage }}
10+
major:
11+
value: ${{ jobs.compute.outputs.major }}
1012
php:
1113
value: ${{ jobs.compute.outputs.php }}
1214
exclude:
@@ -31,6 +33,13 @@ jobs:
3133
exclude: ${{ env.EXCLUDE }}
3234

3335
steps:
34-
- name: Pseudo step
35-
if: false
36-
run: echo
36+
- name: Compute major versions
37+
run: |
38+
echo $COVERAGE
39+
echo $COVERAGE | tr "," "\n"
40+
echo $COVERAGE | tr "," "\n" | tr -cd "\n0-9"
41+
echo $COVERAGE | tr "," "\n" | tr -cd "\n0-9" | sed "s/.\{2\}$//"
42+
echo $COVERAGE | tr "," "\n" | tr -cd "\n0-9" | sed "s/.\{2\}$//" | sort -V
43+
echo $COVERAGE | tr "," "\n" | tr -cd "\n0-9" | sed "s/.\{2\}$//" | sort -V | uniq
44+
echo $COVERAGE | tr "," "\n" | tr -cd "\n0-9" | sed "s/.\{2\}$//" | sort -V | uniq | jq --raw-input --slurp 'split("\n") | map(select(. != ""))'
45+
echo "major=$(echo $COVERAGE | tr "," "\n" | tr -cd "\n0-9" | sed "s/.\{2\}$//" | sort -V | uniq | jq --compact-output --raw-input --slurp 'split("\n") | map(select(. != ""))')" >> $GITHUB_OUTPUT

.github/workflows/test.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,17 @@ jobs:
3333
id: version-cache
3434
env:
3535
COVERAGE: ${{ matrix.coverage }}
36-
run: echo "version=$(echo $COVERAGE | tr -d -c 0-9)" >> $GITHUB_OUTPUT
36+
run: |
37+
echo "version=$(echo $COVERAGE | tr -d -c 0-9)" >> $GITHUB_OUTPUT
38+
echo "major=$(echo $COVERAGE | tr -d -c 0-9 | sed 's/.\{2\}$//')" >> $GITHUB_OUTPUT
3739
3840
- uses: actions/cache/restore@v4
3941
id: restore-composer-cache
4042
with:
4143
path: ${{ steps.composer-cache.outputs.dir }}
42-
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.coverage }}
44+
key: ${{ runner.os }}-${{ matrix.php }}-${{ steps.version-cache.outputs.major }}-${{ matrix.coverage }}
4345
restore-keys: |
46+
${{ runner.os }}-${{ matrix.php }}-${{ steps.version-cache.outputs.major }}-
4447
${{ runner.os }}-${{ matrix.php }}-
4548
${{ runner.os }}-
4649
@@ -79,6 +82,6 @@ jobs:
7982
- name: Archive PHPUnit logs
8083
uses: actions/upload-artifact@v4
8184
with:
82-
name: phpunit-logs-${{ runner.os }}-${{ matrix.php }}-${{ matrix.coverage }}
85+
name: phpunit-logs-${{ runner.os }}-${{ matrix.php }}-${{ steps.version-cache.outputs.major }}-${{ matrix.coverage }}
8386
path: .Log/*
8487
retention-days: 1

0 commit comments

Comments
 (0)