Skip to content

Commit 111d3d6

Browse files
committed
ci: Generate Markdown Table
1 parent 906f2af commit 111d3d6

File tree

2 files changed

+58
-6
lines changed

2 files changed

+58
-6
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
$INPUT = $argv[1] ?? 'aggregated_tested_versions.json';
4+
$OUTPUT = $argv[2] ?? 'integration_versions.md';
5+
6+
$data = json_decode(file_get_contents($INPUT), true);
7+
8+
$markdownTable = "| Library | Min. Supported Version | Max. Supported Version |\n";
9+
$markdownTable .= "|-----------------------------|------------------------|------------------------|\n";
10+
11+
ksort($data);
12+
13+
foreach ($data as $library => $versions) {
14+
$minVersion = $versions[0];
15+
$maxVersion = $versions[0];
16+
foreach ($versions as $version) {
17+
if (version_compare($version, $minVersion, '<')) {
18+
$minVersion = $version;
19+
}
20+
if (version_compare($version, $maxVersion, '>')) {
21+
$maxVersion = $version;
22+
}
23+
}
24+
25+
$markdownTable .= sprintf(
26+
"| %-27s | %-22s | %-22s |\n",
27+
$library,
28+
$minVersion,
29+
$maxVersion
30+
);
31+
}
32+
33+
file_put_contents($OUTPUT, $markdownTable);
34+
35+
echo "Markdown table has been generated and saved to $OUTPUT.\n";
36+
37+
?>

.github/workflows/aggregate_tested_versions.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,30 @@ jobs:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
1818

19-
# Let time for the CircleCI jobs to finish
20-
- name: Wait for 5 minutes
21-
run: sleep 300
19+
- name: Install jq
20+
run: sudo apt-get install jq
21+
22+
- name: Install PHP
23+
uses: shivammathur/[email protected]
24+
with:
25+
php-version: '8.3'
26+
27+
- name: Wait for 4 minutes
28+
run: sleep 240
2229

2330
- name: Run aggregation script
31+
env:
32+
CI_COMMIT_SHA: ${{ github.sha }}
33+
CI_COMMIT_BRANCH: ${{ github.ref }}
34+
CIRCLECI_TOKEN: ${{ secrets.CIRCLECI_TOKEN }}
2435
run: |
25-
export CI_COMMIT_SHA=$(git rev-parse HEAD)
26-
export CI_COMMIT_BRANCH=$(git branch --contains "${CI_COMMIT_SHA}" | grep -v 'detached' | head -n 1 | awk '{print $2}')
2736
./.github/scripts/aggregate_tested_versions.sh
2837
2938
- name: Show aggregated versions
30-
run: cat ./.github/scripts/aggregated_versions.json
39+
run: cat ./.github/scripts/aggregated_versions.json
40+
41+
- name: Generate Markdown Table
42+
run: php ./.github/scripts/generate_markdown.php
43+
44+
- name: Show Markdown Table
45+
run: cat ./.github/scripts/versions_table.md

0 commit comments

Comments
 (0)