Skip to content

Fix CI pipeline

Fix CI pipeline #19

Workflow file for this run

name: Build & Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-test:
name: Build & Test with ${{ matrix.swift }} on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13]
swift: ["5.8"]
runs-on: ${{ matrix.os }}
steps:
- name: Setup Swift ${{ matrix.swift }}
uses: swift-actions/setup-swift@v1
with:
swift-version: ${{ matrix.swift }}
- name: Checkout repository
uses: actions/checkout@v4
with:
# Set the fetch-depth > 1 or set to 0 for codecov upload detection
fetch-depth: 2
- name: Enable development dependencies
run: sed -i.bak "s/\/\/dev//g" Package.swift
- name: Build
run: swift build
- name: Test on Linux
if: matrix.os == 'ubuntu-latest'
run: swift test
- name: Test on macOS
if: matrix.os == 'macos-13'
run: swift test --enable-code-coverage
- name: Select Xcode
if: matrix.os == 'macos-13'
run: sudo xcode-select -switch /Applications/Xcode.app && /usr/bin/xcodebuild -version
- name: List Available iOS Simulators
if: matrix.os == 'macos-13'
run: xcrun simctl list devices available
# - name: Run tests on iOS Simulator
# if: matrix.os == 'macos-13'
# run: |
# xcrun simctl boot "iPhone 12"
# xcodebuild test -scheme YourScheme -destination 'platform=iOS Simulator,name=iPhone 12,OS=latest'
- name: Generate Code Coverage
if: matrix.os == 'macos-13'
run: |
mkdir -p coverage
xcrun llvm-cov export \
.build/debug/DieKitPackageTests.xctest/Contents/MacOS/DieKitPackageTests \
-instr-profile .build/debug/codecov/default.profdata \
--format="lcov" \
--ignore-filename-regex "\\.build" \
--ignore-filename-regex "Tests" > ./coverage/coverage.lcov
- name: Upload code coverage to Codecov
if: matrix.os == 'macos-13'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage.lcov
name: codecov-umbrella
flags: unittests
fail_ci_if_error: true