Skip to content

Commit 98e1941

Browse files
committed
Update readme and include docs
This PR updates the README to include documentation about the soundness workflow and how to run actions locally.
1 parent 8122d81 commit 98e1941

File tree

1 file changed

+80
-5
lines changed

1 file changed

+80
-5
lines changed

README.md

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,50 @@
11
# GitHub Actions Workflows
22

3-
This repository will contain reusable workflows to minimize redundant workflows across the organization. This effort will also facilitate the standardization of testing processes while empowering repository code owners to customize their testing plans as needed. The repository will contain workflows to support different types of repositories, such as Swift Package and Swift Compiler.
3+
This repository will contain reusable workflows to minimize redundant workflows
4+
across the organization. This effort will also facilitate the standardization of
5+
testing processes while empowering repository code owners to customize their
6+
testing plans as needed. The repository will contain workflows to support
7+
different types of repositories, such as Swift Package and Swift Compiler.
48

5-
For more details on reusable workflows, please refer to the [Reusing workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflows) section in the GitHub Docs.
9+
For more details on reusable workflows, please refer to the [Reusing
10+
workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflows)
11+
section in the GitHub Docs.
612

713
## Reusable workflow for Swift package repositories
814

9-
To enable pull request testing for all supported Swift versions (5.8, 5.9, 5.10, 6.0, and nightly) on Linux, add the following code example in `.github/workflows/pull_request.yml`:
15+
There are different kinds of workflows that this repository offers:
16+
17+
### Soundness
18+
19+
The soundness workflows provides a multitude of checks to ensure a repository is
20+
following the best practices. By default each check is enabled but can be
21+
disabled by passing the appropriate workflow input. We recommend to adopt all
22+
soundness checks and enforce them on each PR.
23+
24+
A recommended workflow looks like this:
25+
26+
```yaml
27+
name: Pull request
28+
29+
on:
30+
pull_request:
31+
types: [opened, reopened, synchronize]
32+
33+
jobs:
34+
soundness:
35+
name: Soundness
36+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
37+
with:
38+
license_header_check_project_name: "Swift.org"
39+
```
40+
41+
### Testing
42+
43+
> ⚠️ This is workflow is currently under active development
44+
45+
To enable pull request testing for all supported Swift versions (5.8, 5.9, 5.10,
46+
6.0, and nightly) on Linux, add the following code example in
47+
`.github/workflows/pull_request.yml`:
1048

1149
```yaml
1250
name: pull_request
@@ -21,16 +59,53 @@ jobs:
2159
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
2260
```
2361

24-
If your package only supports newer compiler versions, you can exclude older versions by using the `exclude_swift_versions` workflow input:
62+
If your package only supports newer compiler versions, you can exclude older
63+
versions by using the `exclude_swift_versions` workflow input:
2564

2665
```yaml
2766
exclude_swift_versions: "[{\"swift_version\": \"5.8\"}]"
2867
```
2968

30-
Additionally, if your package requires additional installed packages, you can use the `pre_build_command`:
69+
Additionally, if your package requires additional installed packages, you can
70+
use the `pre_build_command`:
3171

3272
```yaml
3373
pre_build_command: "apt-get update -y -q && apt-get install -y -q example"
3474
```
3575

3676
macOS and Windows platform support will be available soon.
77+
78+
## Running workflows locally
79+
80+
You can run the Github Actions workflows locally using
81+
[act](https://github.com/nektos/act). To run all the jobs that run on a pull
82+
request, use the following command:
83+
84+
```bash
85+
% act pull_request
86+
```
87+
88+
To run just a single job, use `workflow_call -j <job>`, and specify the inputs
89+
the job expects. For example, to run just shellcheck:
90+
91+
```bash
92+
% act workflow_call -j soundness --input shell_check_enabled=true
93+
```
94+
95+
To bind-mount the working directory to the container, rather than a copy, use
96+
`--bind`. For example, to run just the formatting, and have the results
97+
reflected in your working directory:
98+
99+
```bash
100+
% act --bind workflow_call -j soundness --input format_check_enabled=true
101+
```
102+
103+
If you'd like `act` to always run with certain flags, these can be be placed in
104+
an `.actrc` file either in the current working directory or your home
105+
directory, for example:
106+
107+
```bash
108+
--container-architecture=linux/amd64
109+
--remote-name upstream
110+
--action-offline-mode
111+
```

0 commit comments

Comments
 (0)