mirror of
https://github.com/apple/swift-nio
synced 2026-11-27 05:04:22 +00:00
* [GHA] Unacceptable language check # Motivation Next up replacing part of our soundness script that checked for unacceptable language. # Modification This PR adds a new GH action that checks for unacceptable language. # Result One more script replaced * PR review * Change homepage link to repo
107 lines
3.4 KiB
YAML
107 lines
3.4 KiB
YAML
name: Pull Request
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
unit_tests_enabled:
|
|
type: boolean
|
|
description: "Boolean to enable the unit tests job. Defaults to true."
|
|
default: true
|
|
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
|
|
|
|
## We are cancelling previously triggered workflow runs
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
unit-tests:
|
|
name: Unit tests
|
|
if: ${{ inputs.unit_tests_enabled }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
swift:
|
|
- image: swift:5.8-jammy
|
|
- image: swift:5.9-jammy
|
|
- image: swift:5.10-noble
|
|
- image: swiftlang/swift:nightly-6.0-jammy
|
|
- image: swiftlang/swift:nightly-main-jammy
|
|
container:
|
|
image: ${{ matrix.swift.image }}
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
- name: Run tests
|
|
run: swift test
|
|
|
|
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
|
|
shell: bash
|
|
run: |
|
|
set -eu
|
|
|
|
raw_targets=$(sed -E -n -e 's/^.* - documentation_targets: \[(.*)\].*$/\1/p' .spi.yml)
|
|
targets=(${raw_targets//,/ })
|
|
|
|
for target in "${targets[@]}"; do
|
|
swift package plugin generate-documentation --target "$target" --warnings-as-errors --analyze --level detailed
|
|
done
|
|
|
|
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: ./scripts/unacceptable_language_check.sh |