Skip to content

RELEASE: disthelper update #893

RELEASE: disthelper update

RELEASE: disthelper update #893

Workflow file for this run

name: CI
on: push
jobs:
setup:
runs-on: ubuntu-latest
outputs:
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }}
steps:
- uses: actions/checkout@v2
- id: set-test-chunks
name: Set Chunks
run: echo "::set-output name=test-chunks::$(find test -name '*.ts' | jq -R -s -c 'split("\n")[:-1]' | jq -cM '[_nwise(length / 5 | floor)]')"
- id: set-test-chunk-ids
name: Set Chunk IDs
run: echo "::set-output name=test-chunk-ids::$(echo $CHUNKS | jq -cM 'to_entries | map(.key)')"
env:
CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
test:
runs-on: ubuntu-latest
needs: setup
name: test (chunk ${{ matrix.chunk }})
strategy:
matrix:
chunk: ${{ fromJson(needs.setup.outputs['test-chunk-ids']) }}
env:
CHUNKS: ${{ needs.setup.outputs['test-chunks'] }}
HARDHAT_MAX_MEMORY: 6096
NODE_OPTIONS: "--max-old-space-size=6096"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
- run: npm install -g yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Create env file
run: |
touch .env
echo MNEMONIC="dasdasds" >> .env
echo TEST="true" >> .env
cat .env
- name: Install project dependencies
run: yarn
- run: yarn compile
- name: Run tests
run: |
export TESTFILES=$(echo $CHUNKS | jq '.[${{ matrix.chunk }}][]')
echo $TESTFILES
yarn test:parallel $TESTFILES
coverage:
runs-on: ubuntu-latest
needs: setup
name: test (chunk ${{ matrix.chunk }})
strategy:
matrix:
chunk: ${{ fromJson(needs.setup.outputs['test-chunk-ids']) }}
env:
CHUNKS: ${{ needs.setup.outputs['test-chunks'] }}
HARDHAT_MAX_MEMORY: 6096
NODE_OPTIONS: "--max-old-space-size=6096"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
- run: npm install -g yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Create env file
run: |
touch .env
echo MNEMONIC="dasdasds" >> .env
echo TEST="true" >> .env
cat .env
- name: Install project
run: |
yarn
yarn compile
- name: Run coverage
run: |
export TESTFILES=\"$(echo $CHUNKS | jq -r '.[${{ matrix.chunk }}] | join("\",\"")')\"
echo $TESTFILES
yarn coverage --testfiles "{$TESTFILES}"
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: run-${{ matrix.chunk }}
coverage-done:
needs: coverage
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
deploy:
runs-on: ubuntu-latest
name: "version bump and publish to npm"
needs: test
if: github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, 'BETA:')
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
- run: npm install -g yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
#some mnemonic is requried in .env for hardhat config to compile
- name: Create env file
run: |
touch .env
echo MNEMONIC="dasdasds" >> .env
- name: "build"
run: |
yarn
yarn compile
yarn build:test-sdk
yarn minimize
- name: Automated Version Bump
uses: phips28/gh-action-bump-version@master
with:
patch-wording: "RELEASE"
default: prerelease
preid: beta
rc-wording: ""
target-branch: ${{ env.GITHUB_REF_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm
uses: aliberkhsl/npm-publish@master
with:
token: ${{ secrets.NPM_KEY_4BF8 }}
access: "public"