Skip to content

Commit 554f655

Browse files
authored
Merge pull request #30 from swiftlang/fb-readme
2 parents 8122d81 + 089f9d7 commit 554f655

File tree

1 file changed

+78
-5
lines changed

1 file changed

+78
-5
lines changed

README.md

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,48 @@
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+
To enable pull request testing for all supported Swift versions (5.8, 5.9, 5.10,
44+
6.0, and nightly) on Linux, add the following code example in
45+
`.github/workflows/pull_request.yml`:
1046

1147
```yaml
1248
name: pull_request
@@ -21,16 +57,53 @@ jobs:
2157
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
2258
```
2359

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

2663
```yaml
2764
exclude_swift_versions: "[{\"swift_version\": \"5.8\"}]"
2865
```
2966

30-
Additionally, if your package requires additional installed packages, you can use the `pre_build_command`:
67+
Additionally, if your package requires additional installed packages, you can
68+
use the `pre_build_command`:
3169

3270
```yaml
3371
pre_build_command: "apt-get update -y -q && apt-get install -y -q example"
3472
```
3573

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

0 commit comments

Comments
 (0)