forked from w3f/Grants-Program
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adapt the workflow for local testing
adapt trigger type remove duplicate id testing test testing dai clean up the repo
- Loading branch information
Marcin Górny
committed
Jan 4, 2021
1 parent
6955df6
commit 43b2c91
Showing
6 changed files
with
92 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-P ubuntu-latest=nektos/act-environments-ubuntu:18.04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ACT=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Testing workflows | ||
|
||
While it requires some assumptions & is somewhat limited in scope, it's possible to run local testing on some of the workflows | ||
|
||
## Setup | ||
0. Setup your Google API Credentials on https://console.developers.google.com/ | ||
- Credentials -> Create Credentials -> Service Accounts | ||
|
||
1. Follow the instructions for installing [act](https://github.com/nektos/act) | ||
|
||
2. The act environment is configured via `.actrc` & `.env` files. For this repo, we set: | ||
- 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 | ||
- `ACT=true` environment variable. This way we can distinguish which steps to run | ||
|
||
3. Pull the above mentioned docker image: | ||
`docker pull nektos/act-environments-ubuntu:18.04` | ||
|
||
### Local Testing | ||
|
||
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 | ||
|
||
### Fork Testing | ||
4. Fork the Open Grants Repo | ||
|
||
5. Set up your secrets under the fork/settings: | ||
- GSHEET_PRIVATE_KEY | ||
- GSHEET_CLIENT_EMAIL | ||
- SPREADSHEET_ID | ||
|
||
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. | ||
|
||
## Usage | ||
|
||
``` | ||
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,31 +2,39 @@ name: Google Sheet Update | |
on: | ||
pull_request_target: | ||
types: [closed] | ||
# on: push | ||
|
||
jobs: | ||
fetch: | ||
update_sheet: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'get all added files in the PR' | ||
if: github.event.pull_request.merged == true | ||
if: ${{ github.event.pull_request.merged == true && !env.ACT }} | ||
id: 'files' | ||
uses: mmagician/get-changed-files@v0.0.1 | ||
uses: mmagician/get-changed-files@master | ||
|
||
- uses: actions/checkout@master | ||
if: github.event.pull_request.merged == true | ||
name: Checkout | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
if: ${{ github.event.pull_request.merged == true && !env.ACT }} | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Local Testing Checkout | ||
uses: actions/checkout@master | ||
if: ${{ env.ACT }} | ||
|
||
# - name: 'local testing parse files' | ||
# if: ${{ env.ACT }} | ||
# id: grant_parser | ||
# uses: mmagician/read-file-action@v1 | ||
# with: | ||
# path: 'applications/workflow_testing.md' | ||
|
||
- name: 'parse files' | ||
if: github.event.pull_request.merged == true | ||
if: ${{ github.event.pull_request.merged == true && !env.ACT }} | ||
id: grant_parser | ||
uses: mmagician/read-file-action@v0.1.2 | ||
uses: mmagician/read-file-action@v1 | ||
with: | ||
path: "${{ github.workspace }}/${{ steps.files.outputs.added }}" | ||
# local testing only | ||
# path: 'applications/workflow_testing_12.md' | ||
|
||
- name: Get current date | ||
if: github.event.pull_request.merged == true | ||
|
@@ -39,7 +47,7 @@ jobs: | |
uses: mmagician/[email protected] | ||
with: | ||
spreadsheetId: ${{ secrets.SPREADSHEET_ID }} | ||
startRow: 196 | ||
startRow: 220 | ||
worksheetTitle: "Legal" | ||
env: | ||
GSHEET_CLIENT_EMAIL: ${{ secrets.GSHEET_CLIENT_EMAIL }} | ||
|
@@ -72,7 +80,8 @@ jobs: | |
"https://github.com/w3f/Open-Grants-Program/pull/${{ github.event.pull_request.number }}", | ||
"https://github.com/w3f/Open-Grants-Program/pull/${{ github.event.pull_request.number }}", | ||
"USD", "0", "0", "0", | ||
"${{ steps.grant_parser.outputs.total_cost }}", | ||
"${{ steps.grant_parser.outputs.total_cost_btc }}", | ||
"${{ steps.grant_parser.outputs.total_cost_dai }}", | ||
"", | ||
"", | ||
"Executed", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"pull_request": { | ||
"head": { | ||
"ref": "10e629ef2f090f55a52b693961de8f5e1206d900" | ||
}, | ||
"base": { | ||
"ref": "10e629ef2f090f55a52b693961de8f5e1206d900" | ||
}, | ||
"state": "closed", | ||
"merged": true, | ||
"number": 12, | ||
"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." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Open Grant Proposal | ||
|
||
* **Project Name:** DuoSwap Module | ||
* **Team Name:** Duo | ||
* **Payment Address:** 123mp123 | ||
|
||
### Contact | ||
* **Contact Name:** John Brown | ||
* **Contact Email:** [email protected] | ||
|
||
### Legal Structure | ||
* **Registered Address:** High Street 1, London LK1 234, UK | ||
* **Registered Legal Entity:** Duo Ltd. | ||
|
||
### Overview | ||
* **Total Estimated Duration:** 2 months | ||
* **Total Costs:** 0.80 btc | ||
|