Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #141 from libotony/dev
Browse files Browse the repository at this point in the history
ci: add web3 compatiability test
  • Loading branch information
libotony committed Mar 22, 2022
2 parents 23e5734 + eaf5d1e commit 98ea860
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 57 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/test.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/unit_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Unit Test

on:
workflow_call:
inputs:
node_ver:
required: true
type: string
web3_ver:
required: true
type: string


jobs:
unit_test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: ${{ inputs.node_ver }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{matrix.node}}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

- name: Install Web3
run: npm i web3-core-subscriptions@${{ inputs.web3_ver }} web3@${{ inputs.web3_ver }}

- name: Build project
run: npm run build

- name: Run tests
run: npm run test
84 changes: 84 additions & 0 deletions .github/workflows/unit_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Tests

on:
push:
branches:
- master
pull_request:

jobs:
job1:
name: Test on node@16 with web3@1.6
uses: ./.github/workflows/unit_template.yaml
with:
node_ver: 16
web3_ver: 1.6

job2:
name: Test on node@16 with web3@1.5
uses: ./.github/workflows/unit_template.yaml
with:
node_ver: 16
web3_ver: 1.5

job3:
name: Test on node@16 with web3@1.4
uses: ./.github/workflows/unit_template.yaml
with:
node_ver: 16
web3_ver: 1.4

job4:
name: Test on node@16 with web3@1.3
uses: ./.github/workflows/unit_template.yaml
with:
node_ver: 16
web3_ver: 1.3

job5:
name: Test on node@14 with web3@1.7
uses: ./.github/workflows/unit_template.yaml
with:
node_ver: 14
web3_ver: 1.7

job6:
name: Test on node@12 with web3@1.7
uses: ./.github/workflows/unit_template.yaml
with:
node_ver: 12
web3_ver: 1.7

test_and_coverage:
needs: [job1, job2, job3, job4, job5, job6]
runs-on: ubuntu-latest
name: Unit test and coverage

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: v16

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{matrix.node}}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Run tests
run: npm run cover

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 98ea860

Please sign in to comment.