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

130 lines
3.4 KiB
YAML

name: CI
on:
push:
branches:
- "master"
- "staging"
- "trying"
pull_request:
workflow_dispatch:
inputs:
nim_wakunode_image:
description: "Docker hub image name taken from https://hub.docker.com/r/statusteam/nim-waku/tags. Format: statusteam/nim-waku:v0.20.0"
required: false
type: string
env:
NODE_JS: "18"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: waku-org/js-waku
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- run: npm run build
- run: npm run check
- run: npm run doc
proto:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: waku-org/js-waku
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- 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
with:
repository: waku-org/js-waku
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: ./.github/actions/npm
- run: npm run build:esm
- run: npm run test:browser
node:
uses: ./.github/workflows/test-node.yml
with:
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.20.0' }}
test_type: node
node_optional:
uses: ./.github/workflows/test-node.yml
with:
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.20.0' }}
test_type: node-optional
node_with_go_waku_master:
uses: ./.github/workflows/test-node.yml
with:
nim_wakunode_image: statusteam/go-waku:latest
test_type: go-waku-master
debug: waku*
node_with_nwaku_master:
uses: ./.github/workflows/test-node.yml
with:
nim_wakunode_image: statusteam/nim-waku:deploy-wakuv2-test
test_type: nwaku-master
debug: waku*
maybe-release:
name: release
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [check, proto, browser, node]
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
monorepo-tags: true
token: ${{ secrets.CI_TOKEN }}
- uses: actions/checkout@v3
with:
repository: waku-org/js-waku
if: ${{ steps.release.outputs.releases_created }}
- uses: actions/setup-node@v3
if: ${{ steps.release.outputs.releases_created }}
with:
node-version: ${{ env.NODE_JS }}
registry-url: "https://registry.npmjs.org"
- run: npm install
if: ${{ steps.release.outputs.releases_created }}
- run: npm run build
if: ${{ steps.release.outputs.releases_created }}
- run: npm run publish
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_JS_WAKU_PUBLISH }}