New flags and tests #48
Workflow file for this run
This file contains 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] | |
pull_request: | |
branches: [main] | |
jobs: | |
test-swift: | |
name: Test Swift Code | |
runs-on: macos-13 | |
steps: | |
- name: Configure Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Build | |
run: swift build -v | |
- name: Run tests | |
run: swift test --enable-code-coverage -v | |
- name: Convert coverage report | |
run: Scripts/convert-coverage-report --target FileOrganiserPackageTests | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
lint-code: | |
name: Lint Swift Code | |
runs-on: macos-13 | |
steps: | |
- name: Configure Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Install SwiftLint | |
run: brew install swift-format peripheryapp/periphery/periphery | |
- name: Lint code | |
run: Scripts/lint-swift-code | |
- name: Scan for dead code | |
run: periphery scan --strict | |
deploy-pages: | |
name: Deploy Documentation to GitHub Pages | |
runs-on: macos-13 | |
if: github.event_name != 'pull_request' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
needs: | |
- test-swift | |
steps: | |
- name: Configure Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Build DocC | |
run: | | |
swift package \ | |
--allow-writing-to-directory "$RUNNER_TEMP/docs" \ | |
generate-documentation \ | |
--target FileOrganiserKit \ | |
--transform-for-static-hosting \ | |
--hosting-base-path FileOrganiser \ | |
--output-path "$RUNNER_TEMP/docs" | |
- name: Fix Root Path | |
run: echo "<script>window.location.href += \"documentation/fileorganiserkit\"</script>" > "$RUNNER_TEMP/docs/index.html" | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ${{ runner.temp }}/docs | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |