Skip to content

Merge pull request #205 from kuzzleio/0.28.1-proposal #49

Merge pull request #205 from kuzzleio/0.28.1-proposal

Merge pull request #205 from kuzzleio/0.28.1-proposal #49

name: Run tests
on:
push:
branches:
- master
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: ./.github/actions/es-lint
build:
name: Build
runs-on: ubuntu-22.04
needs: [lint]
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: ./.github/actions/build
- name: Store build archive as artifact
uses: actions/upload-artifact@v2
with:
name: kourou-build
path: ./kourou-*.tgz
functional-test:
name: Functional Test - ${{ matrix.test-set }}
runs-on: ubuntu-22.04
needs: [build]
strategy:
matrix:
test-set: [stdout, cucumber]
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
NODE_ENV: test
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Recover previously built Kourou
uses: actions/download-artifact@v2
with:
name: kourou-build
- name: Unpack and prepare artifact for tests
run: |
tar xfz ./kourou-*.tgz
cp -fr .mocharc.json .nycrc tsconfig.json features test package/
- uses: ./.github/actions/functional-test
with:
test-set: ${{ matrix.test-set }}
deploy:
name: Deploy to NPM.js
runs-on: ubuntu-22.04
needs: [functional-test]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
- run: npm install
- run: npm run build
- run: npm install --prune production
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}