diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 50163193d7..b30b3c6590 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -11,7 +11,7 @@ on: jobs: analyze: name: Analyze - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: actions: read contents: read diff --git a/.github/workflows/core-dev.yml b/.github/workflows/core-dev.yml deleted file mode 100644 index b698376eb1..0000000000 --- a/.github/workflows/core-dev.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: kuzzleio/core-dev - -on: - push: - branches: - - master - -env: - DOCKER_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7" - -jobs: - build-and-push: - name: core-dev image - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - - 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@v5 - with: - context: ./docker/images/core-dev - file: ./docker/images/core-dev/Dockerfile - push: true - platforms: ${{ env.DOCKER_PLATFORMS }} - tags: kuzzleio/core-dev:2,kuzzleio/core-dev:latest diff --git a/.github/workflows/elasticsearch.yml b/.github/workflows/elasticsearch.yml deleted file mode 100644 index 0e64103f3d..0000000000 --- a/.github/workflows/elasticsearch.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: kuzzleio/elasticsearch - -on: - push: - branches: - - master - -env: - DOCKER_PLATFORMS: "linux/amd64,linux/arm64" - ELASTICSEARCH_VERSION: "7.17.25" - -jobs: - build-and-push: - name: Elasticsearch image - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - - 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@v5 - with: - context: ./docker/images/elasticsearch - file: ./docker/images/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 diff --git a/.github/workflows/kuzzle-core.yml b/.github/workflows/kuzzle-core.yml deleted file mode 100644 index 041520298f..0000000000 --- a/.github/workflows/kuzzle-core.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: kuzzleio/kuzzle - -on: - push: - branches: - - master - -env: - DOCKER_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7" - NODE_VERSION: "20" - -jobs: - dockerhub-deploy: - name: Kuzzle core Node.js - runs-on: ubuntu-22.04 - steps: - - name: Checkout project - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker 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: Get current version from package.json - shell: bash - id: get-version - run: | - 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 and push - uses: docker/build-push-action@v5 - with: - context: . - file: ./docker/images/kuzzle/Dockerfile - push: true - build-args: NODE_VERSION=${{ env.NODE_VERSION }} - platforms: ${{ env.DOCKER_PLATFORMS }} - tags: kuzzleio/kuzzle:${{ steps.get-version.outputs.major-version }},kuzzleio/kuzzle:latest,kuzzleio/kuzzle:${{ steps.get-version.outputs.version }} diff --git a/.github/workflows/kuzzle-plugin-dev.yml b/.github/workflows/kuzzle-plugin-dev.yml deleted file mode 100644 index 96ea13cc1e..0000000000 --- a/.github/workflows/kuzzle-plugin-dev.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: kuzzleio/plugin-dev - -on: - push: - branches: - - master - -env: - DOCKER_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7" - -jobs: - dockerhub-deploy: - name: Kuzzle plugin-dev Node.js - runs-on: ubuntu-22.04 - steps: - - name: Checkout project - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker 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: Get current version from package.json - shell: bash - id: get-version - run: | - 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 and push - uses: docker/build-push-action@v5 - with: - context: . - file: ./docker/images/plugin-dev/Dockerfile - push: true - platforms: ${{ env.DOCKER_PLATFORMS }} - tags: kuzzleio/plugin-dev:${{ steps.get-version.outputs.major-version }},kuzzleio/plugin-dev:latest,kuzzleio/plugin-dev:${{ steps.get-version.outputs.version }} diff --git a/.github/workflows/kuzzle-runner.yml b/.github/workflows/kuzzle-runner.yml deleted file mode 100644 index af94b87cdd..0000000000 --- a/.github/workflows/kuzzle-runner.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: kuzzleio/kuzzle-runner - -on: - push: - branches: - - master - -env: - DOCKER_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7" - -jobs: - publish-runner: - name: kuzzle-runner Node.js - runs-on: ubuntu-22.04 - strategy: - matrix: - node-version: [16, 18, 20] - steps: - - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker 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@v5 - with: - context: ./docker/images/kuzzle-runner - file: ./docker/images/kuzzle-runner/Dockerfile - push: true - build-args: NODE_VERSION=${{ matrix.node-version }} - platforms: ${{ env.DOCKER_PLATFORMS }} - tags: kuzzleio/kuzzle-runner:${{ matrix.node-version }} \ No newline at end of file diff --git a/.github/workflows/workflow-deployments.yml b/.github/workflows/workflow-deployments.yml index b70e780fce..5ba516d9f2 100644 --- a/.github/workflows/workflow-deployments.yml +++ b/.github/workflows/workflow-deployments.yml @@ -1,5 +1,9 @@ name: Documentation and NPM package +env: + DOCKER_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7" + ELASTICSEARCH_VERSION: "7.17.25" + on: workflow_call: inputs: @@ -54,17 +58,17 @@ on: type: string jobs: - # ----------------------------------------------------------------------------- - # Deployments: Documentation, Docker images, NPM package (only on git push) - # ----------------------------------------------------------------------------- doc-deploy: name: Documentation - Deploy if: ${{ (github.event_name != 'workflow_dispatch' || inputs.doc_deploy) && (github.ref_name == 'master' || github.ref_name == 'beta') }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout project uses: actions/checkout@v4 + - name: Install additional libraries + uses: ./.github/actions/install-packages + - name: Extract references from context shell: bash id: extract-refs @@ -84,8 +88,8 @@ jobs: npm-deploy: name: Build and deploy release on NPM.js - if: ${{ (github.event_name != 'workflow_dispatch' || inputs.npm_deploy) && (github.ref_name == 'master' || github.ref_name == 'beta' || github.ref_name == 'elasticsearch-8') }} - runs-on: ubuntu-22.04 + if: ${{ (github.event_name != 'workflow_dispatch' || inputs.npm_deploy) && (github.ref_name == 'master' || github.ref_name == 'beta') }} + runs-on: ubuntu-24.04 permissions: contents: write issues: write @@ -117,3 +121,184 @@ jobs: SEMANTIC_RELEASE_NPM_PUBLISH: "true" SEMANTIC_RELEASE_SLACK_WEBHOOK: ${{ secrets.SEMANTIC_RELEASE_SLACK_WEBHOOK }} run: npx semantic-release + + publish-runner: + name: Kuzzle runner Docker image + needs: [npm-deploy] + runs-on: ubuntu-24.04 + strategy: + matrix: + node-version: [16, 18, 20] + steps: + - uses: actions/checkout@v4 + + - name: Install additional libraries + uses: ./.github/actions/install-packages + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker 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@v6 + with: + context: ./docker/images/kuzzle-runner + file: ./docker/images/kuzzle-runner/Dockerfile + push: true + build-args: NODE_VERSION=${{ matrix.node-version }} + platforms: ${{ env.DOCKER_PLATFORMS }} + tags: kuzzleio/kuzzle-runner:${{ matrix.node-version }} + + publish-plugin-dev: + name: Kuzzle plugin-dev Docker image + needs: [npm-deploy] + runs-on: ubuntu-24.04 + steps: + - name: Checkout project + uses: actions/checkout@v4 + + - name: Install additional libraries + uses: ./.github/actions/install-packages + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker 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: Get current version from package.json + shell: bash + id: get-version + run: | + 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 and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/images/plugin-dev/Dockerfile + push: true + build-args: NODE_VERSION=${{ env.NODE_VERSION }} + platforms: ${{ env.DOCKER_PLATFORMS }} + tags: kuzzleio/plugin-dev:${{ steps.get-version.outputs.major-version }},kuzzleio/plugin-dev:latest,kuzzleio/plugin-dev:${{ steps.get-version.outputs.version }} + + publish-kuzzle-core: + name: Kuzzle core Docker image + needs: [npm-deploy] + runs-on: ubuntu-24.04 + steps: + - name: Checkout project + uses: actions/checkout@v4 + + - name: Install additional libraries + uses: ./.github/actions/install-packages + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker 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: Get current version from package.json + shell: bash + id: get-version + run: | + 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 and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/images/kuzzle/Dockerfile + push: true + build-args: NODE_VERSION=${{ env.NODE_VERSION }} + platforms: ${{ env.DOCKER_PLATFORMS }} + tags: kuzzleio/kuzzle:${{ steps.get-version.outputs.major-version }},kuzzleio/kuzzle:latest,kuzzleio/kuzzle:${{ steps.get-version.outputs.version }} + + publish-core-dev: + name: Kuzzle core-dev Docker image + needs: [npm-deploy] + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Install additional libraries + uses: ./.github/actions/install-packages + + - 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@v6 + with: + context: ./docker/images/core-dev + file: ./docker/images/core-dev/Dockerfile + push: true + build-args: NODE_VERSION=${{ env.NODE_VERSION }} + platforms: ${{ env.DOCKER_PLATFORMS }} + tags: kuzzleio/core-dev:2,kuzzleio/core-dev:latest + + publish-elasticsearch: + name: Elasticsearch Docker image + needs: [npm-deploy] + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Install additional libraries + uses: ./.github/actions/install-packages + + - 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@v6 + with: + context: ./docker/images/elasticsearch + file: ./docker/images/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 diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 156da075e7..c0e7bb09d9 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -5,7 +5,6 @@ on: branches: - master - beta - - elasticsearch-8 pull_request: env: @@ -18,7 +17,7 @@ env: jobs: prepare-matrix: name: Forge Node LTS Matrix - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - id: set-matrix run: | @@ -35,7 +34,8 @@ jobs: error-codes-check: name: Documentation - Error codes check - runs-on: ubuntu-22.04 + needs: [prepare-matrix] + runs-on: ubuntu-24.04 steps: - name: Checkout project uses: actions/checkout@v4 @@ -47,8 +47,9 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_LTS_ACTIVE_VERSION }} + cache: "npm" - - name: Install depedencies + - name: Install dependencies run: npm ci - name: Test error codes @@ -56,8 +57,11 @@ jobs: lint: name: Lint - Node.js - runs-on: ubuntu-22.04 + 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 @@ -65,12 +69,13 @@ jobs: - name: Install additional libraries uses: ./.github/actions/install-packages - - name: Node version ${{ env.NODE_LTS_CURRENT_VERSION }} + - name: Node version ${{ matrix.node-version }} uses: actions/setup-node@v4 with: - node-version: ${{ env.NODE_LTS_CURRENT_VERSION }} + node-version: ${{ matrix.node-version }} + cache: "npm" - - name: Install depedencies + - name: Install dependencies run: npm ci shell: bash @@ -84,7 +89,7 @@ jobs: strategy: matrix: node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout project uses: actions/checkout@v4 @@ -96,20 +101,17 @@ jobs: 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 }} - # ----------------------------------------------------------------------------- - # E2E Tests: Functional tests, Monkey tests, Docker image tests - # ----------------------------------------------------------------------------- - build-and-run-kuzzle: - needs: [unit-tests, prepare-matrix] + needs: [lint, prepare-matrix] name: Build and Run - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: kuzzle-image: ["kuzzle"] @@ -118,6 +120,9 @@ jobs: - 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: @@ -132,7 +137,7 @@ jobs: 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-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout project uses: actions/checkout@v4 @@ -144,6 +149,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "npm" - name: Test suit ${{ matrix.test-set }} uses: ./.github/actions/functional-tests @@ -155,7 +161,7 @@ jobs: cluster-monkey-tests: name: Cluster Monkey Tests needs: [functional-tests, build-and-run-kuzzle, prepare-matrix] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: node-version: ${{ fromJson(needs.prepare-matrix.outputs.matrix).node-version }} @@ -177,6 +183,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} + cache: "npm" - name: Monkey testing uses: ./.github/actions/monkey-tests diff --git a/docker/images/core-dev/Dockerfile b/docker/images/core-dev/Dockerfile index 5b43bd85de..e9fa1cd1ae 100644 --- a/docker/images/core-dev/Dockerfile +++ b/docker/images/core-dev/Dockerfile @@ -22,11 +22,11 @@ RUN set -x \ git \ gnupg \ libfontconfig \ + libunwind-dev \ libzmq3-dev \ - python3 \ procps \ + python3 \ wget \ - libunwind-dev \ && npm install -g kourou \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/docker/images/kuzzle-runner/Dockerfile b/docker/images/kuzzle-runner/Dockerfile index 20a31c76a8..67ea3dddd8 100644 --- a/docker/images/kuzzle-runner/Dockerfile +++ b/docker/images/kuzzle-runner/Dockerfile @@ -11,15 +11,22 @@ ENV NPM_CONFIG_CACHE=/var/npm WORKDIR /var/app RUN set -x \ - && apt-get update && apt-get install -y \ + \ + && apt-get update \ + && apt-get install -y \ + bash-completion \ + build-essential \ curl \ - python3 \ - make \ g++ \ + gdb \ git \ - libzmq3-dev \ + gnupg \ + libfontconfig \ libunwind-dev \ + libzmq3-dev \ + procps \ + python3 \ + wget \ + && npm install -g kourou \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* - -RUN npm i -g kourou diff --git a/docker/images/kuzzle/Dockerfile b/docker/images/kuzzle/Dockerfile index c529e9b41d..cc17797304 100644 --- a/docker/images/kuzzle/Dockerfile +++ b/docker/images/kuzzle/Dockerfile @@ -2,15 +2,26 @@ ARG NODE_VERSION="20" FROM node:${NODE_VERSION}-bookworm-slim AS builder -RUN set -x \ +RUN set -x \ + \ && apt-get update \ && apt-get install -y \ + bash-completion \ + build-essential \ curl \ - make \ g++ \ - python3 \ + gdb \ + git \ + gnupg \ + libfontconfig \ libzmq3-dev \ - libunwind-dev + python3 \ + procps \ + wget \ + libunwind-dev \ + && npm install -g kourou \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* WORKDIR /app @@ -22,7 +33,7 @@ ADD ./package-lock.json package-lock.json ADD ./index.ts index.ts ADD ./tsconfig.json tsconfig.json -RUN npm ci --noproxy registry.npmjs.org --maxsockets 1 +RUN npm ci RUN npm run build RUN npm prune --omit=dev diff --git a/docker/images/plugin-dev/Dockerfile b/docker/images/plugin-dev/Dockerfile index 2523fca0bb..071c6e5676 100644 --- a/docker/images/plugin-dev/Dockerfile +++ b/docker/images/plugin-dev/Dockerfile @@ -21,7 +21,7 @@ ADD ./package-lock.json package-lock.json ADD ./index.ts index.ts ADD ./tsconfig.json tsconfig.json -RUN npm ci --noproxy registry.npmjs.org --maxsockets 1 +RUN npm ci RUN npm run build RUN npm prune --omit=dev