.github/workflows/macOS.yml
name: macOS
on:
push:
branches:
- '*'
- 'feature/*'
- 'release/*'
tags: '*'
jobs:
build:
env:
PACKAGE_NAME: MistKit
runs-on: ${{ matrix.runs-on }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
matrix:
runs-on: [macos-11, macos-10.15]
xcode: ["/Applications/Xcode_12.4.app", "/Applications/Xcode_11.7.app"]
include:
- runs-on: macos-10.15
xcode: "/Applications/Xcode_11.6.app"
- runs-on: macos-10.15
xcode: "/Applications/Xcode_11.5.app"
- runs-on: macos-10.15
xcode: "/Applications/Xcode_11.4.1.app"
- runs-on: macos-11
xcode: "/Applications/Xcode_13.0.app"
- runs-on: macos-11
xcode: "/Applications/Xcode_12.5.1.app"
steps:
- uses: actions/checkout@v2
- name: Set Xcode Name
run: echo "XCODE_NAME=$(basename -- ${{ matrix.xcode }} | sed 's/\.[^.]*$//' | cut -d'_' -f2)" >> $GITHUB_ENV
- name: Setup Xcode
run: sudo xcode-select -s ${{ matrix.xcode }}/Contents/Developer
- name: Build
run: swift build -v
- name: Lint
if: startsWith(github.ref, 'refs/tags/') != true
run: swift run swiftformat --lint . && swift run swiftlint
- name: Run tests
run: swift test -v --enable-code-coverage
- name: Prepare Code Coverage
run: xcrun llvm-cov export -format="lcov" .build/debug/${{ env.PACKAGE_NAME }}PackageTests.xctest/Contents/MacOS/${{ env.PACKAGE_NAME }}PackageTests -instr-profile .build/debug/codecov/default.profdata > info.lcov
- name: Upload to CodeCov.io
run: bash <(curl https://codecov.io/bash) -F github -F macOS -F ${{ matrix.runs-on }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Build sourcedocs Documentation
if: ${{ matrix.os == 'macos-11' && matrix.xcode == '/Applications/Xcode_13.0.app' && !startsWith(github.ref, 'refs/tags/') }}
run: "swift run sourcedocs generate build -cra\ngit config --local user.email \"action@github.com\"\ngit config --local user.name \"GitHub Action\"\ngit status\ngit add Documentation\ngit diff-index --quiet HEAD || git commit -m \"[github action] Update Docs\"\ngit push \n"