mirror of https://github.com/waku-org/js-waku.git
123 lines
3.2 KiB
YAML
123 lines
3.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
- "staging"
|
|
- "trying"
|
|
pull_request:
|
|
|
|
env:
|
|
NWAKU_VERSION: "v0.11"
|
|
NODE_JS: "16"
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ env.NODE_JS }}
|
|
- uses: bahmutov/npm-install@v1
|
|
- run: npm run test:lint
|
|
- run: npm run test:prettier
|
|
- run: npm run test:spelling
|
|
- run: npm run test:tsc
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ env.NODE_JS }}
|
|
- uses: bahmutov/npm-install@v1
|
|
- run: npm run build
|
|
|
|
proto:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ env.NODE_JS }}
|
|
- uses: bahmutov/npm-install@v1
|
|
- name: Generate protobuf code
|
|
run: |
|
|
npm run proto
|
|
npm run fix
|
|
- name: Check all protobuf code was committed
|
|
shell: bash
|
|
run: |
|
|
res=$(git status --short --ignore-submodules)
|
|
echo -n "'$res'" # For debug purposes
|
|
[ $(echo -n "$res"|wc -l) -eq 0 ]
|
|
|
|
browser:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ env.NODE_JS }}
|
|
- uses: bahmutov/npm-install@v1
|
|
- run: npm run test:browser
|
|
|
|
node:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Get nwaku
|
|
shell: bash
|
|
run: |
|
|
mkdir -p nwaku/build
|
|
cd nwaku
|
|
wget "https://github.com/status-im/nwaku/releases/download/${NWAKU_VERSION}/nim-waku-ubuntu-latest.tar.gz"
|
|
tar xavf nim-waku-ubuntu-latest.tar.gz
|
|
- name: Ensure wakunode2 is ready
|
|
shell: bash
|
|
run: |
|
|
uname -a
|
|
cd nwaku/build
|
|
./wakunode2 --help
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ env.NODE_JS }}
|
|
- uses: bahmutov/npm-install@v1
|
|
- run: npm run test:node
|
|
env:
|
|
DEBUG: "waku:nwaku*,waku:test*"
|
|
|
|
- name: Upload logs on failure
|
|
uses: actions/upload-artifact@v2
|
|
if: failure()
|
|
with:
|
|
name: nwaku-logs
|
|
path: log/
|
|
|
|
release_next:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
needs: [check, build, proto, browser, node]
|
|
steps:
|
|
- uses: actions/checkout@v2.3.3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ env.NODE_JS }}
|
|
- uses: bahmutov/npm-install@v1
|
|
|
|
- name: Append git hash to version
|
|
shell: bash
|
|
run: |
|
|
CURR_VERSION=$(cat package.json | jq .version | tr -d '"')
|
|
GIT_HASH=$(git rev-parse --short HEAD)
|
|
cat package.json| jq --arg version "$CURR_VERSION-$GIT_HASH" '.version |= $version' > _package.json
|
|
mv -f _package.json package.json
|
|
|
|
- name: Authenticate with registry
|
|
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ./.npmrc
|
|
|
|
- run: npm publish --tag next --access public
|