Skip to content

Commit 032c0ce

Browse files
authored
Merge pull request kishikawakatsumi#10 from slidoapp/fix/5_xcode16_support
2 parents 4cb8d03 + 6c699b3 commit 032c0ce

7 files changed

Lines changed: 146 additions & 16 deletions

File tree

.github/workflows/test.yml

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ on: # rebuild any PRs and main branch changes
1010

1111
jobs:
1212
build: # make sure build/ci work properly
13-
runs-on: macos-14
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
xcode: ['xcode16', 'xcode15']
17+
include:
18+
- xcode: 'xcode16'
19+
xcode-path: '/Applications/Xcode_16.0.app'
20+
macos: 'macos-15'
21+
- xcode: 'xcode15'
22+
xcode-path: '/Applications/Xcode_15.4.app'
23+
macos: 'macos-14'
24+
runs-on: ${{ matrix.macos }}
1425
steps:
1526
- uses: actions/checkout@v4
1627
- uses: actions/setup-node@v4
@@ -21,62 +32,73 @@ jobs:
2132
- run: |
2233
npm run all
2334
test: # make sure the action works on a clean machine without building
24-
runs-on: macos-14
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
xcode: ['xcode16', 'xcode15']
39+
include:
40+
- xcode: 'xcode16'
41+
xcode-path: '/Applications/Xcode_16.0.app'
42+
macos: 'macos-15'
43+
- xcode: 'xcode15'
44+
xcode-path: '/Applications/Xcode_15.4.app'
45+
macos: 'macos-14'
46+
runs-on: ${{ matrix.macos }}
2547
steps:
2648
- uses: actions/checkout@v4
2749
- uses: ./
2850
with:
2951
path: __tests__/data/Example.xcresult
30-
title: Example test report
52+
title: 'Example test report (${{ matrix.xcode }})'
3153
- uses: ./
3254
with:
3355
path: __tests__/data/Example.xcresult
34-
title: Example Failures Only test report
56+
title: 'Example Failures Only test report (${{ matrix.xcode }})'
3557
show-passed-tests: false
3658
- uses: ./
3759
with:
3860
path: __tests__/data/KeychainAccess.xcresult
39-
title: KeychainAccess Failures Only test report
61+
title: 'KeychainAccess Failures Only test report (${{ matrix.xcode }})'
4062
show-passed-tests: false
4163
- uses: ./
4264
with:
4365
path: __tests__/data/KeychainAccess.xcresult
44-
title: KeychainAccess test report
66+
title: 'KeychainAccess test report (${{ matrix.xcode }})'
4567
- uses: ./
4668
with:
4769
path: __tests__/data/TAU.xcresult
48-
title: TAU test report
70+
title: 'TAU test report (${{ matrix.xcode }})'
4971
- uses: ./
5072
with:
5173
path: __tests__/data/TestResults.xcresult
52-
title: TestResults test report
74+
title: 'TestResults test report (${{ matrix.xcode }})'
5375
- uses: ./
5476
with:
5577
path: __tests__/data/Coverage.xcresult
56-
title: Coverage test report
78+
title: 'Coverage test report (${{ matrix.xcode }})'
5779
- uses: ./
5880
with:
5981
path: __tests__/data/Coverage.xcresult
60-
title: Hide Coverage test report
82+
title: 'Hide Coverage test report (${{ matrix.xcode }})'
6183
show-code-coverage: false
6284
- uses: ./
6385
with:
6486
path: __tests__/data/UhooiPicBook.xcresult
65-
title: UhooiPicBook test report
87+
title: 'UhooiPicBook test report (${{ matrix.xcode }})'
6688
- uses: ./
6789
with:
6890
path: __tests__/data/UhooiPicBook.xcresult
69-
title: UhooiPicBook No Passed test report
91+
title: 'UhooiPicBook No Passed test report (${{ matrix.xcode }})'
7092
show-passed-tests: false
7193
- uses: ./
7294
with:
7395
path: __tests__/data/UhooiPicBook.xcresult
74-
title: UhooiPicBook No Code Coverage test report
96+
title: 'UhooiPicBook No Code Coverage test report (${{ matrix.xcode }})'
7597
show-code-coverage: false
7698
- uses: ./
7799
with:
78100
path: |
79101
__tests__/data/Example.xcresult
80102
__tests__/data/KeychainAccess.xcresult
81103
__tests__/data/TAU.xcresult
82-
title: 'Multiple Paths'
104+
title: 'Multiple Paths (${{ matrix.xcode }})'

dist/index.js

Lines changed: 67 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xcresulttool",
3-
"version": "2.0.0",
3+
"version": "3.0.1",
44
"private": false,
55
"description": "A GitHub Action that generates a human-readable test report from the Xcode result bundle and shows it on GitHub Checks.",
66
"main": "lib/main.js",

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ async function mergeResultBundle(
152152
const args = ['xcresulttool', 'merge']
153153
.concat(inputPaths)
154154
.concat(['--output-path', outputPath])
155+
155156
const options = {
156157
silent: !core.isDebug()
157158
}

src/parser.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import * as core from '@actions/core'
44
import * as exec from '@actions/exec'
55
import {promises} from 'fs'
6+
import {getXcodeVersion} from './xcode'
7+
68
const {readFile} = promises
79

810
export class Parser {
@@ -18,6 +20,8 @@ export class Parser {
1820
}
1921

2022
async exportObject(reference: string, outputPath: string): Promise<Buffer> {
23+
const xcodeVersion = await getXcodeVersion()
24+
2125
const args = [
2226
'xcresulttool',
2327
'export',
@@ -30,6 +34,11 @@ export class Parser {
3034
'--id',
3135
reference
3236
]
37+
38+
if (xcodeVersion === 16) {
39+
args.push('--legacy')
40+
}
41+
3342
const options = {
3443
silent: !core.isDebug()
3544
}
@@ -56,6 +65,8 @@ export class Parser {
5665
}
5766

5867
private async toJSON(reference?: string): Promise<string> {
68+
const xcodeVersion = await getXcodeVersion()
69+
5970
const args = [
6071
'xcresulttool',
6172
'get',
@@ -69,6 +80,10 @@ export class Parser {
6980
args.push(reference)
7081
}
7182

83+
if (xcodeVersion === 16) {
84+
args.push('--legacy')
85+
}
86+
7287
let output = ''
7388
const options = {
7489
silent: !core.isDebug(),

src/xcode.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import * as core from '@actions/core'
2+
import * as exec from '@actions/exec'
3+
4+
export async function getXcodeVersion(): Promise<number> {
5+
let output = ''
6+
const options = {
7+
listeners: {
8+
stdout: (data: Buffer) => {
9+
output += data.toString()
10+
}
11+
},
12+
silent: !core.isDebug()
13+
}
14+
await exec.exec('xcodebuild', ['-version'], options)
15+
const match = output.match(/Xcode (\d+)/)
16+
if (match) {
17+
return parseInt(match[1], 10)
18+
} else {
19+
core.warning(
20+
`Failed to determine Xcode version from command 'xcodebuild -version'.`
21+
)
22+
core.info(output)
23+
return 0
24+
}
25+
}

0 commit comments

Comments
 (0)