Skip to content

linting

linting #161

Workflow file for this run

name: BushelKit
on:
push:
branches-ignore:
- '*WIP'
env:
PACKAGE_NAME: BushelKit
jobs:
build-ubuntu:
name: Build on Ubuntu
env:
SWIFT_VER: 6.0
if: "!contains(github.event.head_commit.message, 'ci skip')"
runs-on: ubuntu-latest
container:
image: swift:6.0-noble
steps:
- uses: actions/checkout@v4
- name: Cache swift package modules
id: cache-spm-linux
uses: actions/cache@v4
env:
cache-name: cache-spm
with:
path: .build
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.swift-version }}-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ matrix.swift-version }}-
${{ runner.os }}-${{ env.cache-name }}-
- name: Test
run: swift test --enable-code-coverage
- uses: sersoft-gmbh/swift-coverage-action@v4
id: coverage-files
with:
fail-on-empty-output: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
flags: swift-${{ matrix.swift-version }},ubuntu
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
build-macos:
name: Build on macOS
runs-on: [self-hosted, macOS]
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v4
- name: Cache swift package modules
id: cache-spm-macos
uses: actions/cache@v4
env:
cache-name: cache-spm
with:
path: .build
key: ${{ matrix.os }}-build-${{ env.cache-name }}-Xcode16-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ matrix.os }}-build-${{ env.cache-name }}-Xcode16-
- name: Cache mint
id: cache-mint
uses: actions/cache@v4
env:
cache-name: cache-mint
with:
path: .mint
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Mintfile') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Build
run: swift build
- name: Run Swift Package tests
run: swift test --enable-code-coverage
- uses: sersoft-gmbh/swift-coverage-action@v4
id: coverage-files-spm
with:
fail-on-empty-output: true
ignore-conversion-failures: true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: ${{ join(fromJSON(steps.coverage-files-spm.outputs.files), ',') }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: macOS,${{ env.XCODE_NAME }},macos
- name: Clean up spm build directory
run: rm -rf .build
- name: Lint
run: ./scripts/lint.sh
- name: Run iOS target tests
run: xcodebuild test -scheme BushelKit-Package -sdk iphonesimulator18.1 -destination "OS=18.1,name=iPhone 16" -enableCodeCoverage YES build test
- uses: sersoft-gmbh/swift-coverage-action@v4
id: coverage-files-iOS
with:
fail-on-empty-output: true
ignore-conversion-failures: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ join(fromJSON(steps.coverage-files-iOS.outputs.files), ',') }}
flags: iOS,iOS18,macOS,Xcode16
- name: Run watchOS target tests
run: xcodebuild test -scheme BushelKit-Package -sdk watchsimulator11.1 -destination "OS=11.1,name=Apple Watch Series 10 (46mm)" -enableCodeCoverage YES build test
- uses: sersoft-gmbh/swift-coverage-action@v4
id: coverage-files-watchOS
with:
fail-on-empty-output: true
ignore-conversion-failures: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ join(fromJSON(steps.coverage-files-watchOS.outputs.files), ',') }}
flags: watchOS,watchOS11,macOS,Xcode16
build-docc:
name: Build DocC
needs: [build-macos, build-ubuntu]
runs-on: ubuntu-latest
container:
image: swift:6.0-noble
volumes:
- ${{ github.workspace }}:/workspace
steps:
- uses: actions/checkout@v4
- name: Cache swift package modules
id: cache-spm-linux
uses: actions/cache@v4
env:
cache-name: cache-spm
with:
path: .build
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.swift-version }}-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ matrix.swift-version }}-
${{ runner.os }}-${{ env.cache-name }}-
- name: Build DocC
run: swift package generate-documentation --platform "name=macos,version=15.1" --transform-for-static-hosting --hosting-base-path "swift-docc" --disable-indexing --enable-experimental-combined-documentation
- name: Package DocArchive
if: github.ref == 'refs/heads/main'
working-directory: .build/plugins/Swift-DocC/outputs
run: tar -cf BushelKit.doccarchive.tar BushelKit.doccarchive
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/main'
with:
overwrite: true
path: /workspace/.build/plugins/Swift-DocC/outputs/BushelKit.doccarchive.tar
retention-days: 30
- uses: peter-evans/repository-dispatch@v3
if: github.ref == 'refs/heads/main'
with:
token: ${{ secrets.PAT_TOKEN }}
repository: brightdigit/BushelDocs
event-type: docc-update
client-payload: '{"run_id": "${{ github.run_id }}"}'