2021-03-15 03:42:36 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
2021-03-22 23:33:11 +00:00
|
|
|
- 'staging'
|
|
|
|
- 'trying'
|
2021-03-15 03:42:36 +00:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_and_test:
|
2021-04-23 06:29:58 +00:00
|
|
|
env:
|
2021-11-26 05:17:28 +00:00
|
|
|
BUF_VERSION: '0.56.0'
|
2021-04-21 03:47:28 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-04-29 06:40:35 +00:00
|
|
|
node: [14]
|
2021-04-28 06:21:29 +00:00
|
|
|
os: [ubuntu-latest, macos-latest]
|
2021-04-21 03:47:28 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2021-03-15 03:42:36 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2021-05-17 03:42:28 +00:00
|
|
|
uses: actions/checkout@v2.3.3
|
2021-03-19 00:36:33 +00:00
|
|
|
with:
|
|
|
|
submodules: 'recursive'
|
2021-03-15 03:42:36 +00:00
|
|
|
|
2021-03-18 23:31:26 +00:00
|
|
|
- name: Get nim-waku HEAD
|
|
|
|
id: nim-waku-head
|
|
|
|
shell: bash
|
2021-03-19 00:36:33 +00:00
|
|
|
run: cd nim-waku && echo "::set-output name=ref::$(git rev-parse HEAD)"
|
2021-03-18 23:31:26 +00:00
|
|
|
|
2021-03-15 06:50:38 +00:00
|
|
|
- name: Cache nim-waku binary
|
2021-03-19 04:16:50 +00:00
|
|
|
id: cache-nim-waku
|
2021-03-15 06:50:38 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2021-03-15 07:20:30 +00:00
|
|
|
path: |
|
|
|
|
./nim-waku/build/wakunode2
|
|
|
|
./nim-waku/vendor/rln/target/debug
|
2021-04-21 03:47:28 +00:00
|
|
|
key: nim-waku-build-${{ matrix.os }}-v3-${{ steps.nim-waku-head.outputs.ref }}
|
2021-03-15 06:50:38 +00:00
|
|
|
|
2021-04-14 02:06:56 +00:00
|
|
|
- name: Install NodeJS
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-04-21 03:47:28 +00:00
|
|
|
node-version: ${{ matrix.node }}
|
2021-04-14 02:06:56 +00:00
|
|
|
|
2021-11-26 05:17:28 +00:00
|
|
|
# This would have been done part of npm pretest, but it gives better
|
2021-03-19 04:16:50 +00:00
|
|
|
# visibility in the CI if done as a separate step
|
|
|
|
- name: Build wakunode2
|
|
|
|
shell: bash
|
2021-04-14 02:06:56 +00:00
|
|
|
run: (cd nim-waku && ./build/wakunode2 --help) || npm run nim-waku:build
|
2021-03-19 04:16:50 +00:00
|
|
|
|
2021-03-26 03:12:16 +00:00
|
|
|
- name: Ensure wakunode2 is ready
|
|
|
|
shell: bash
|
|
|
|
run: cd nim-waku && ./build/wakunode2 --help
|
|
|
|
|
2021-03-15 03:56:06 +00:00
|
|
|
- name: Install bufbuild
|
2021-11-26 05:17:28 +00:00
|
|
|
uses: mathematic-inc/setup-buf@v2beta
|
2021-03-15 04:23:54 +00:00
|
|
|
with:
|
2021-04-23 06:29:58 +00:00
|
|
|
buf-version: ${{ env.BUF_VERSION }}
|
2021-04-28 06:20:24 +00:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2021-03-15 03:56:06 +00:00
|
|
|
|
2021-03-15 04:35:42 +00:00
|
|
|
- name: Install Protoc
|
|
|
|
uses: arduino/setup-protoc@v1
|
|
|
|
with:
|
|
|
|
version: '3.x'
|
2021-04-29 03:34:38 +00:00
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2021-03-15 04:35:42 +00:00
|
|
|
|
2021-03-19 04:07:47 +00:00
|
|
|
- name: Cache npm cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.npm
|
2021-04-21 03:47:28 +00:00
|
|
|
key: node-${{ matrix.os }}-${{ matrix.node }}-v1-${{ hashFiles('**/package-lock.json') }}
|
2021-03-19 04:07:47 +00:00
|
|
|
|
2021-03-15 03:50:52 +00:00
|
|
|
- name: install using npm ci
|
|
|
|
uses: bahmutov/npm-install@v1
|
2021-03-15 03:42:36 +00:00
|
|
|
|
2021-04-20 00:02:47 +00:00
|
|
|
- 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 ]
|
|
|
|
|
2021-03-15 03:42:36 +00:00
|
|
|
- name: build
|
2021-03-15 04:39:55 +00:00
|
|
|
run: npm run build
|
2021-03-15 03:42:36 +00:00
|
|
|
|
2021-04-20 00:02:47 +00:00
|
|
|
- name: Check no proto files changed
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
[ $(git status --short --ignore-submodules|wc -l) -eq 0 ]
|
|
|
|
|
2021-03-15 03:42:36 +00:00
|
|
|
- name: test
|
2021-05-10 10:18:26 +00:00
|
|
|
env:
|
|
|
|
DEBUG: "waku:nim-waku*,waku:test*"
|
2021-03-15 04:39:55 +00:00
|
|
|
run: npm run test
|
2021-03-26 01:38:04 +00:00
|
|
|
|
|
|
|
- name: Upload logs on failure
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: nim-waku-logs
|
|
|
|
path: log/
|