Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions .github/workflows/api_breakage.yml

This file was deleted.

9 changes: 7 additions & 2 deletions .github/workflows/docc_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ jobs:
apt-get install -y curl jq

- name: Generate DocC documentation
env:
REPOSITORY_NAME: ${{ github.event.repository.name }}
run: |
curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/generate-docc.sh | bash -s -- --name ${{ github.event.repository.name }}
curl --fail --show-error --location --silent \
https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/generate-docc.sh \
--output "$RUNNER_TEMP/generate-docc.sh"
bash "$RUNNER_TEMP/generate-docc.sh" --name "$REPOSITORY_NAME"

- name: Upload DocC artifact
uses: actions/upload-pages-artifact@v3
Expand All @@ -56,4 +61,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
23 changes: 0 additions & 23 deletions .github/workflows/extra_soundness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ on:
type: string
description: "List of Swift versions to test with."
default: '["6.1", "6.2"]'
docc_warnings_check_enabled:
type: boolean
description: "Runs DocC analysis and fails on warnings. Defaults to false."
default: false
swift_package_validation_enabled:
type: boolean
description: "Runs Swift package validation script (structure, settings, files). Defaults to false."
Expand Down Expand Up @@ -82,25 +78,6 @@ jobs:
run: |
curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/check-swift-package.sh | bash

docc_warnings_check:
name: DocC warnings check
if: ${{ inputs.docc_warnings_check_enabled }}
runs-on: ubuntu-latest
container:
image: swift:6.2
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install curl + jq
run: |
apt-get update -y
apt-get install -y curl jq
- name: Run DocC warnings check
run: |
curl -s https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts/check-docc-warnings.sh | bash

cache-and-test:
name: Run tests with cache
env:
Expand Down
14 changes: 1 addition & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@ SHELL=/bin/bash

baseUrl = https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts

breakage:
curl -s $(baseUrl)/check-api-breakage.sh | bash

symlinks:
curl -s $(baseUrl)/check-broken-symlinks.sh | bash

## params: --local: generate for local testing
docc-generate:
curl -s $(baseUrl)/generate-docc.sh | bash

docc-local:
curl -s $(baseUrl)/generate-docc.sh | bash -s -- --local

docc-warnings:
curl -s $(baseUrl)/check-docc-warnings.sh | bash

## params: -n: name, -p: port
run-docc:
curl -s $(baseUrl)/run-docc-docker.sh | bash
Expand All @@ -37,9 +28,6 @@ openapi-security:
openapi-validation:
curl -s $(baseUrl)/check-openapi-validation.sh | bash

language:
curl -s $(baseUrl)/check-unacceptable-language.sh | bash

contributors:
curl -s $(baseUrl)/generate-contributors-list.sh | bash

Expand Down Expand Up @@ -75,7 +63,7 @@ format-shell:
lint-workflows:
curl -s $(baseUrl)/run-actionlint.sh | bash

check: symlinks language deps lint docc-warnings headers
check: deps lint headers

test-bats:
bats --recursive tests/bats
161 changes: 4 additions & 157 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ This section details the reusable workflows provided by the repository.

### 1. Extra Soundness Workflow (`extra_soundness.yml`)

