Skip to content

Commit c6c2cbb

Browse files
committed
feat: compact README status table and add OS version
1 parent 740ce90 commit c6c2cbb

File tree

3 files changed

+278
-162
lines changed

3 files changed

+278
-162
lines changed

.github/workflows/CI-CD.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Setup Fortran
41-
uses: gha3mi/setup-fortran-conda@dev
41+
uses: gha3mi/setup-fortran-conda@latest
4242
with:
4343
compiler: ${{ matrix.compiler }}
4444
compiler-version: ${{ matrix.compiler-version }}
@@ -64,7 +64,7 @@ jobs:
6464

6565
steps:
6666
- name: Setup Fortran
67-
uses: gha3mi/setup-fortran-conda@dev
67+
uses: gha3mi/setup-fortran-conda@latest
6868
with:
6969
compiler: ${{ matrix.compiler }}
7070
compiler-version: ${{ matrix.compiler-version }}
@@ -98,7 +98,7 @@ jobs:
9898

9999
steps:
100100
- name: Setup Fortran
101-
uses: gha3mi/setup-fortran-conda@dev
101+
uses: gha3mi/setup-fortran-conda@latest
102102
with:
103103
compiler: ${{ matrix.compiler }}
104104
compiler-version: ${{ matrix.compiler-version }}
@@ -135,7 +135,7 @@ jobs:
135135

136136
steps:
137137
- name: Setup Fortran
138-
uses: gha3mi/setup-fortran-conda@dev
138+
uses: gha3mi/setup-fortran-conda@latest
139139
with:
140140
compiler: ${{ matrix.compiler }}
141141
compiler-version: ${{ matrix.compiler-version }}
@@ -159,7 +159,7 @@ jobs:
159159
runs-on: ubuntu-latest
160160
steps:
161161
- name: Setup and Generate FORD Documentation
162-
uses: gha3mi/setup-fortran-conda@dev
162+
uses: gha3mi/setup-fortran-conda@latest
163163
with:
164164
compiler: gfortran
165165
generate-doc-ford: true
@@ -175,7 +175,7 @@ jobs:
175175
runs-on: ubuntu-latest
176176
steps:
177177
- name: Setup and Generate Doxygen Documentation
178-
uses: gha3mi/setup-fortran-conda@dev
178+
uses: gha3mi/setup-fortran-conda@latest
179179
with:
180180
compiler: gfortran
181181
generate-doc-doxygen: true
@@ -192,7 +192,7 @@ jobs:
192192
runs-on: ubuntu-latest
193193
steps:
194194
- name: Generate summary
195-
uses: gha3mi/setup-fortran-conda@dev
195+
uses: gha3mi/setup-fortran-conda@latest
196196
with:
197197
generate-status-fpm: true
198198

@@ -203,7 +203,7 @@ jobs:
203203
runs-on: ubuntu-latest
204204
steps:
205205
- name: Generate summary
206-
uses: gha3mi/setup-fortran-conda@dev
206+
uses: gha3mi/setup-fortran-conda@latest
207207
with:
208208
generate-status-cmake: true
209209

@@ -214,18 +214,18 @@ jobs:
214214
runs-on: ubuntu-latest
215215
steps:
216216
- name: Generate summary
217-
uses: gha3mi/setup-fortran-conda@dev
217+
uses: gha3mi/setup-fortran-conda@latest
218218
with:
219219
generate-status-meson: true
220220

