Fix swiflint #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Swift | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| name: Test on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-latest] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Swift | |
| uses: swift-actions/setup-swift@v1 | |
| with: | |
| swift-version: '5.9' | |
| - name: Show Swift version | |
| run: swift --version | |
| - name: Build | |
| run: swift build -v | |
| - name: Run tests | |
| run: swift test -v --enable-code-coverage | |
| - name: Generate coverage report (macOS only) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| xcrun llvm-cov export \ | |
| .build/debug/PartialJSONPackageTests.xctest/Contents/MacOS/PartialJSONPackageTests \ | |
| -instr-profile .build/debug/codecov/default.profdata \ | |
| -format="lcov" > coverage.lcov | |
| - name: Upload coverage to Codecov (macOS only) | |
| if: matrix.os == 'macos-latest' | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.lcov | |
| fail_ci_if_error: false | |
| lint: | |
| name: SwiftLint | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install SwiftLint | |
| run: brew install swiftlint | |
| - name: Run SwiftLint | |
| run: swiftlint --strict | |
| documentation: | |
| name: Generate Documentation | |
| runs-on: macos-latest | |
| if: github.ref == 'refs/heads/main' | |
| needs: [test, lint] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Swift | |
| uses: swift-actions/setup-swift@v1 | |
| with: | |
| swift-version: '5.9' | |
| - name: Generate Documentation | |
| run: | | |
| swift package generate-documentation \ | |
| --target PartialJSON \ | |
| --disable-indexing \ | |
| --transform-for-static-hosting \ | |
| --hosting-base-path PartialJSON \ | |
| --output-path ./docs | |
| - name: Upload Documentation to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs | |
| validate-documentation: | |
| name: Validate Documentation | |
| runs-on: macos-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Swift | |
| uses: swift-actions/setup-swift@v1 | |
| with: | |
| swift-version: '5.9' | |
| - name: Validate Documentation | |
| run: | | |
| swift package generate-documentation \ | |
| --target PartialJSON \ | |
| --disable-indexing |