This workflow provides configurable, robust checks and testing:
This workflow provides Binary Birds-specific checks and testing alongside the standard checks in [swiftlang/github-workflows](https://github.com/swiftlang/github-workflows):

* **Optional Local Swift Dependency Checks**: Checks for accidental `.package(path:)` usage.
* **Optional Swift Headers Check**: Validates Swift source file headers using a strict 5-line format and respects `.swiftheaderignore`.
* **Optional DocC Warnings Check**: Runs DocC analysis with `--warnings-as-errors` and fails on warnings.
* **Optional Swift Test Execution**: Runs tests with optional **`.build` caching** for efficiency.
* **Optional Swift Package Validation**: Validates Swift package structure, settings, and conventions to ensure consistency.
* **Multi-Version Support**: Tests across multiple Swift versions, configurable via input (defaulting to `["6.0", "6.1"]`).
Expand All @@ -37,7 +36,6 @@ This workflow provides configurable, robust checks and testing:
| ------ | ------------ | --------- |
| `local_swift_dependencies_check_enabled` | Enables local Swift dependency check | `false` |
| `headers_check_enabled` | Enables Swift headers validation | `false` |
| `docc_warnings_check_enabled` | Enables DocC warnings check | `false` |
| `run_tests_with_cache_enabled` | Enables the Swift test job | `false` |
| `tests_cache_enabled` | Enables `.build` cache restore/save in the Swift test job | `true` |
| `run_tests_swift_versions` | Swift versions to test | `["6.1","6.2"]` |
Expand All @@ -52,7 +50,6 @@ jobs:
with:
local_swift_dependencies_check_enabled: true
headers_check_enabled: true
docc_warnings_check_enabled: true
run_tests_with_cache_enabled: true
tests_cache_enabled: true
run_tests_swift_versions: '["6.1","6.2"]'
Expand All @@ -79,22 +76,6 @@ jobs:
id-token: write
```

### 3. API Breaking Changes Workflow (`api_breakage.yml`)

This workflow checks for API breaking changes in the repository:

* Runs API Breakage Checks: Executes the Binary Birds API breakage checking script.
* Swift-based Environment: Runs inside a swift:latest Docker container.
* Full Git History Available: Checks out the repository with complete history for accurate comparison.

#### Example Usage (Caller Repository)

```yaml
jobs:
check-api-breakage:
uses: BinaryBirds/github-workflows/.github/workflows/api_breakage.yml@main
```

-----

## Makefile Usage
Expand All @@ -119,114 +100,6 @@ These combined commands run several scripts in sequence to provide a quick, cons
The `Makefile` uses the variable `baseUrl` which points to the source of all scripts:
`https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts`

### DocC dependency placeholder requirement

DocC-related scripts rely on a placeholder inside `Package.swift` to safely inject the `swift-docc-plugin` dependency when needed.

Your `Package.swift` must contain a top-level `dependencies` section (even if empty) and include the following comment:

```swift
// [docc-plugin-placeholder]
```

This placeholder defines the only supported injection point. If either the dependencies section or the placeholder is missing, DocC scripts will fail intentionally.

```swift
dependencies: [
// [docc-plugin-placeholder]
]
```

The placeholder itself has no effect on builds and does not modify target-level dependencies.

### check-api-breakage.sh

#### Purpose

Detects source- and binary-level API breaking changes in Swift packages to prevent unintended public API regressions.

#### Behavior

* Uses `swift package diagnose-api-breaking-changes`
* Pull requests: fetches `${GITHUB_BASE_REF}` into a local `pull-base-ref` and compares against that ref
* Other contexts: fetches tags and compares against the latest Git tag
* If no tags exist, exits successfully with a warning
* Fails when breaking changes are detected

#### Parameters

_None_

#### Ignore files

_None_

#### Raw curl example

```sh
curl -s $(baseUrl)/check-api-breakage.sh | bash
```

---

### check-broken-symlinks.sh

#### Purpose

Ensures all git-tracked symbolic links resolve to valid targets.

#### Behavior

* Inspects only symbolic links
* Ignores regular missing files
* Reports each broken symlink explicitly
* Exits non-zero if any broken symlink is found

#### Parameters

_None_

#### Ignore files

_None_

#### Raw curl example

```sh
curl -s $(baseUrl)/check-broken-symlinks.sh | bash
```

---

### check-docc-warnings.sh

#### Purpose

Runs DocC documentation analysis in strict mode, treating warnings as errors.

#### Behavior

* Uses `.docctargetlist` when present, otherwise auto-detects targets
* Temporarily injects `swift-docc-plugin` if missing
* Requires a clean git working tree locally
* Restores git state after execution

#### Parameters

_None_

#### Ignore files

* `.docctargetlist` – explicitly defines documented targets

#### Raw curl example

```sh
curl -s $(baseUrl)/check-docc-warnings.sh | bash
```

---

### check-local-swift-dependencies.sh

#### Purpose
Expand Down Expand Up @@ -376,34 +249,6 @@ curl -s $(baseUrl)/check-swift-headers.sh | bash -s -- --fix --author "John Doe"

---

### check-unacceptable-language.sh

#### Purpose

Detects discouraged or outdated terminology to promote inclusive language.

#### Behavior

* Case-insensitive, whole-word matching
* Scans git-tracked files only
* Lines containing `ignore-unacceptable-language` are excluded from failures

#### Parameters

_None_

#### Ignore files

* `.unacceptablelanguageignore` – excludes paths from scanning

#### Raw curl example

```sh
curl -s $(baseUrl)/check-unacceptable-language.sh | bash
```

---

### generate-contributors-list.sh

#### Purpose
Expand Down Expand Up @@ -445,6 +290,8 @@ Generates DocC documentation into the `docs/` directory.
* Supports multiple Swift targets
* Enables combined documentation automatically
* Can transform output for static hosting
* Temporarily adds `swift-docc-plugin` with SwiftPM when needed; no manifest placeholder is required
* Restores the original `Package.swift` after generation

#### Parameters

Expand Down Expand Up @@ -747,7 +594,7 @@ Validates Swift package structure and configuration to enforce project-wide conv
* Ensures Swift tools version is 6.1 or newer
* Requires defaultSwiftSettings usage on all targets
* Enforces presence of the NonisolatedNonsendingByDefault Swift 6 concurrency feature
* Validates top-level dependencies section and DocC placeholder
* Validates the package manifest and target Swift settings
* Checks required directory structure (Sources/, Tests/)
* Ensures required repository files exist
* Verifies LICENSE contains the current year
Expand Down
9 changes: 2 additions & 7 deletions examples/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ on:

jobs:

api_breakage:
name: Check API breakage
uses: BinaryBirds/github-workflows/.github/workflows/api_breakage.yml@feature/breakage-workflow

swiftlang_checks:
name: Swiftlang Checks
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
Expand All @@ -20,8 +16,8 @@ jobs:
broken_symlink_check_enabled : true
unacceptable_language_check_enabled : true
shell_check_enabled : true
docs_check_enabled : false
api_breakage_check_enabled : false
docs_check_enabled : true
api_breakage_check_enabled : true
license_header_check_enabled : false
yamllint_check_enabled : false
python_lint_check_enabled : false
Expand All @@ -41,7 +37,6 @@ jobs:
uses: BinaryBirds/github-workflows/.github/workflows/extra_soundness.yml@main
with:
local_swift_dependencies_check_enabled : true
docc_warnings_check_enabled : true
run_tests_with_cache_enabled : true
tests_cache_enabled : true
headers_check_enabled : true
Expand Down
Loading
Loading