Skip to content

Use SwiftLint

Use SwiftLint #33

Workflow file for this run

name: CI/CD
on:
# Push on main excluding tags
push:
branches:
- 'main'
tags-ignore:
- '*.*'
# PR
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: CI/CD
runs-on: macos-15
permissions:
actions: read
checks: write
contents: read
pull-requests: write
security-events: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install tooling
run: |
brew install xcresultparser swiftlint
- name: Swift Package Manager cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Generate SwiftLint SARIF
if: ${{ !cancelled() }}
continue-on-error: true
run: |
swiftlint lint --no-cache --quiet --config .swiftlint.yml --reporter sarif ORLib > swiftlint.sarif || true
- name: Upload SwiftLint SARIF
if: ${{ !cancelled() }}
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
sarif_file: swiftlint.sarif
category: swiftlint
- name: Build and test
run: |
xcodebuild test -project ORLib.xcodeproj -sdk iphoneos \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' -scheme ORLib -resultBundlePath ORLib.xcresult
- name: Extract JUnit test report
run: |
xcresultparser -o junit ORLib.xcresult > junit.xml
if: ${{ !cancelled() }}
- name: Publish Test Report with Insights
uses: ctrf-io/github-test-reporter@024bc4b64d997ca9da86833c6b9548c55c620e40 # v1
if: ${{ !cancelled() }}
with:
report-path: 'junit.xml'
integrations-config: |
{
"junit-to-ctrf": {
"enabled": true,
"action": "convert",
"options": {
"output": "./ctrf-reports/ctrf-report.json",
"toolname": "junit-to-ctrf",
"useSuiteName": false,
"env": {
"appName": "ORLib"
}
}
}
}
github-report: true
upload-artifact: true
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Test Report
uses: dorny/test-reporter@fe45e9537387dac839af0d33ba56eed8e24189e8 # v2
if: ${{ !cancelled() }}
with:
name: ORLib Tests
path: junit.xml
reporter: jest-junit