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

71 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
- uses: pnpm/action-setup@v2.2.2
2022-06-17 00:50:54 +00:00
with:
version: 7
2022-06-17 00:50:54 +00:00
- name: Check what package manager is used
id: pm
2022-06-17 00:50:54 +00:00
shell: bash
run: |
if [ -f yarn.lock ]; then
export PM="yarn"
elif [ -f pnpm-lock.yaml ]; then
export PM="pnpm"
elif [ -f package-lock.json ]; then
export PM="npm"
fi
echo "Package manager: ${PM}"
echo "::set-output name=pm::${PM}"
2022-06-17 00:55:51 +00:00
working-directory: ${{ matrix.example }}
2022-06-17 00:50:54 +00:00
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: "16"
cache: ${{ steps.pm.outputs.pm }}
2022-08-07 06:30:22 +00:00
- name: (npm) ${{ matrix.example }} install using npm ci
if: steps.pm.outputs.pm == 'npm'
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: (yarn) ${{ matrix.example }} install using yarn
if: steps.pm.outputs.pm == 'yarn'
2022-06-17 00:50:54 +00:00
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: (pnpm) ${{ matrix.example }} install using pnpm
if: steps.pm.outputs.pm == 'pnpm'
run: pnpm install --frozen-lockfile
working-directory: ${{ matrix.example }}
- name: ${{ matrix.example }} test
run: npm run test
2022-06-17 00:55:51 +00:00
working-directory: ${{ matrix.example }}