Skip to content

Commit

Permalink
chore(web3): use github actions (solana-labs#19816)
Browse files Browse the repository at this point in the history
* chore: use github actions

* chore: npm audit

* chore: fix prettier warn

* chore: fix doc errors

* chore: add puppeteer
  • Loading branch information
jstarry authored Sep 13, 2021
1 parent e1a038e commit 1942d29
Show file tree
Hide file tree
Showing 9 changed files with 554 additions and 504 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/web3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Web3

on:
push:
branches: [ master ]
paths:
- "web3.js/**"
pull_request:
branches: [ master ]
paths:
- "web3.js/**"

jobs:
check-web3:
runs-on: ubuntu-latest

defaults:
run:
working-directory: web3.js

strategy:
matrix:
node: [ '12', '14', '16' ]

name: Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v2
with:
# maybe needed for base sha below
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache-dependency-path: web3.js/package-lock.json
- run: npm i -g npm@7
- run: npm ci
- name: commit-lint
if: ${{ github.event_name == 'pull_request' }}
run: bash commitlint.sh
env:
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
- run: npm run lint
- run: |
npm run build
ls -l lib
test -r lib/index.iife.js
test -r lib/index.cjs.js
test -r lib/index.esm.js
- run: npm run doc
- run: npm run codecov
- run: |
sh -c "$(curl -sSfL https://release.solana.com/edge/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
solana --version
- run: npm run test:live-with-test-validator
- run: npm run test:browser-with-test-validator
24 changes: 0 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,30 +67,6 @@ jobs:
# before_install:
# - sudo apt-get install libssl-dev libudev-dev

# web3.js pull request
- name: "web3.js"
if: type = pull_request AND branch = master

language: node_js
node_js:
- "lts/*"

services:
- docker

cache:
directories:
- ~/.npm

before_install:
- .travis/affects.sh web3.js/ .travis || travis_terminate 0
- cd web3.js/
- source .travis/before_install.sh

script:
- ../.travis/commitlint.sh
- source .travis/script.sh

# docs pull request
- name: "docs"
if: type IN (push, pull_request) OR tag IS present
Expand Down
1 change: 0 additions & 1 deletion web3.js/.prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
arrowParens: "avoid"
bracketSpacing: false
jsxBracketSameLine: false
semi: true
singleQuote: true
tabWidth: 2
Expand Down
2 changes: 2 additions & 0 deletions web3.js/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ deploy:
on:
branch: master
node_js: "lts/*"

- provider: script
skip_cleanup: true
script:
- npx semantic-release
on:
branch: master
node_js: "lts/*"

- provider: releases
skip-cleanup: true
file:
Expand Down
8 changes: 4 additions & 4 deletions .travis/commitlint.sh → web3.js/commitlint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ if [[ ! -f "$basedir"/commitlint.config.js ]]; then
exit 1
fi

if [[ -z $TRAVIS_COMMIT_RANGE ]]; then
echo "Error: TRAVIS_COMMIT_RANGE not defined"
if [[ -z $COMMIT_RANGE ]]; then
echo "Error: COMMIT_RANGE not defined"
exit 1
fi

cd "$basedir"
echo "Checking commits in TRAVIS_COMMIT_RANGE: $TRAVIS_COMMIT_RANGE"
echo "Checking commits in COMMIT_RANGE: $COMMIT_RANGE"
while IFS= read -r line; do
echo "$line" | npx commitlint
done < <(git log "$TRAVIS_COMMIT_RANGE" --format=%s -- .)
done < <(git log "$COMMIT_RANGE" --format=%s -- .)
Loading

0 comments on commit 1942d29

Please sign in to comment.