mirror of https://github.com/waku-org/js-waku.git
108 lines
2.7 KiB
YAML
108 lines
2.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
- 'staging'
|
|
- 'trying'
|
|
pull_request:
|
|
|
|
jobs:
|
|
build_and_test:
|
|
env:
|
|
BUF_VERSION: '0.41.0'
|
|
strategy:
|
|
matrix:
|
|
node: [14, 16]
|
|
os: [ubuntu-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: 'recursive'
|
|
|
|
- name: Get nim-waku HEAD
|
|
id: nim-waku-head
|
|
shell: bash
|
|
run: cd nim-waku && echo "::set-output name=ref::$(git rev-parse HEAD)"
|
|
|
|
- name: Cache nim-waku binary
|
|
id: cache-nim-waku
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
./nim-waku/build/wakunode2
|
|
./nim-waku/vendor/rln/target/debug
|
|
key: nim-waku-build-${{ matrix.os }}-v3-${{ steps.nim-waku-head.outputs.ref }}
|
|
|
|
- name: Install NodeJS
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
|
|
# This would have been done part of npm pretest but it gives better
|
|
# visibility in the CI if done as a separate step
|
|
- name: Build wakunode2
|
|
shell: bash
|
|
run: (cd nim-waku && ./build/wakunode2 --help) || npm run nim-waku:build
|
|
|
|
- name: Ensure wakunode2 is ready
|
|
shell: bash
|
|
run: cd nim-waku && ./build/wakunode2 --help
|
|
|
|
- name: Cache buf binary
|
|
id: cache-buf-bin
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /opt/hostedtoolcache/buf/
|
|
key: buf-bin-v${{ env.BUF_VERSION }}-ubuntu-latest-v1
|
|
|
|
- name: Install bufbuild
|
|
uses: mu-io/setup-buf@v2beta
|
|
with:
|
|
buf-version: ${{ env.BUF_VERSION }}
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v1
|
|
with:
|
|
version: '3.x'
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Cache npm cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.npm
|
|
key: node-${{ matrix.os }}-${{ matrix.node }}-v1-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: install using npm ci
|
|
uses: bahmutov/npm-install@v1
|
|
|
|
- name: Generate protobuf code
|
|
run: npm run proto
|
|
|
|
- name: Check all protobuf code was committed
|
|
shell: bash
|
|
run: |
|
|
[ $(git status --short --ignore-submodules|wc -l) -eq 0 ]
|
|
|
|
- name: build
|
|
run: npm run build
|
|
|
|
- name: Check no proto files changed
|
|
shell: bash
|
|
run: |
|
|
[ $(git status --short --ignore-submodules|wc -l) -eq 0 ]
|
|
|
|
- name: test
|
|
run: npm run test
|
|
|
|
- name: Upload logs on failure
|
|
uses: actions/upload-artifact@v2
|
|
if: failure()
|
|
with:
|
|
name: nim-waku-logs
|
|
path: log/
|