Merge pull request #417 from casper-ecosystem/update/mocha-config #863
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
name: ci-casper-js-sdk | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'dev' | |
- 'feat-*' | |
- 'release-*' | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- 'dev' | |
- 'feat-*' | |
- 'release-*' | |
paths-ignore: | |
- '**.md' | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
node-version: [18.x] | |
os: [ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
env: | |
FAUCET_PRIV_KEY: 'MC4CAQAwBQYDK2VwBCIEII8ULlk1CJ12ZQ+bScjBt/IxMAZNggClWqK56D1/7CbI' #ci/test-assets/secret-key.pem | |
NODE_URL: 'http://127.0.0.1:7777/rpc' | |
HTTP_EVENT_STREAM_URL: 'http://127.0.0.1:9999/events/main' | |
HTTPS_EVENT_STREAM_URL: 'https://events.mainnet.casperlabs.io/events/main' | |
NETWORK_NAME: 'casper-net-1' | |
RUST_LOG: 'INFO' | |
VERSION_QUERY: '{"jsonrpc": "2.0", "id": "1", "method": "info_get_status"}' | |
MAINNET_NODE_URL: 'https://rpc.mainnet.casperlabs.io/rpc' | |
TESTNET_NODE_URL: 'https://rpc.testnet.casperlabs.io/rpc' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b #v3.0.2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@5b949b50c3461bbcd5a540b150c368278160234a #v3.4.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
# https://github.com/dtinth/setup-github-actions-caching-for-turbo | |
- name: Setup Turbo cache server | |
uses: dtinth/setup-github-actions-caching-for-turbo@e26dc6b0473cc072107f6cb4f6e69d33ac2fc386 # v1.1.0 | |
- name: Install | |
run: yarn install | |
- name: Audits | |
run: yarn npm audit --environment production | |
- name: Lints | |
run: yarn lint:ci | |
- name: Unit Test | |
run: yarn test | |
- name: Generate coverage report | |
run: yarn test:coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Test docs build | |
run: yarn docs:build | |
- name: Test build | |
run: yarn build | |
# test mainnet | |
- name: Get the mainnet version | |
if: ${{ false }} | |
id: get-mainnet-version | |
run: echo "MAINNET_VERSION=$(curl -s -X POST --data-raw '${{ env.VERSION_QUERY }}' -H "Content-Type:application/json" ${{ env.MAINNET_NODE_URL }} | jq -r .result.build_version | cut -d "-" -f 1)" >> "$GITHUB_ENV" | |
- name: Test RPC - mainnet ${{ env.MAINNET_VERSION }} | |
if: ${{ false }} | |
run: npx casper-node-launcher-js node v${{ env.MAINNET_VERSION }} --daemon && npm run test:e2e && npx casper-node-launcher-js stop | |
# test testnet | |
- name: Get the testnet version | |
if: ${{ false }} | |
id: get-testnet-version | |
run: echo "TESTNET_VERSION=$(curl -s -X POST --data-raw '${{ env.VERSION_QUERY }}' -H "Content-Type:application/json" ${{ env.TESTNET_NODE_URL }} | jq -r .result.build_version | cut -d "-" -f 1)" >> "$GITHUB_ENV" | |
- name: Test RPC - testnet ${{ env.TESTNET_VERSION }} | |
if: ${{ false }} | |
run: npx casper-node-launcher-js node v${{ env.TESTNET_VERSION }} --daemon && npm run test:e2e && npx casper-node-launcher-js stop | |
- name: Get Latest Casper-Node Tag Version | |
if: ${{ false }} | |
run: | | |
echo "CASPER_TAG_VERSION=$(curl -s ${{ env.GH_API_URL }} | jq -r '.[].name' | grep 'v*' | sort -V | sed 's/_$//' | tail -n1)" >> $GITHUB_ENV | |
env: | |
GH_API_URL: 'https://api.github.com/repos/casper-network/casper-node/tags' | |
- name: Test RPC - Casper Node - ${{ env.CASPER_TAG_VERSION }} | |
# Runs action if the latest version is different from mainnet and testnet | |
if: ${{ false }} # && ${{ env.CASPER_TAG_VERSION }} != v${{ env.MAINNET_VERSION }} && ${{ env.CASPER_TAG_VERSION }} != v${{ env.TESTNET_VERSION }} | |
run: npx casper-node-launcher-js node ${{ env.CASPER_TAG_VERSION }} --daemon && npm run test:e2e && npx casper-node-launcher-js stop | |
- name: Test RPC - Casper Node - DEV | |
if: ${{ false }} | |
run: npx casper-node-launcher-js node dev --daemon && npm run test:e2e && npx casper-node-launcher-js stop |