forked from Agoric/agoric-sdk
-
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.
Add test dapp workflow template (Agoric#1897)
* chore: add a workflow template for testing a dapp * chore: use test-dapp template in test-dapp-encouragement * chore: standardize documentation workflow * chore: assume that dapps should have a main branch, not master * chore: address PR comments * chore: fix comment
- Loading branch information
1 parent
48682e2
commit 18c0314
Showing
3 changed files
with
120 additions
and
36 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,82 @@ | ||
name: Test Dapp | ||
|
||
# run CI on pushes to master, and on all PRs (even the ones that target other | ||
# branches) | ||
|
||
on: | ||
push: | ||
branches: [ $default-branch ] | ||
pull_request: | ||
|
||
jobs: | ||
test-dapp: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: ['14.x'] | ||
|
||
steps: | ||
|
||
- name: Checkout agoric-sdk | ||
uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: cache node modules | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/yarn | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
# Select a branch on dapp to test against by adding text to the body of the | ||
# pull request. For example: #dapp-encouragement-branch: zoe-release-0.7.0 | ||
# The default is 'main' | ||
- name: Get the appropriate dapp branch | ||
id: get-branch | ||
uses: actions/[email protected] | ||
with: | ||
result-encoding: string | ||
script: | | ||
let branch = 'main'; | ||
if (context.payload.pull_request) { | ||
const { body } = context.payload.pull_request; | ||
const regex = /.*\#[[INSERT_DAPP_NAME]]-branch:\s+(\S+)/; | ||
const result = regex.exec(body); | ||
if (result) { | ||
branch = result[1]; | ||
} | ||
} | ||
console.log(branch); | ||
return branch; | ||
- name: yarn install | ||
run: yarn install | ||
# 'yarn build' loops over all workspaces | ||
- name: yarn build | ||
run: yarn build | ||
- name: yarn link | ||
run: | | ||
yarn link-cli ~/bin/agoric | ||
echo "::add-path::/home/runner/bin" | ||
- name: Check out dapp | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: Agoric/[[INSERT_DAPP_NAME]] | ||
path: dapp | ||
ref: ${{steps.get-branch.outputs.result}} | ||
|
||
- name: Agoric install in dapp | ||
run: agoric install | ||
working-directory: ./dapp | ||
|
||
- name: yarn build in dapp | ||
run: yarn build | ||
working-directory: ./dapp | ||
|
||
- name: yarn test in dapp | ||
run: yarn test | ||
working-directory: ./dapp |
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 |
---|---|---|
|
@@ -4,16 +4,17 @@ name: Test Dapp Encouragement | |
# branches) | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
push: | ||
branches: [ $default-branch ] | ||
pull_request: | ||
|
||
jobs: | ||
dapp-encouragement: | ||
test-dapp: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: ['12.14.1', '12.x', '14.x'] | ||
node-version: ['14.x'] | ||
|
||
steps: | ||
|
||
- name: Checkout agoric-sdk | ||
|
@@ -31,16 +32,16 @@ jobs: | |
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
# Select a branch on dapp-encouragement to test against by adding text to the body of the | ||
# Select a branch on dapp to test against by adding text to the body of the | ||
# pull request. For example: #dapp-encouragement-branch: zoe-release-0.7.0 | ||
# The default is 'master' | ||
- name: Get the appropriate dapp-encouragement branch | ||
# The default is 'main' | ||
- name: Get the appropriate dapp branch | ||
id: get-branch | ||
uses: actions/[email protected] | ||
with: | ||
result-encoding: string | ||
script: | | ||
let branch = 'master'; | ||
let branch = 'main'; | ||
if (context.payload.pull_request) { | ||
const { body } = context.payload.pull_request; | ||
const regex = /.*\#dapp-encouragement-branch:\s+(\S+)/; | ||
|
@@ -54,8 +55,6 @@ jobs: | |
- name: yarn install | ||
run: yarn install | ||
- name: check dependencies | ||
run: yarn check-dependencies | ||
# 'yarn build' loops over all workspaces | ||
- name: yarn build | ||
run: yarn build | ||
|
@@ -64,21 +63,21 @@ jobs: | |
yarn link-cli ~/bin/agoric | ||
echo "/home/runner/bin" >> $GITHUB_PATH | ||
- name: Check out dapp-encouragement | ||
- name: Check out dapp | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: Agoric/dapp-encouragement | ||
path: dapp-encouragement | ||
path: dapp | ||
ref: ${{steps.get-branch.outputs.result}} | ||
|
||
- name: Agoric install in dapp-encouragement | ||
- name: Agoric install in dapp | ||
run: agoric install | ||
working-directory: ./dapp-encouragement | ||
working-directory: ./dapp | ||
|
||
- name: yarn build in dapp-encouragement | ||
- name: yarn build in dapp | ||
run: yarn build | ||
working-directory: ./dapp-encouragement | ||
working-directory: ./dapp | ||
|
||
- name: yarn test in dapp-encouragement | ||
- name: yarn test in dapp | ||
run: yarn test | ||
working-directory: ./dapp-encouragement | ||
working-directory: ./dapp |
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 |
---|---|---|
|
@@ -4,16 +4,17 @@ name: Test Documentation | |
# branches) | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
push: | ||
branches: [ $default-branch ] | ||
pull_request: | ||
|
||
jobs: | ||
documentation: | ||
test-dapp: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: ['14.x'] | ||
|
||
steps: | ||
|
||
- name: Checkout agoric-sdk | ||
|
@@ -31,16 +32,16 @@ jobs: | |
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
# Select a branch on documentation to test against by adding text to the body of the | ||
# pull request. For example: #documentation-branch: zoe-release-0.7.0 | ||
# The default is 'master' | ||
- name: Get the appropriate documentation branch | ||
# Select a branch on dapp to test against by adding text to the body of the | ||
# pull request. For example: #dapp-encouragement-branch: zoe-release-0.7.0 | ||
# The default is 'main' | ||
- name: Get the appropriate dapp branch | ||
id: get-branch | ||
uses: actions/[email protected] | ||
with: | ||
result-encoding: string | ||
script: | | ||
let branch = 'master'; | ||
let branch = 'main'; | ||
if (context.payload.pull_request) { | ||
const { body } = context.payload.pull_request; | ||
const regex = /.*\#documentation-branch:\s+(\S+)/; | ||
|
@@ -54,8 +55,6 @@ jobs: | |
- name: yarn install | ||
run: yarn install | ||
- name: check dependencies | ||
run: yarn check-dependencies | ||
# 'yarn build' loops over all workspaces | ||
- name: yarn build | ||
run: yarn build | ||
|
@@ -64,17 +63,21 @@ jobs: | |
yarn link-cli ~/bin/agoric | ||
echo "/home/runner/bin" >> $GITHUB_PATH | ||
- name: Check out documentation | ||
- name: Check out dapp | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: Agoric/documentation | ||
path: documentation | ||
path: dapp | ||
ref: ${{steps.get-branch.outputs.result}} | ||
|
||
- name: Agoric install in documentation | ||
- name: Agoric install in dapp | ||
run: agoric install | ||
working-directory: ./documentation | ||
working-directory: ./dapp | ||
|
||
- name: yarn build in dapp | ||
run: yarn build | ||
working-directory: ./dapp | ||
|
||
- name: yarn test in documentation | ||
- name: yarn test in dapp | ||
run: yarn test | ||
working-directory: ./documentation | ||
working-directory: ./dapp |