js-waku/.github/workflows/ci.yml

206 lines
5.1 KiB
YAML

name: CI
on:
push:
branches:
- "master"
- "staging"
- "trying"
pull_request:
env:
NWAKU_VERSION: "v0.13.0"
NODE_JS: "18"
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 build
- run: npm run check
- run: npm run doc
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 build:esm
- 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 build:esm
- run: npm run test:node
env:
DEBUG: ""
- name: Upload debug logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: debug.log
path: debug.log
- name: Upload nwaku logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: nwaku-logs
path: packages/tests/log/
node_with_go_waku:
if: false # Can be removed when upgrading go-waku to 0.4.0 or later
runs-on: ubuntu-latest
env:
GO_WAKU_VERSION: "0.2.2"
WAKU_SERVICE_NODE_DIR: ../../go-waku
WAKU_SERVICE_NODE_BIN: ./waku
WAKU_SERVICE_NODE_PARAMS: "--min-relay-peers-to-publish=0" # Can be removed once https://github.com/status-im/nwaku/issues/1004 is done
DEBUG: "waku*"
steps:
- uses: actions/checkout@v3
- name: Get go-waku
shell: bash
run: |
pwd
mkdir -p go-waku/
cd go-waku
wget "https://github.com/status-im/go-waku/releases/download/v${GO_WAKU_VERSION}/gowaku-${GO_WAKU_VERSION}-x86_64.deb"
sudo apt install ./gowaku-${GO_WAKU_VERSION}-x86_64.deb
cp $(which waku) ./
- name: Ensure go-waku is ready
shell: bash
run: |
uname -a
cd packages/core
cd "${WAKU_SERVICE_NODE_DIR}"
"${WAKU_SERVICE_NODE_BIN}" --version
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: bahmutov/npm-install@v1
- run: npm run build:esm
- run: npm run test:node
env:
DEBUG: "waku:nwaku*,waku:test*"
- name: Upload debug logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: go-waku-debug.log
path: debug.log
- name: Upload logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: go-waku-logs
path: packages/tests/log/
node_with_nwaku_master:
runs-on: ubuntu-latest
env:
DEBUG: "waku*"
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-depth: 0
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- name: Pull nwaku origin/master
run: |
cd nwaku
git fetch origin
git checkout origin/master
- uses: bahmutov/npm-install@v1
- name: build nwaku
run: |
cd packages/tests
npm run nwaku:force-build
- name: Ensure wakunode2 is ready
shell: bash
run: |
uname -a
cd nwaku
./build/wakunode2 --help
- run: npm run build:esm
- run: npm run test:node
env:
DEBUG: "waku:nwaku*,waku:test*"
- name: Upload debug logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: nwaku-master-debug.log
path: debug.log
- name: Upload logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: nwaku-master-logs
path: packages/tests/log/