/ .github / workflows / contract-test.yml
contract-test.yml
 1  name: Lint and Test from Root
 2  
 3  # run CI on pushes to master, and on all PRs (even the ones that target other
 4  # branches)
 5  
 6  on:
 7   push:
 8     branches:
 9       - main
10       - develop
11   pull_request:
12      # Sequence of patterns matched against refs/heads
13      branches:    
14        - main
15        - develop
16        - 'features/**'
17  jobs:
18    build:
19      runs-on: ubuntu-latest
20      strategy:
21        matrix:
22          # TODO: ['14.x', '16.x']
23          node-version: [16.18.x]
24      steps:
25      - name: Checkout dapp
26        uses: actions/checkout@v2
27  
28      # Select a branch on agoric-sdk to test against by adding text to the body of the
29      # pull request. For example: #agoric-sdk-branch: zoe-release-0.7.0
30      # The default is 'master'
31      - name: Get the appropriate agoric-sdk branch
32        id: get-branch
33        uses: actions/github-script@0.9.0
34        with:
35          result-encoding: string
36          script: |
37            const { body = '' } = context.payload.pull_request || {};
38            const regex = /.*\#agoric-sdk-branch:\s+(\S+)/;
39            const match = regex.exec(body);
40            const agoricSdkBranch = match && match[1] || 'master';
41            console.log(agoricSdkBranch);
42            return agoricSdkBranch;
43  
44      - name: Checkout agoric-sdk
45        uses: actions/checkout@v2
46        with:
47          repository: Agoric/agoric-sdk
48          path: agoric-sdk
49          ref: ${{steps.get-branch.outputs.result}}
50    
51      - name: Use Node.js ${{ matrix.node-version }}
52        uses: actions/setup-node@v1
53        with:
54          node-version: ${{ matrix.node-version }}
55  
56      - name: Setup and link agoric-sdk packages
57        run: |
58          yarn install
59          yarn build
60          yarn link-cli ~/bin/agoric
61          echo "/home/runner/bin" >> $GITHUB_PATH
62        working-directory: ./agoric-sdk
63  
64      - name: agoric install
65        run: agoric install
66      - name: test contracts
67        run: cd contract && yarn test