Skip to content
Open
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
54 changes: 54 additions & 0 deletions .github/workflows/proposal_validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Proposal Validation

on:
workflow_call:
inputs:
project:
type: string
description: "Name of project supported by swift-evolution-metadata-extractor tool"
default: swift

jobs:
run-swift-evolution-metadata-extractor:
name: Validate proposals with swift-evolution-metadata-extractor
runs-on: ubuntu-latest
container:
image: "swift:6.2-noble"
timeout-minutes: 10
steps:
- name: Checkout swiftlang/swift-evolution-metadata-extractor (main)
uses: actions/checkout@v6
with:
repository: swiftlang/swift-evolution-metadata-extractor
ref: main
path: seme

- name: Create cache key
id: cache-key
run: echo "key=seme-$(git -C seme rev-parse HEAD)" >> $GITHUB_OUTPUT

- name: Restore cache
uses: actions/cache/restore@v5
id: restore-cache
with:
path: ${{ github.workspace }}/swift-evolution-metadata-extractor
key: ${{ steps.cache-key.outputs.key }}

- name: Build swift-evolution-metadata-extractor (release)
if: steps.restore-cache.outputs.cache-hit != 'true'
run: |
swift --version
swift build -c release --very-verbose
cp .build/release/swift-evolution-metadata-extractor $GITHUB_WORKSPACE/swift-evolution-metadata-extractor
working-directory: seme

- name: Save to cache
if: steps.restore-cache.outputs.cache-hit != 'true'
id: save-to-cache
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}/swift-evolution-metadata-extractor
key: ${{ steps.cache-key.outputs.key }}

- name: Validate proposals
run: $GITHUB_WORKSPACE/swift-evolution-metadata-extractor validate --pull-request ${{ github.event.number }}
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,38 @@ Linked PR: swiftlang/swift-syntax#2859

Enabling cross-PR testing will add about 10s to PR testing time.

### Evolution Proposal Validation

The proposal validation workflow validates added and changed proposals in a pull request to check for formatting and content errors that will cause metadata extraction to fail or be incomplete.

To accomplish this, the workflow builds the [swift-evolution-metadata-extractor](https://github.com/swiftlang/swift-evolution-metadata-extractor) tool and runs its `validate` command. To minimize validation times, the built tool is cached and only rebuilt when the tool has changed.

To use the proposal validation workflow, add a workflow to the repository that contains the directory of proposals. The calling workflow specifies project-specific details such as the directory where the proposals are located. It is only run if a pull request contains changes in the specified directory.

> [!NOTE]
> The extraction tool currently only supports the evolution proposals of the Swift project at swiftlang/swift-evolution/proposals. The tool and workflow has been designed to be extended to support additional projects in the future.

An example workflow for Swift Testing which uses a subfolder in the swift-evolution repository:

```yaml
name: Validate proposals with swift-evolution-metadata-extractor

on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- 'main'
paths:
- 'proposals/testing/*'

jobs:
validate:
name: Validate Proposals
uses: swiftlang/github-workflows/.github/workflows/proposal_validation.yml@main
with:
project: "testing"
```

## Running workflows locally

You can run the Github Actions workflows locally using
Expand Down
Loading