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

65 lines
1.8 KiB
YAML
Raw Normal View History

2022-06-17 00:50:54 +00:00
name: CI
on:
push:
branches:
- "master"
pull_request:
jobs:
examples_build_and_test:
strategy:
fail-fast: false
2022-06-17 00:50:54 +00:00
matrix:
example:
[
web-chat,
eth-pm,
eth-pm-wallet-encryption,
relay-reactjs-chat,
store-reactjs-chat,
relay-angular-chat,
]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: "16"
- 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)"
2022-06-17 00:55:51 +00:00
working-directory: ${{ matrix.example }}
2022-06-17 00:50:54 +00:00
- name: (npm) Cache npm cache
if: steps.use-yarn.outputs.lockfile != 'yarn.lock'
uses: actions/cache@v2
with:
path: ~/.npm
key: examples-node-v1-${{ hashFiles('**/package-lock.json') }}
2022-08-07 06:30:22 +00:00
- name: (npm) ${{ matrix.example }} install using npm ci
2022-06-17 00:50:54 +00:00
if: steps.use-yarn.outputs.lockfile != 'yarn.lock'
2022-08-07 06:30:22 +00:00
run: npm ci
2022-06-17 00:55:51 +00:00
working-directory: ${{ matrix.example }}
2022-06-17 00:50:54 +00:00
- name: (npm) ${{ matrix.example }} test
if: steps.use-yarn.outputs.lockfile != 'yarn.lock'
run: npm run test
2022-06-17 00:55:51 +00:00
working-directory: ${{ matrix.example }}
2022-06-17 00:50:54 +00:00
- name: (yarn) ${{ matrix.example }} install using yarn
if: steps.use-yarn.outputs.lockfile == 'yarn.lock'
run: yarn install --frozen-lockfile
2022-06-17 00:55:51 +00:00
working-directory: ${{ matrix.example }}
2022-06-17 00:50:54 +00:00
- 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
2022-06-17 00:55:51 +00:00
working-directory: ${{ matrix.example }}