mirror of
https://github.com/apple/swift-nio
synced 2026-11-27 05:04:22 +00:00
* [GHA] Add license header check # Motivation We need to make sure all code files have the appropriate license headers in place. This is currently part of the soundness check and we need to replace this with a GH action. # Modification Adds a new job to the reusable workflow the check all files for license headers. Since some files are ignored every repo can specify a `.licenseignore` file. # Result Last part of the soundness script migrated. * Review * Remove default excludes
162 lines
5.5 KiB
YAML
162 lines
5.5 KiB
YAML
name: Pull Request
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
unit_tests_linux_enabled:
|
|
type: boolean
|
|
description: "Boolean to enable the unit tests linux job. Defaults to true."
|
|
default: true
|
|
benchmarks_linux_enabled:
|
|
type: boolean
|
|
description: "Boolean to enable the benchmarks linux job. Defaults to true."
|
|
default: true
|
|
benchmarks_linux_package_path:
|
|
type: string
|
|
description: "Path to the package containing the benchmarks. Defaults to the repository root."
|
|
default: "."
|
|
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
|
|
|
|
## We are cancelling previously triggered workflow runs
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
unit-tests-linux:
|
|
name: Unit tests
|
|
if: ${{ inputs.unit_tests_linux_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-jammy
|
|
- 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
|
|
|
|
benchmarks-linux:
|
|
name: Benchmarks
|
|
if: ${{ inputs.benchmarks_linux_enabled }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
swift:
|
|
- image: swift:5.8-jammy
|
|
swift_version: "5.8"
|
|
- image: swift:5.9-jammy
|
|
swift_version: "5.9"
|
|
- image: swift:5.10-jammy
|
|
swift_version: "5.10"
|
|
- image: swiftlang/swift:nightly-6.0-jammy
|
|
swift_version: "nightly-next"
|
|
- image: swiftlang/swift:nightly-main-jammy
|
|
swift_version: "nightly-main"
|
|
container:
|
|
image: ${{ matrix.swift.image }}
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
- name: Run tests
|
|
env:
|
|
PACKAGE_PATH: ${{ inputs.benchmarks_linux_package_path }}
|
|
SWIFT_VERSION: ${{ matrix.swift.swift_version }}
|
|
run: |
|
|
apt-get update -y -q && apt-get install -y -q libjemalloc-dev
|
|
swift package --package-path ${PACKAGE_PATH} --disable-sandbox benchmark baseline check --check-absolute-path ${PACKAGE_PATH}/Thresholds/${SWIFT_VERSION}/
|
|
|
|
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
|