Skip to content

Commit

Permalink
Merge pull request #1566 from waku-org/chore/split-ci-into-chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
fryorcraken authored Sep 21, 2023
2 parents 7905aa4 + 4d54027 commit a0c96bb
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 140 deletions.
159 changes: 19 additions & 140 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,13 @@ on:
description: "Docker hub image name taken from https://hub.docker.com/r/statusteam/nim-waku/tags. Format: statusteam/nim-waku:v0.19.0"
required: false
type: string
workflow_call:
inputs:
nim_wakunode_image:
required: false
type: string
caller:
required: false
type: string

env:
NODE_JS: "18"

jobs:
check:
runs-on: ubuntu-latest
if: ${{ inputs.caller == null || inputs.caller != 'nwaku' }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -44,7 +35,6 @@ jobs:

proto:
runs-on: ubuntu-latest
if: ${{ inputs.caller == null || inputs.caller != 'nwaku' }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -66,7 +56,6 @@ jobs:
browser:
runs-on: ubuntu-latest
if: ${{ inputs.caller == null || inputs.caller != 'nwaku' }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -79,145 +68,35 @@ jobs:
- run: npm run test:browser

node:
runs-on: ubuntu-latest
env:
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
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: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/
uses: ./.github/workflows/test-node.yml
with:
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
test_type: node

node_optional:
runs-on: ubuntu-latest
env:
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}

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:optional --workspace=@waku/tests
env:
DEBUG: ""
uses: ./.github/workflows/test-node.yml
with:
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'statusteam/nim-waku:v0.19.0' }}
test_type: node-optional

node_with_go_waku_master:
runs-on: ubuntu-latest
if: ${{ inputs.caller == null || inputs.caller != 'nwaku' }}
env:
WAKUNODE_IMAGE: "statusteam/go-waku:latest"
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
with:
repository: waku-org/js-waku

- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}

- uses: ./.github/actions/npm

- 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/
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:
runs-on: ubuntu-latest
if: ${{ inputs.caller == null || inputs.caller != 'nwaku' }}
env:
DEBUG: "waku*"
WAKUNODE_IMAGE: "statusteam/nim-waku:deploy-wakuv2-test"
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: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/
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' &&
(github.event.inputs.caller == null || github.event.inputs.caller != 'nwaku')
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [check, proto, browser, node]
steps:
- uses: google-github-actions/release-please-action@v3
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/test-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Run Test

on:
workflow_call:
inputs:
nim_wakunode_image:
required: true
type: string
test_type:
required: true
type: string
debug:
required: false
type: string
default: ''

env:
NODE_JS: "18"
WAKU_SERVICE_NODE_PARAMS: ${{ (inputs.test_type == 'go-waku-master') && '--min-relay-peers-to-publish=0' || '' }}
DEBUG: ${{ inputs.debug }}

jobs:
node:
runs-on: ubuntu-latest
env:
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image }}
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: ${{ (inputs.test_type == 'node-optional') && 'npm run test:optional --workspace=@waku/tests' || 'npm run test:node' }}

- name: Upload debug logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ inputs.test_type }}-debug.log
path: debug.log

- name: Upload logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ inputs.test_type }}-logs
path: packages/tests/log/

0 comments on commit a0c96bb

Please sign in to comment.