Skip to content

Commit

Permalink
Update ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
nik3212 committed Jan 8, 2024
1 parent 3242626 commit 5c098f7
Showing 1 changed file with 212 additions and 31 deletions.
243 changes: 212 additions & 31 deletions {{ cookiecutter.name | lower }}/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,52 +26,233 @@ jobs:
{% raw %}
DIFF_BASE: ${{ github.base_ref }}
{% endraw %}
Latest:
name: Test Latest (iOS, macOS, tvOS, watchOS)
runs-on: macOS-12

{% if cookiecutter.macOS == "Yes" %}
macOS:
{% raw %}
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
{% endraw %}
env:
{% raw %}
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
{% endraw %}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- xcode: "Xcode_15.0"
runsOn: macos-13
name: "macOS 13, Xcode 15.0, Swift 5.9.0"
- xcode: "Xcode_14.3.1"
runsOn: macos-13
name: "macOS 13, Xcode 14.3.1, Swift 5.8.0"
- xcode: "Xcode_14.2"
runsOn: macOS-12
name: "macOS 12, Xcode 14.2, Swift 5.7.2"
- xcode: "Xcode_14.1"
runsOn: macOS-12
name: "macOS 12, Xcode 14.1, Swift 5.7.1"
steps:
- uses: actions/checkout@v3
{% raw %}
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "{{ cookiecutter.name }}" -destination "platform=macOS" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
{% endraw %}
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
{% raw %}
token: ${{ secrets.CODECOV_TOKEN }}
{% endraw %}
xcode: true
{% raw %}
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
{% endraw %}
- uses: actions/upload-artifact@v4
with:
{% raw %}
name: ${{ matrix.name }}
{% endraw %}
path: test_output
{% endif %}

{% if cookiecutter.ios == "Yes" %}
iOS:
{% raw %}
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
{% endraw %}
env:
DEVELOPER_DIR: "/Applications/Xcode_14.1.app/Contents/Developer"
timeout-minutes: 10
{% raw %}
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
{% endraw %}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
{% if cookiecutter.ios == "Yes" %}
- destination: "OS=16.1,name=iPhone 14 Pro"
name: "iOS"
scheme: "{{ cookiecutter.name }}"
sdk: iphonesimulator
{% endif %}
{% if cookiecutter.tvOS == "Yes" %}
- destination: "OS=16.1,name=Apple TV"
name: "tvOS"
scheme: "{{ cookiecutter.name }}"
sdk: appletvsimulator
{% endif %}
{% if cookiecutter.watchOS == "Yes" %}
- destination: "OS=9.1,name=Apple Watch Series 8 (45mm)"
name: "watchOS"
scheme: "{{ cookiecutter.name }}"
sdk: watchsimulator
{% endif %}
{% if cookiecutter.macOS == "Yes" %}
- destination: "platform=macOS"
name: "macOS"
scheme: "{{ cookiecutter.name }}"
sdk: macosx
{% endif %}
- destination: "OS=17.0.1,name=iPhone 14 Pro"
name: "iOS 17.0.1"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=16.4,name=iPhone 14 Pro"
name: "iOS 16.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
{% raw %}
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "{{ cookiecutter.name }}" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
{% endraw %}
- uses: actions/upload-artifact@v4
with:
{% raw %}
name: ${{ matrix.name }}
path: test_output
{% endraw %}
{% endif %}

{% if cookiecutter.tvOS == "Yes" %}
tvOS:
{% raw %}
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
{% endraw %}
env:
{% raw %}
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
{% endraw %}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=17.0,name=Apple TV"
name: "tvOS 17.0"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=16.4,name=Apple TV"
name: "tvOS 16.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
{% raw %}
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "./${{ matrix.sdk }}.xcresult" || exit 1
run: xcodebuild test -scheme "{{ cookiecutter.name }}" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
{% endraw %}
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
{% raw %}
token: ${{ secrets.CODECOV_TOKEN }}
{% endraw %}
xcode: true
xcode_archive_path: "./${{ matrix.sdk }}.xcresult"
{% raw %}
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
{% endraw %}
- uses: actions/upload-artifact@v4
with:
{% raw %}
name: ${{ matrix.name }}
{% endraw %}
path: test_output
{% endif %}

{% if cookiecutter.watchOS == "Yes" %}
watchOS:
{% raw %}
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
{% endraw %}
env:
{% raw %}
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
{% endraw %}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=10.0,name=Apple Watch Series 9 (45mm)"
name: "watchOS 10.0"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=9.4,name=Apple Watch Series 8 (45mm)"
name: "watchOS 9.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
- destination: "OS=8.5,name=Apple Watch Series 7 (45mm)"
name: "watchOS 8.5"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
{% raw %}
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "{{ cookiecutter.name }}" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
{% endraw %}
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
{% raw %}
token: ${{ secrets.CODECOV_TOKEN }}
{% endraw %}
xcode: true
{% raw %}
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
{% endraw %}
- uses: actions/upload-artifact@v4
with:
{% raw %}
name: ${{ matrix.name }}
{% endraw %}
path: test_output
{% endif %}

spm:
{% raw %}
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
{% endraw %}
env:
{% raw %}
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
{% endraw %}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- name: "Xcode 15"
xcode: "Xcode_15.0"
runsOn: macos-13
- name: "Xcode 14"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
{% raw %}
- name: ${{ matrix.name }}
run: swift build -c release --target "{{ cookiecutter.name }}"
{% endraw %}
merge-test-reports:
needs: [iOS, macOS, watchOS, tvOS]
runs-on: macos-13
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: test_output
- run: xcrun xcresulttool merge test_output/**/*.xcresult --output-path test_output/final/final.xcresult
- name: Upload Merged Artifact
uses: actions/upload-artifact@v4
with:
name: MergedResult
path: test_output/final

discover-typos:
name: Discover Typos
Expand Down

0 comments on commit 5c098f7

Please sign in to comment.