2021-05-04 05:12:36 +00:00
|
|
|
name: Examples CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2022-01-03 23:13:38 +00:00
|
|
|
- 'master'
|
2021-05-04 05:12:36 +00:00
|
|
|
- 'staging'
|
|
|
|
- 'trying'
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
examples_build_and_test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-02-22 03:02:08 +00:00
|
|
|
example: [ web-chat, eth-pm, eth-pm-wallet-encryption, relay-reactjs-chat, store-reactjs-chat, relay-angular-chat ]
|
2021-05-04 05:12:36 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install NodeJS
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2022-01-06 02:31:05 +00:00
|
|
|
node-version: '16'
|
2021-05-04 05:12:36 +00:00
|
|
|
|
2022-02-22 03:02:08 +00:00
|
|
|
- name: Check if `yarn` or `npm` is used.
|
|
|
|
id: use-yarn
|
|
|
|
shell: bash
|
|
|
|
run: echo "::set-output name=lockfile::$(ls yarn.lock 2> /dev/null)"
|
|
|
|
working-directory: examples/${{ matrix.example }}
|
|
|
|
|
|
|
|
- name: (npm) Cache npm cache
|
|
|
|
if: steps.use-yarn.outputs.lockfile != 'yarn.lock'
|
2021-05-04 05:12:36 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.npm
|
|
|
|
key: examples-node-v1-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
|
2021-05-13 06:49:29 +00:00
|
|
|
- name: "[js-waku] install using npm ci"
|
2021-05-04 05:12:36 +00:00
|
|
|
uses: bahmutov/npm-install@v1
|
|
|
|
|
2021-05-13 06:49:29 +00:00
|
|
|
- name: "[js-waku] build"
|
2021-05-04 05:12:36 +00:00
|
|
|
run: npm run build
|
|
|
|
|
2022-02-22 03:02:08 +00:00
|
|
|
- name: (npm) ${{ matrix.example }} install using npm i
|
|
|
|
if: steps.use-yarn.outputs.lockfile != 'yarn.lock'
|
2021-05-04 05:12:36 +00:00
|
|
|
run: npm install
|
|
|
|
working-directory: examples/${{ matrix.example }}
|
|
|
|
|
2022-02-22 03:02:08 +00:00
|
|
|
- name: (npm) ${{ matrix.example }} test
|
|
|
|
if: steps.use-yarn.outputs.lockfile != 'yarn.lock'
|
2021-05-04 05:12:36 +00:00
|
|
|
run: npm run test
|
|
|
|
working-directory: examples/${{ matrix.example }}
|
2022-02-22 03:02:08 +00:00
|
|
|
|
|
|
|
- name: (yarn) ${{ matrix.example }} install using yarn
|
|
|
|
if: steps.use-yarn.outputs.lockfile == 'yarn.lock'
|
|
|
|
run: yarn install --frozen-lockfile
|
|
|
|
working-directory: examples/${{ matrix.example }}
|
|
|
|
|
|
|
|
- name: (yarn) ${{ matrix.example }} test
|
|
|
|
if: steps.use-yarn.outputs.lockfile == 'yarn.lock'
|
|
|
|
run: echo "test skipped" # yarn test; tracked with https://github.com/status-im/js-waku/issues/563
|
|
|
|
working-directory: examples/${{ matrix.example }}
|