221221
update_readme_table:
222-
if: ${{ always() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && !contains(github.event.head_commit.message, '[skip ci]') }}
222+
if: ${{ always() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]') }}
223223
name: Update README.md status table
224224
needs: [status_fpm, status_cmake, status_meson]
225225
runs-on: ubuntu-latest
226226
steps:
227227
- name: Update README status
228-
uses: gha3mi/setup-fortran-conda@dev
228+
uses: gha3mi/setup-fortran-conda@latest
229229
with:
230230
update-readme-table: true
231231
update-readme-token: ${{ secrets.GH_PAT }} # Update with your GitHub personal access token
@@ -238,7 +238,7 @@ jobs:
238238
runs-on: ubuntu-latest
239239
steps:
240240
- name: Run Fortitude Linter
241-
uses: gha3mi/setup-fortran-conda@dev
241+
uses: gha3mi/setup-fortran-conda@latest
242242
with:
243243
fortitude-check: true
244244
fortitude-settings: "--output-format github"

index.js

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ async function detectToolVersion(tool) {
8888
const { stdout, stderr, exitCode } = await execCapture(cmd, args);
8989
const combined = `${stdout}\n${stderr}`.trim();
9090
const line = firstLine(stdout) || firstLine(stderr);
91+
9192
if (exitCode !== 0 && isNotFoundMessage(combined || line)) return 'Not found';
9293
if (exitCode !== 0 && !line) return 'Unknown';
94+
9395
const ver = pickFirstVersionLike(combined) || pickFirstVersionLike(line);
9496
return ver || line || 'Unknown';
9597
};
@@ -101,6 +103,49 @@ async function detectToolVersion(tool) {
101103
return null;
102104
}
103105

106+
async function detectOSInfo() {
107+
const runnerOs = process.env.RUNNER_OS || '';
108+
109+
if (runnerOs === 'Linux') {
110+
const { stdout } = await execCapture('bash', [
111+
'-c',
112+
'source /etc/os-release 2>/dev/null && echo "${ID:-linux}|${VERSION_ID:-}" || echo "linux|"',
113+
]);
114+
const line = firstLine(stdout);
115+
const [idRaw, verRaw] = String(line || 'linux|').split('|');
116+
const id = (idRaw || 'linux').trim();
117+
const version = (verRaw || '').trim();
118+
const family = id === 'ubuntu' ? 'ubuntu' : id;
119+
const label = version ? `${family} ${version}` : family;
120+
return { family, version, label };
121+
}
122+
123+
if (runnerOs === 'macOS') {
124+
const v = await execCapture('sw_vers', ['-productVersion']);
125+
const version = firstLine(v.stdout) || '';
126+
const family = 'macos';
127+
const label = version ? `macos ${version}` : 'macos';
128+
return { family, version, label };
129+
}
130+
131+
if (runnerOs === 'Windows') {
132+
const { stdout } = await execCapture('powershell', [
133+
'-NoProfile',
134+
'-Command',
135+
'$os=(Get-CimInstance Win32_OperatingSystem); "$($os.Caption)|$($os.Version)"',
136+
]);
137+
const line = firstLine(stdout);
138+
const [caption, ver] = String(line || 'Windows|').split('|');
139+
const family = 'windows';
140+
const version = (ver || '').trim();
141+
const shortCaption = (caption || 'Windows').replace(/^Microsoft\s+/i, '').trim();
142+
const label = version ? `${shortCaption} ${version}` : shortCaption;
143+
return { family, version, label };
144+
}
145+
146+
return { family: (runnerOs || 'unknown').toLowerCase(), version: '', label: runnerOs || 'unknown' };
147+
}
148+
104149
function ghRequestJson(url, token) {
105150
return new Promise((resolve, reject) => {
106151
const u = new URL(url);
@@ -186,6 +231,8 @@ async function run() {
186231
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN || '';
187232
let jobInfo = null;
188233

234+
const osInfo = await detectOSInfo();
235+
189236
const metaBase = {
190237
schema_version: 1,
191238
repo: process.env.GITHUB_REPOSITORY || '',
@@ -196,6 +243,9 @@ async function run() {
196243
os: process.env.RUNNER_OS || '',
197244
arch: process.env.RUNNER_ARCH || '',
198245
name: process.env.RUNNER_NAME || '',
246+
os_family: osInfo.family,
247+
os_version: osInfo.version,
248+
os_label: osInfo.label,
199249
},
200250
compiler: {
201251
requested: compiler,
@@ -257,8 +307,15 @@ async function run() {
257307

258308
await summary
259309
.addTable([
260-
['OS', 'Compiler', 'Version'],
261-
[platformInput, compiler, metaBase.compiler.actual_version],
310+
['OS', 'OS Version', 'Compiler', 'Version', 'Tool', 'Tool Version'],
311+
[
312+
metaBase.runner.os_family || metaBase.runner.os,
313+
metaBase.runner.os_version || metaBase.runner.os_label,
314+
compiler,
315+
metaBase.compiler.actual_version,
316+
metaBase.tool || '-',
317+
metaBase.tool ? (metaBase.tools?.[metaBase.tool]?.version || 'Unknown') : '-',
318+
],
262319
])
263320
.write();
264321
} catch (err) {

0 commit comments

Comments
 (0)