Fix codecov.io integration (#308)
Move code coverage generation from the xcodebuild workflow to the SwiftPM one instead.
This commit is contained in:
parent
409e565756
commit
b26d15bede
|
@ -3,7 +3,8 @@ name: SwiftPM
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
paths:
|
||||
- '.codecov.yml'
|
||||
- '.github/workflows/swiftpm.yml'
|
||||
- 'Package*'
|
||||
- 'Sources/**/*.[ch]'
|
||||
|
@ -12,7 +13,8 @@ on:
|
|||
- 'Tests/**/*.swift'
|
||||
- 'Tests/**/*.ya?ml'
|
||||
pull_request:
|
||||
paths:
|
||||
paths:
|
||||
- '.codecov.yml'
|
||||
- '.github/workflows/swiftpm.yml'
|
||||
- 'Package*'
|
||||
- 'Sources/**/*.[ch]'
|
||||
|
@ -25,7 +27,7 @@ jobs:
|
|||
Xcode:
|
||||
strategy:
|
||||
matrix:
|
||||
xcode_version: ['11.2.1', '11.3.1', '11.4.1', '11.5', '11.6', '11.7', '12.0.1', '12.1', '12.2']
|
||||
xcode_version: ['11.2.1', '11.3.1', '11.4.1', '11.5', '11.6', '11.7', '12.0.1', '12.1', '12.2', '12.4']
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
|
||||
|
@ -34,6 +36,15 @@ jobs:
|
|||
- run: swift -version
|
||||
- run: YAMS_DEFAULT_ENCODING=UTF16 swift test --parallel
|
||||
- run: YAMS_DEFAULT_ENCODING=UTF8 swift test --parallel
|
||||
- name: Code Coverage
|
||||
if: matrix.xcode_version == '12.4'
|
||||
run: |
|
||||
swift test --enable-code-coverage
|
||||
xcrun llvm-cov export -format="lcov" .build/debug/YamsPackageTests.xctest/Contents/MacOS/YamsPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov
|
||||
if [[ -n "${CODECOV_TOKEN}" ]]; then
|
||||
bash <(curl -s https://codecov.io/bash) -f coverage.lcov
|
||||
fi
|
||||
env: { 'CODECOV_TOKEN': '${{ secrets.CODECOV_TOKEN }}' }
|
||||
|
||||
Linux:
|
||||
strategy:
|
||||
|
|
|
@ -27,23 +27,15 @@ jobs:
|
|||
matrix:
|
||||
xcode:
|
||||
- version: '11.2.1'
|
||||
flags_for_test: -parallel-testing-enabled NO
|
||||
- version: '11.3.1'
|
||||
flags_for_test: -parallel-testing-enabled NO
|
||||
- version: '11.4.1'
|
||||
flags_for_test: -parallel-testing-enabled NO
|
||||
- version: '11.5'
|
||||
flags_for_test: -parallel-testing-enabled NO
|
||||
- version: '11.6'
|
||||
flags_for_test: -parallel-testing-enabled NO
|
||||
- version: '11.7'
|
||||
flags_for_test: -parallel-testing-enabled NO
|
||||
- version: '12.0.1'
|
||||
flags_for_test: -parallel-testing-enabled NO
|
||||
- version: '12.1'
|
||||
flags_for_test: -parallel-testing-enabled NO
|
||||
- version: '12.2'
|
||||
flags_for_test: -parallel-testing-enabled NO -enableCodeCoverage YES
|
||||
- version: '12.4'
|
||||
xcode_flags: ['-scheme Yams -project Yams.xcodeproj']
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
|
@ -53,29 +45,21 @@ jobs:
|
|||
- run: xcodebuild -version
|
||||
- name: macOS with UTF16
|
||||
if: always()
|
||||
run: YAMS_DEFAULT_ENCODING=UTF16 xcodebuild ${{ matrix.xcode_flags }} ${{ matrix.xcode.flags_for_test }} test | xcpretty
|
||||
run: YAMS_DEFAULT_ENCODING=UTF16 xcodebuild ${{ matrix.xcode_flags }} test | xcpretty
|
||||
shell: bash
|
||||
- name: macOS with UTF8
|
||||
if: always()
|
||||
run: YAMS_DEFAULT_ENCODING=UTF8 xcodebuild ${{ matrix.xcode_flags }} ${{ matrix.xcode.flags_for_test }} test | xcpretty
|
||||
run: YAMS_DEFAULT_ENCODING=UTF8 xcodebuild ${{ matrix.xcode_flags }} test | xcpretty
|
||||
shell: bash
|
||||
- name: iPhone Simulator
|
||||
if: always()
|
||||
run: xcodebuild ${{ matrix.xcode_flags }} ${{ matrix.xcode.flags_for_test }} test -sdk iphonesimulator -destination "name=iPhone 8" | xcpretty
|
||||
run: xcodebuild ${{ matrix.xcode_flags }} test -sdk iphonesimulator -destination "name=iPhone 8" | xcpretty
|
||||
shell: bash
|
||||
- name: Apple TV Simulator
|
||||
if: always()
|
||||
run: xcodebuild ${{ matrix.xcode_flags }} ${{ matrix.xcode.flags_for_test }} test -sdk appletvsimulator -destination "name=Apple TV 4K" | xcpretty
|
||||
run: xcodebuild ${{ matrix.xcode_flags }} test -sdk appletvsimulator -destination "name=Apple TV 4K" | xcpretty
|
||||
shell: bash
|
||||
- name: watchOS Simulator
|
||||
if: always()
|
||||
run: xcodebuild ${{ matrix.xcode_flags }} build -sdk watchsimulator | xcpretty
|
||||
shell: bash
|
||||
- name: Codecov
|
||||
if: contains(matrix.xcode.flags_for_test, '-enableCodeCoverage YES')
|
||||
run: |
|
||||
if [[ -n "${CODECOV_TOKEN}" ]]; then
|
||||
curl -s https://codecov.io/bash | bash -s
|
||||
fi
|
||||
shell: bash
|
||||
env: { 'CODECOV_TOKEN': '${{ secrets.CODECOV_TOKEN }}' }
|
||||
|
|
Loading…
Reference in New Issue