Skip to content

Merge pull request #2568 from kuzzleio/beta #1005

Merge pull request #2568 from kuzzleio/beta

Merge pull request #2568 from kuzzleio/beta #1005

Workflow file for this run

name: Tests
on:
push:
branches:
- master
- beta
pull_request:
env:
NODE_LTS_MAINTENANCE_VERSION: "16"
NODE_LTS_ACTIVE_VERSION: "18"
NODE_LTS_CURRENT_VERSION: "20"
ELASTICSEARCH_MAINTENANCE_VERSION: "7"
ELASTICSEARCH_ACTIVE_VERSION: "8"
jobs:
prepare-matrix:
name: Forge Node LTS Matrix
runs-on: ubuntu-24.04
steps:
- id: set-matrix
run: |
echo "matrix={\"node-version\": [\"$NODE_LTS_MAINTENANCE_VERSION\", \"$NODE_LTS_ACTIVE_VERSION\", \"$NODE_LTS_CURRENT_VERSION\"]}" >> $GITHUB_OUTPUT
echo "es-matrix={\"es-version\": [\"$ELASTICSEARCH_MAINTENANCE_VERSION\", \"$ELASTICSEARCH_ACTIVE_VERSION\"]}" >> $GITHUB_OUTPUT
echo "test-set={\"test-set\":[\"jest\", \"http\", \"websocket\", \"legacy:mqtt\", \"legacy:http\", \"legacy:websocket\"]}" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
es-matrix: ${{ steps.set-matrix.outputs.es-matrix }}
test-set: ${{ steps.set-matrix.outputs.test-set }}
node_lts_maintenance_version: ${{ env.NODE_LTS_MAINTENANCE_VERSION }}
node_lts_active_version: ${{ env.NODE_LTS_ACTIVE_VERSION }}
node_lts_current_version: ${{ env.NODE_LTS_CURRENT_VERSION }}
error-codes-check:
name: Documentation - Error codes check
needs: [prepare-matrix]
runs-on: ubuntu-24.04
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install additional libraries
uses: ./.github/actions/install-packages
- name: Node version ${{ env.NODE_LTS_ACTIVE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_LTS_ACTIVE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Test error codes
run: ./.ci/scripts/check-error-codes-documentation.sh
lint:
name: Lint - Node.js
runs-on: ubuntu-24.04
needs: [prepare-matrix]
strategy:
matrix:
node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }}
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install additional libraries
uses: ./.github/actions/install-packages
- name: Node version ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install dependencies
run: npm ci
shell: bash
- name: ESLint
run: npm run test:lint
shell: bash
unit-tests:
name: Unit Tests
needs: [lint, prepare-matrix]
strategy:
matrix:
node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }}
runs-on: ubuntu-24.04
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install additional libraries
uses: ./.github/actions/install-packages
- name: Node version ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Unit test using Node ${{ matrix.node-version }}
uses: ./.github/actions/unit-tests
env:
NODE_VERSION: ${{ matrix.node-version }}
build-and-run-kuzzle:
needs: [lint, prepare-matrix]
name: Build and Run
runs-on: ubuntu-24.04
strategy:
matrix:
kuzzle-image: ["kuzzle"]
es-version: ${{ fromJson(needs.prepare-matrix.outputs.es-matrix).es-version }}
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install additional libraries
uses: ./.github/actions/install-packages
- name: Test to run Kuzzle image
uses: ./.github/actions/build-and-run-kuzzle
with:
kuzzle-image: ${{ matrix.kuzzle-image }}
es-version: ${{ matrix.es-version }}
functional-tests:
name: Functional tests
needs: [unit-tests, prepare-matrix]
strategy:
matrix:
test-set: ${{ fromJson(needs.prepare-matrix.outputs.test-set).test-set }}
node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }}
es-version: ${{ fromJson(needs.prepare-matrix.outputs.es-matrix).es-version }}
runs-on: ubuntu-24.04
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install additional libraries
uses: ./.github/actions/install-packages
- name: Node version ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Test suit ${{ matrix.test-set }}
uses: ./.github/actions/functional-tests
with:
test-set: test:functional:${{ matrix.test-set }}
node-version: ${{ matrix.node-version }}
es-version: ${{ matrix.es-version }}
cluster-monkey-tests:
name: Cluster Monkey Tests
needs: [functional-tests, build-and-run-kuzzle, prepare-matrix]
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }}
es-version: ${{ fromJson(needs.prepare-matrix.outputs.es-matrix).es-version }}
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install additional libraries
uses: ./.github/actions/install-packages
- name: Cloning Monkey Tester
uses: actions/checkout@v4
with:
repository: kuzzleio/kuzzle-monkey-tests
path: "kuzzle-monkey-tests"
- name: Node version ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Monkey testing
uses: ./.github/actions/monkey-tests
with:
node-version: ${{ matrix.node-version }}
es-version: ${{matrix.es-version}}
deploy-workflow:
name: Deployment Workflow
needs: [cluster-monkey-tests, prepare-matrix]
uses: ./.github/workflows/workflow-deployments.yml
secrets: inherit
with:
node_lts_maintenance_version: ${{ needs.prepare-matrix.outputs.node_lts_maintenance_version }}
node_lts_active_version: ${{ needs.prepare-matrix.outputs.node_lts_active_version }}
node_lts_current_version: ${{ needs.prepare-matrix.outputs.node_lts_current_version }}