Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,26 @@ jobs:
code-coverage: ${{ matrix.codecov }}
action: ${{ matrix.action }}

verify-sanitizers:
name: ${{ matrix.platform }} ${{ matrix.sanitizer }}
runs-on: macos-latest
needs: [verify-dist]
strategy:
matrix:
platform:
- macOS
sanitizer:
- thread
- address
steps:
- uses: actions/checkout@v4
- uses: ./
with:
platform: ${{ matrix.platform }}
working-directory: fixtures/${{ matrix.platform }}
sanitizer: ${{ matrix.sanitizer }}
action: test

verify-dot-swift-version:
name: .swift-version
runs-on: macos-14
Expand Down
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
platform: ${{ matrix.platform }}
action: build # default = `test`
code-coverage: true # default = `false`
sanitizer: thread # options: `thread`, `address` (only one at a time)
warnings-as-errors: true # default = `false`
configuration: release # no default, ie. `xcodebuild` decides itself
```
Expand Down Expand Up @@ -186,10 +187,38 @@ opened in Xcode:

![img]

Youll even get your coverage report!
You'll even get your coverage report!

> Note this feature requires Xcode >= 11

## Sanitizers

You can enable sanitizers to help detect bugs during testing. Only one sanitizer can be enabled at a time.

### Thread Sanitizer

Thread Sanitizer (TSan) detects data races and other threading issues:

```yaml
- uses: mxcl/xcodebuild@v3
with:
action: test
sanitizer: thread
```

### Address Sanitizer

Address Sanitizer (ASan) detects memory corruption issues like buffer overflows and use-after-free:

```yaml
- uses: mxcl/xcodebuild@v3
with:
action: test
sanitizer: address
```

Sanitizers are only applied for `test` and `build-for-testing` actions.

## `.swift-version` File

If your repo has a `.swift-version` file and neither `swift` nor `xcode` is
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ inputs:
description: Enables code coverage
required: false
default: 'false'
sanitizer:
description: |
Enable a sanitizer for testing. Options: `thread`, `address`.
* `thread`: Thread Sanitizer (TSan) detects threading issues like data races
* `address`: Address Sanitizer (ASan) detects memory issues like buffer overflows
Only one sanitizer can be enabled at a time. Leave unset to disable.
required: false
authentication-key-base64:
description: |
A Base64-encoded authentication key issued by App Store Connect. If
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,18 @@ async function main() {
if (warningsAsErrors) args.push(warningsAsErrorsFlags)
break
case 'test':
case 'build-for-testing':
case 'build-for-testing': {
if (core.getBooleanInput('code-coverage')) {
args = args.concat(['-enableCodeCoverage', 'YES'])
}
const sanitizer = core.getInput('sanitizer')
if (sanitizer === 'thread') {
args = args.concat(['-enableThreadSanitizer', 'YES'])
} else if (sanitizer === 'address') {
args = args.concat(['-enableAddressSanitizer', 'YES'])
}
break
}
}

if (core.getBooleanInput('trust-plugins')) {
Expand Down
Loading