Skip to content

Commit

Permalink
Update workflows, merge repository kuzzle-containers (#2502)
Browse files Browse the repository at this point in the history
* Update workflows, merge repository kuzzle-containers

* Should fix workflow files

* Update worfklow.yaml file

* Update workflow

* Update package-lock

* Lint the application

* Lint ts, js

* Fix tests

* Add build kuzzle before launching tests

* Update workflow

* Add mqtt module

* Update requested changes

* Update matrix with node_version

* Update kuzzle-runner workflow

* Update Dockerfile to avoid duplication

* Change matrix

* Does it fix the node_version

* Remove steps that forge matrix, this is not needed

* Add dummy steps to allow outputs of a job

* Add dummy steps to allow outputs of a job

* Update matrix in jobs

* Try with env variable

* Fix prepare-matrix and use it inside each jobs

* Update matrix
  • Loading branch information
rolljee authored Nov 29, 2023
1 parent cd72c10 commit 4023314
Show file tree
Hide file tree
Showing 283 changed files with 4,363 additions and 4,041 deletions.
4 changes: 2 additions & 2 deletions .ci/test-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ services:
<<: *kuzzle-config
container_name: kuzzle_node_1
ports:
- "17510:7512" # Kuzzle API port, used to check if it is up
- "1883:1883" # TCP load balancing is hard with nginx
- "17510:7512"
- "1883:1883"

kuzzle_node_2:
<<: *kuzzle-config
Expand Down
15 changes: 12 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"plugins": ["kuzzle"],
"extends": ["plugin:kuzzle/default", "plugin:kuzzle/node"]
}
"plugins": [
"kuzzle"
],
"extends": [
"plugin:kuzzle/default",
"plugin:kuzzle/node"
],
"rules": {
"sort-keys": "warn",
"kuzzle/array-foreach": "warn"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
actions: read
contents: read
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/core-dev.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: kuzzleio/core-dev

on:
push:
branches:
- master

env:
DOCKER_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"

jobs:
build-and-push:
name: Build and push core-dev image
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./core-dev
file: ./core-dev/Dockerfile
push: true
platforms: ${{ env.DOCKER_PLATFORMS }}
tags: kuzzleio/core-dev:2,kuzzleio/core-dev:latest
40 changes: 40 additions & 0 deletions .github/workflows/elasticsearch.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: kuzzleio/elasticsearch

on:
push:
branches:
- master

env:
DOCKER_PLATFORMS: "linux/amd64,linux/arm64"
ELASTICSEARCH_VERSION: "7.16.2"

jobs:
build-and-push:
name: Build and push elasticsearch image
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./elasticsearch
file: ./elasticsearch/Dockerfile
push: true
build-args: ELASTICSEARCH_VERSION=${{ env.ELASTICSEARCH_VERSION }}
platforms: ${{ env.DOCKER_PLATFORMS }}
tags: kuzzleio/elasticsearch:${{ env.ELASTICSEARCH_VERSION }},kuzzleio/elasticsearch:7, kuzzleio/elasticsearch:latest
41 changes: 41 additions & 0 deletions .github/workflows/kuzzle-runner.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: kuzzleio/kuzzle-runner

on:
push:
branches:
- master

env:
DOCKER_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"

jobs:
publish-runner:
name: Build and push image embedding Node.js
runs-on: ubuntu-22.04
matrix:
node-version: [16, 18, 20]
steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./kuzzle-runner
file: ./kuzzle-runner/Dockerfile
push: true
build-args: NODE_LTS_VERSION=${{ matrix.node-version }}
platforms: ${{ env.DOCKER_PLATFORMS }}
tags: kuzzleio/kuzzle-runner:${{ matrix.node-version }}
103 changes: 66 additions & 37 deletions .github/workflows/workflow-deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ on:
workflow_call:
inputs:
node_lts_maintenance_version:
description: "Current Node LTS Version"
description: "Maintenance Node LTS Version"
required: true
default: "16"
type: string
node_lts_current_version:
description: "Current Node LTS Version"
required: true
default: "20"
type: string

node_lts_active_version:
description: "Active Node LTS Version"
required: true
default: "18"
type: string

node_lts_current_version:
description: "Current Node LTS Version"
required: true
default: "20"
type: string

docker_platforms:
description: "Docker platforms"
required: true
Expand All @@ -30,31 +33,37 @@ on:
required: true
default: true
type: boolean

dockerhub_deploy:
description: "Deploy to DockerHub"
required: true
default: true
type: boolean

npm_deploy:
description: "Deploy to NPM"
required: true
default: true
type: boolean

node_lts_maintenance_version:
description: "Current Node LTS Version"
description: "Maintenance Node LTS Version"
required: true
default: "16"
type: string
node_lts_current_version:
description: "Current Node LTS Version"
required: true
default: "20"
type: string

node_lts_active_version:
description: "Active Node LTS Version"
required: true
default: "18"
type: string

node_lts_current_version:
description: "Current Node LTS Version"
required: true
default: "20"
type: string

docker_platforms:
description: "Docker platforms"
required: true
Expand All @@ -68,18 +77,20 @@ jobs:
doc-deploy:
name: Documentation - Deploy
if: ${{ (github.event_name != 'workflow_dispatch' || inputs.doc_deploy) && (github.ref_name == 'master' || github.ref_name == '2-dev') }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout project
uses: actions/checkout@v3

- name: Extract references from context
shell: bash
id: extract-refs
run: |
echo "::set-output name=version::$(git describe --abbrev=0 --tags | cut -d. -f 1)"
echo "::set-output name=repo::$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)"
- uses: convictional/trigger-workflow-and-wait@v1.6.3
echo "version=$(git describe --abbrev=0 --tags | cut -d. -f 1)" >> $GITHUB_OUTPUT
echo "repo=$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)" >> $GITHUB_OUTPUT
- name: Trigger documentation workflow
uses: convictional/trigger-workflow-and-wait@v1.6.3
with:
owner: kuzzleio
repo: documentation
Expand All @@ -91,37 +102,45 @@ jobs:
dockerhub-deploy:
name: Build and deploy images to Dockerhub
if: ${{ (github.event_name != 'workflow_dispatch' || inputs.dockerhub_deploy) && github.ref_name == 'master' }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-packages
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_lts_maintenance_version }}
- uses: actions/cache@v3
- name: Checkout project
uses: actions/checkout@v3

- name: Install additional libraries
uses: ./.github/actions/install-packages

- name: Node version ${{ inputs.node_lts_active_version }}
uses: actions/setup-node@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
node-version: ${{ inputs.node_lts_active_version }}
cache: 'npm'

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Get current version from package.json
shell: bash
id: get-version
run: |
echo "::set-output name=version::$(jq -r .version package.json)"
echo "::set-output name=major-version::$(jq -r .version package.json | cut -d. -f 1)"
echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
echo "major-version=$(jq -r .version package.json | cut -d. -f 1)" >> $GITHUB_OUTPUT
- name: Build TS files
run: |
npm ci
npm run build
- name: Build and push
uses: docker/build-push-action@v2
with:
Expand All @@ -134,15 +153,25 @@ jobs:
npm-deploy:
name: Build and deploy release on NPM.js
if: ${{ (github.event_name != 'workflow_dispatch' || inputs.npm_deploy) && github.ref_name == 'master' }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-packages
- uses: actions/setup-node@v3
- name: Checkout project
uses: actions/checkout@v3

- name: Install additional libraries
uses: ./.github/actions/install-packages

- name: Node version ${{ inputs.node_lts_active_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_lts_maintenance_version }}
node-version: ${{ inputs.node_lts_active_version }}
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm publish
cache: 'npm'

- name: Install depedencies
run: npm ci

- name: Publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

0 comments on commit 4023314

Please sign in to comment.