.circleci/config.yml
# For a detailed guide to building and testing on iOS, read the docs:
# https://circleci.com/docs/2.0/testing-ios/
version: 2.1
parameters:
package-name:
type: string
default: "MistKit"
swift-ver:
type: string
default: "5.2.4"
codecov-upload-file:
type: string
default: "info.lcov"
orbs:
codecov: codecov/codecov@1.0.5
jobs:
build-xenial:
machine:
image: ubuntu-1604:201903-01
environment:
PACKAGE_NAME: << pipeline.parameters.package-name >>
SWIFT_VER: << pipeline.parameters.swift-ver >>
steps:
- checkout
- run:
name: Update PATH and Define Environment Variable at Runtime
command: |
echo 'export RELEASE_DOT=$(lsb_release -sr)' >> $BASH_ENV
echo 'export RELEASE_NAME=$(lsb_release -sc)' >> $BASH_ENV
echo 'export RELEASE_NUM=${RELEASE_DOT//[-._]/}' >> $BASH_ENV
source $BASH_ENV
- run:
name: Download Swift 5.2
command: wget -q https://swift.org/builds/swift-${SWIFT_VER}-release/ubuntu${RELEASE_NUM}/swift-${SWIFT_VER}-RELEASE/swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}.tar.gz
- run:
name: Extract Swift 5.2
command: tar xzf swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}.tar.gz
- run:
name: Add Path
command: echo 'export PATH=${PWD}/swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}/usr/bin:$PATH' >> $BASH_ENV
- run:
name: Resolve
command: swift package resolve
- run:
name: Build
command: swift build -v
- run:
name: Run tests
command: swift test --enable-test-discovery --enable-code-coverage
- run:
name: Prepare Code Coverage
command: llvm-cov export -format="lcov" .build/x86_64-unknown-linux-gnu/debug/${PACKAGE_NAME}PackageTests.xctest -instr-profile .build/debug/codecov/default.profdata > info.lcov
- codecov/upload:
file: << pipeline.parameters.codecov-upload-file >>
flags: circleci,${RELEASE_NAME}
build-catalina-11_4_1:
macos:
xcode: "11.4.1"
environment:
PACKAGE_NAME: << pipeline.parameters.package-name >>
steps:
- checkout
- run:
name: Build
command: swift build
- run:
name: Lint
command: swiftformat --lint . && swiftlint
- run:
name: Run Swift Package Tests
command: swift test -v --enable-code-coverage
- run:
name: Prepare Code Coverage
command: xcrun llvm-cov export -format="lcov" .build/debug/${PACKAGE_NAME}PackageTests -instr-profile .build/debug/codecov/default.profdata > info.lcov
- codecov/upload:
file: << pipeline.parameters.codecov-upload-file >>
flags: circleci,macOS
- run:
name: Run iOS Tests
command: xcodebuild build test -scheme ${PACKAGE_NAME}-Package -destination 'name=iPhone 11'
- codecov/upload:
file: << pipeline.parameters.codecov-upload-file >>
flags: circleci,iOS
workflows:
version: 2
build:
jobs:
#- build-catalina-11_4_1
- build-xenial