Skip to content

Commit a85402b

Browse files
authored
Merge branch 'w3f:master' into master
2 parents 4c1f0db + 1942743 commit a85402b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+6392
-426
lines changed

.actrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.env

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/README.md

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,60 @@
11
# Testing workflows
22

3-
While it requires some assumptions & is somewhat limited in scope, it's possible to run local testing on some of the workflows
4-
5-
## Setup
6-
0. Setup your Google API Credentials on https://console.developers.google.com/
7-
- Credentials -> Create Credentials -> Service Accounts
8-
9-
1. Follow the instructions for installing [act](https://github.com/nektos/act)
10-
11-
2. The act environment is configured via `.actrc` & `.env` files. For this repo, we set:
12-
- the docker image used for testing to `nektos/act-environments-ubuntu:18.04`, corresponding to GitHub's test environment. Probably not all features are necessary, but we rely for example on the presence of `jq` in the image for JSON parsing
13-
- `ACT=true` environment variable. This way we can distinguish which steps to run
143

15-
3. Pull the above mentioned docker image:
16-
`docker pull nektos/act-environments-ubuntu:18.04`
4+
## Fork testing (on GitHub)
5+
1. Fork the Open Grants repo (or create a private repo and push to it)
176

18-
### Local Testing
7+
2. Set up your secrets under the fork/settings:
8+
- GSHEET_PRIVATE_KEY
9+
- GSHEET_CLIENT_EMAIL
10+
- SPREADSHEET_ID
11+
- ACTIONS_STEP_DEBUG: set this to true for more verbose logs on workflow runs
12+
- ACTIONS_RUNNER_DEBUG: similar as above, haven't tried it
1913

20-
4. Modify the `google_sheet_update.yml` to replace the `parse files` section with `local testing parse files` (since they have the same ID, they can't both be used in the yml or else GitHub will complain). They should both be there by default, it's just a matter of commenting one section out
14+
3. Branch off from master. Create a PR with only 1 file added (e.g. `cp deliveries/.delivery_testing.md deliveries/.delivery_testing_2.md`, add & commit it). Different workflows are triggered on different conditions. Note: Push any changes to your fork's master branch before you branch off, because the workflow to run will be the one from master.
2115

22-
### Fork Testing
23-
4. Fork the Open Grants Repo
16+
## Local testing
2417

25-
5. Set up your secrets under the fork/settings:
26-
- GSHEET_PRIVATE_KEY
27-
- GSHEET_CLIENT_EMAIL
28-
- SPREADSHEET_ID
29-
30-
6. Branch off from master. Create a PR with only 1 file added (e.g. `cp applications/workflow_testing.md applications/workflow_testing_2.md`, add & commit it). To trigger the workflow, you need to merge the PR (into your own fork). Note: Push any changes to fork's master branch before you branch off, because the workflow to run will be the one from master.
31-
32-
## Usage
18+
While it requires some assumptions & is somewhat limited in scope, it's possible to run local testing on some of the workflows
3319

34-
```
35-
act -s GSHEET_PRIVATE_KEY="$(< .gsheet_private_key)" -s GSHEET_CLIENT_EMAIL="$(< .gsheet_client_email)" -s SPREADSHEET_ID="$(< .spreadsheet_id)" -e .pr_event.json -j update_sheet
36-
```
20+
### Setup
21+
0. Setup your Google API Credentials on https://console.developers.google.com/
22+
- Credentials -> Create Credentials -> Service Accounts
23+
1. Follow the instructions for installing [act](https://github.com/nektos/act)
24+
2. The act environment is configured via `.actrc` & `.env` files. For this repo, we set:
25+
- the docker image used for testing to `nektos/act-environments-ubuntu:18.04`, corresponding to GitHub's test environment. Probably not all features are necessary, but we rely for example on the presence of `jq` in the image for JSON parsing.
26+
```
27+
echo "-P ubuntu-latest=nektos/act-environments-ubuntu:18.04" > .actrc
28+
```
29+
- `ACT=true` environment variable. This way we can distinguish which steps to run
30+
```
31+
echo "ACT=true" > .env
32+
```
33+
3. Pull the above mentioned docker image:
34+
```
35+
docker pull nektos/act-environments-ubuntu:18.04
36+
```
37+
38+
### Testing
39+
40+
4. Modify the `google_sheet_update.yml` to replace the `parse files` section with `local testing parse files` (since they have the same ID, they can't both be used in the yml or else GitHub will complain). They should both be there by default, it's just a matter of commenting one section out.
41+
5. Create a sample pull request file:
42+
```
43+
echo '{
44+
"pull_request": {
45+
"head": {
46+
"ref": "10e629ef2f090f55a52b693961de8f5e1206d900"
47+
},
48+
"base": {
49+
"ref": "10e629ef2f090f55a52b693961de8f5e1206d900"
50+
},
51+
"state": "open",
52+
"author": "mmagician",
53+
"number": 174,
54+
"body": "# Grant Application Checklist\n- [X] The [application-template.md](https://github.com/w3f/Open-Grants-Program/blob/master/applications/application-template.md) has been copied, renamed ( \"project_name.md\") and updated."
55+
}
56+
}' > .pr_event.json
57+
```
58+
6. ```
59+
act -s GSHEET_PRIVATE_KEY="$(< .gsheet_private_key)" -s GSHEET_CLIENT_EMAIL="$(< .gsheet_client_email)" -s SPREADSHEET_ID="$(< .spreadsheet_id)" -e .pr_event.json -j update_sheet
60+
```

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ $RECYCLE.BIN/
5858
*.lnk
5959

6060
# End of https://www.toptal.com/developers/gitignore/api/macos,windows
61+
62+
# IDE settings
63+
.vscode

.pr_event.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)