Skip to content

Bump VeryGoodOpenSource/very_good_coverage from 2.1.0 to 2.2.0 #423

Bump VeryGoodOpenSource/very_good_coverage from 2.1.0 to 2.2.0

Bump VeryGoodOpenSource/very_good_coverage from 2.1.0 to 2.2.0 #423

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
get_os:
name: Determine supported OS
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check and output correct matrix
id: output_data
run: |
macos='macOS-latest'
if [ -e .github/macos_version.txt ]
then
macos=$(cat ./.github/macos_version.txt)
fi
if [ -e .github/macos_only ]
then
echo "os_matrix=['$macos']" >> $GITHUB_OUTPUT
echo "coverage_os=$macos" >> $GITHUB_OUTPUT
else
echo "os_matrix=['$macos', 'ubuntu-latest']" >> $GITHUB_OUTPUT
echo "coverage_os=ubuntu-latest" >> $GITHUB_OUTPUT
fi
outputs:
os_matrix: ${{ steps.output_data.outputs.os_matrix }}
coverage_os: ${{ steps.output_data.outputs.coverage_os }}
test:
name: Tests
needs: get_os
strategy:
matrix:
os: ${{fromJson(needs.get_os.outputs.os_matrix)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Swift
uses: swift-actions/[email protected]
- name: Run tests
run: swift test --enable-code-coverage -Xswiftc -warnings-as-errors
- name: Save PR number
if: ${{ matrix.os == needs.get_os.outputs.coverage_os }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- name: Generate test coverage report
if: ${{ matrix.os == needs.get_os.outputs.coverage_os }}
uses: maxep/[email protected]
with:
output-file: ./pr/lcov.info
- name: Upload Coverage Information for Comment
if: ${{ matrix.os == needs.get_os.outputs.coverage_os }}
uses: actions/upload-artifact@v3
with:
name: pr
path: pr/
- name: 'Read minimum coverage'
if: ${{ matrix.os == needs.get_os.outputs.coverage_os }}
run: echo "minimum_coverage=$(cat ./.github/minimum_coverage.txt)" >> $GITHUB_ENV
- name: Enforce test coverage threshhold
if: ${{ matrix.os == needs.get_os.outputs.coverage_os }}
uses: VeryGoodOpenSource/[email protected]
with:
path: ./pr/lcov.info
min_coverage: ${{ env.minimum_coverage }}
swiftlint:
name: SwiftLint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Swift
uses: swift-actions/[email protected]
- name: Install SwiftLint
run: |
curl -L https://github.com/realm/SwiftLint/releases/download/0.54.0/swiftlint_linux.zip -o swiftlint.zip
unzip swiftlint.zip -d swiftlint
./swiftlint/swiftlint --version
- name: Run SwiftLint
run: ./swiftlint/swiftlint --strict --reporter github-actions-logging