Skip to content

Commit 51d3caa

Browse files
Add proposal validation workflow and documentation
1 parent 8a9e053 commit 51d3caa

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Proposal Validation
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
project:
7+
type: string
8+
description: "Name of project supported by swift-evolution-metadata-extractor tool"
9+
default: swift
10+
11+
jobs:
12+
run-swift-evolution-metadata-extractor:
13+
name: Validate proposals with swift-evolution-metadata-extractor
14+
runs-on: ubuntu-latest
15+
container:
16+
image: "swift:6.2-noble"
17+
timeout-minutes: 10
18+
steps:
19+
- name: Checkout swiftlang/swift-evolution-metadata-extractor (main)
20+
uses: actions/checkout@v6
21+
with:
22+
repository: swiftlang/swift-evolution-metadata-extractor
23+
ref: main
24+
path: seme
25+
26+
- name: Create cache key
27+
id: cache-key
28+
run: echo "key=seme-$(git -C seme rev-parse HEAD)" >> $GITHUB_OUTPUT
29+
30+
- name: Restore cache
31+
uses: actions/cache/restore@v5
32+
id: restore-cache
33+
with:
34+
path: ${{ github.workspace }}/swift-evolution-metadata-extractor
35+
key: ${{ steps.cache-key.outputs.key }}
36+
37+
- name: Build swift-evolution-metadata-extractor (release)
38+
if: steps.restore-cache.outputs.cache-hit != 'true'
39+
run: |
40+
swift --version
41+
swift build -c release --very-verbose
42+
cp .build/release/swift-evolution-metadata-extractor $GITHUB_WORKSPACE/swift-evolution-metadata-extractor
43+
working-directory: seme
44+
45+
- name: Save to cache
46+
if: steps.restore-cache.outputs.cache-hit != 'true'
47+
id: save-to-cache
48+
uses: actions/cache/save@v5
49+
with:
50+
path: ${{ github.workspace }}/swift-evolution-metadata-extractor
51+
key: ${{ steps.cache-key.outputs.key }}
52+
53+
- name: Validate proposals
54+
run: $GITHUB_WORKSPACE/swift-evolution-metadata-extractor validate --pull-request ${{ github.event.number }}

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,38 @@ Linked PR: swiftlang/swift-syntax#2859
9494

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

97+
### Evolution Proposal Validation
98+
99+
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.
100+
101+
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.
102+
103+
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.
104+
105+
> [!NOTE]
106+
> 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.
107+
108+
An example workflow for Swift Testing which uses a subfolder in the swift-evolution repository:
109+
110+
```yaml
111+
name: Validate proposals with swift-evolution-metadata-extractor
112+
113+
on:
114+
pull_request:
115+
types: [opened, reopened, synchronize]
116+
branches:
117+
- 'main'
118+
paths:
119+
- 'proposals/testing/*'
120+
121+
jobs:
122+
validate:
123+
name: Validate Proposals
124+
uses: swiftlang/github-workflows/.github/workflows/proposal_validation.yml@main
125+
with:
126+
project: "testing"
127+
```
128+
97129
## Running workflows locally
98130

99131
You can run the Github Actions workflows locally using

0 commit comments

Comments
 (0)