Files
swift-nio/.github/workflows/pull_request_soundness.yml
T
Franz Busch c9756e1083 Adopt swift-format (#2794)
* Apply formatting

* Apply no block comments rule

* Apply OmitExplicitReturns

* Apple OnlyOneTrailingClosureArgument

* Apply NoAssignmentInExpressions

* Fix up DontRepeatTypeInStaticProperties lint errors

* Apply `OrderedImports`

* Apply `ReplaceForEachWithForLoop`

* format file

* Enable the formatting pipeline

* Adopt `AmbiguousTrailingClosureOverload`

* Fix license header

* Fix format check

* Fix `EndOfLineComment`

* Fix CI

* Adapt CI script to check if changes when running formatting

* Separate lint and format into to steps

* Fix format

* Adopt `UseEarlyExits`

* Revert "Adopt `UseEarlyExits`"

This reverts commit d1ac5bbe12.
2024-07-19 11:48:17 +02:00

135 lines
4.7 KiB
YAML

name: Pull Request
on:
workflow_call:
inputs:
api_breakage_check_enabled:
type: boolean
description: "Boolean to enable the API breakage check job. Defaults to true."
default: true
docs_check_enabled:
type: boolean
description: "Boolean to enable the docs check job. Defaults to true."
default: true
unacceptable_language_check_enabled:
type: boolean
description: "Boolean to enable the acceptable language check job. Defaults to true."
default: true
unacceptable_language_check_word_list:
type: string
description: "List of unacceptable words. Defaults to a sensible list of words."
default: "blacklist whitelist slave master sane sanity insane insanity kill killed killing hang hung hanged hanging" #ignore-unacceptable-language
license_header_check_enabled:
type: boolean
description: "Boolean to enable the license header check job. Defaults to true."
default: true
license_header_check_project_name:
type: string
description: "Name of the project called out in the license header."
required: true
broken_symlink_check_enabled:
type: boolean
description: "Boolean to enable the broken symlink check job. Defaults to true."
default: true
format_check_enabled:
type: boolean
description: "Boolean to enable the format check job. Defaults to true."
default: true
## We are cancelling previously triggered workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-soundness
cancel-in-progress: true
jobs:
api-breakage-check:
name: API breakage check
if: ${{ inputs.api_breakage_check_enabled }}
runs-on: ubuntu-latest
container:
image: swift:5.10-noble
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# We need to fetch everything otherwise only the head commit will be fetched.
fetch-depth: 0
- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Run API breakage check
run: swift package diagnose-api-breaking-changes origin/main
docs-check:
name: Documentation check
if: ${{ inputs.docs_check_enabled }}
runs-on: ubuntu-latest
container:
image: swift:5.10-noble
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run documentation check
run: |
apt-get -qq update && apt-get -qq -y install curl
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-docs.sh | bash
unacceptable-language-check:
name: Unacceptable language check
if: ${{ inputs.unacceptable_language_check_enabled }}
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run unacceptable language check
env:
UNACCEPTABLE_WORD_LIST: ${{ inputs.unacceptable_language_check_word_list}}
run: curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-unacceptable-language.sh | bash
license-header-check:
name: License headers check
if: ${{ inputs.license_header_check_enabled }}
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run license header check
env:
PROJECT_NAME: ${{ inputs.license_header_check_project_name }}
run: curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-license-header.sh | bash
broken-symlink-check:
name: Broken symlinks check
if: ${{ inputs.broken_symlink_check_enabled }}
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run broken symlinks check
run: curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-broken-symlinks.sh | bash
format-check:
name: Format check
if: ${{ inputs.format_check_enabled }}
runs-on: ubuntu-latest
container:
image: swiftlang/swift:nightly-6.0-jammy
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Run format lint check
run: swift format lint --strict --recursive --parallel .
- name: Run format and check for modified files
run: |
swift format format --parallel --recursive --in-place .
git diff-index --quiet HEAD