Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Defrag api

Defrag api #2799

Workflow file for this run

name: Build on ubuntu
on:
workflow_dispatch:
inputs:
browser_tag:
description: "Browser tag"
required: false
default: "latest"
pull_request:
branches: [master, "[0-9]+.[0-9]+"]
push:
branches:
- master
- "[0-9]+.[0-9]+"
tags:
- v[0-9]+.[0-9]+
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
create-runners:
strategy:
matrix:
machines:
- name: rhel-build
machine_type: e2-standard-4
runner_label: rhel-build-${{ github.run_id }}-${{ github.run_number }}
arm: false
image: projects/rhel-cloud/global/images/rhel-9-v20241210
- name: rhel8-build
machine_type: e2-standard-4
runner_label: rhel8-build-${{ github.run_id }}-${{ github.run_number }}
arm: false
image: projects/rhel-cloud/global/images/rhel-9-v20241210
runs-on: ubuntu-latest
steps:
- name: Create runners
id: create-runner
uses: FalkorDB/gce-github-runner@install_docker
with:
token: ${{ secrets.GH_SA_TOKEN }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
machine_zone: ${{ vars.GCP_ZONE }}
network: gh-runner
disk_size: 100
machine_type: ${{ matrix.machines.machine_type }}
runner_label: ${{ matrix.machines.runner_label }}
arm: ${{ matrix.machines.arm }}
image: ${{ matrix.machines.image }}
build:
needs: create-runners
runs-on: ${{ matrix.platform.machine_label }}
container: falkordb/falkordb-build:latest
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
fail-fast: false
matrix:
platform:
- name: linux/amd64
platform: linux/amd64
suffix: x64
os: ubuntu
machine_label: ubuntu-latest
build_test_image: true
test_dockerfile: Dockerfile.debian
cache_path: linux-x64
is_debug: "0"
- name: linux/arm64
platform: linux/arm64
suffix: arm64v8
os: ubuntu
machine_label: ubuntu-24.04-arm
build_test_image: true
test_dockerfile: Dockerfile.debian
cache_path: linux-arm64v8
is_debug: "0"
- name: linux/x86_64
platform: linux/amd64
suffix: alpine-x64
os: alpine
machine_label: ubuntu-latest
build_test_image: true
dockerfile: Dockerfile.alpine
compiler_dockerfile: Dockerfile.compiler_alpine
test_dockerfile: Dockerfile.alpine
cache_path: linux-x64
is_debug: "0"
- name: linux/arm64
platform: linux/arm64
suffix: alpine-arm64v8
os: alpine
machine_label: ubuntu-24.04-arm
build_test_image: true
dockerfile: Dockerfile.alpine
compiler_dockerfile: Dockerfile.compiler_alpine
test_dockerfile: Dockerfile.alpine
cache_path: linux-arm64v8
is_debug: "0"
- name: rhel/amd64
platform: linux/amd64
suffix: rhel-x64
os: rhel
machine_label: ${{ format('rhel-build-{0}-{1}', github.run_id, github.run_number) }}
build_test_image: false
cache_path: linux-x64
is_debug: "0"
- name: rhel8/amd64
platform: linux/amd64
suffix: rhel8-x64
os: rhel8
machine_label: ${{ format('rhel8-build-{0}-{1}', github.run_id, github.run_number) }}
build_test_image: false
cache_path: linux-x64
is_debug: "0"
- name: linux/amd64
platform: linux/amd64
suffix: x64
os: ubuntu
machine_label: ubuntu-latest
build_test_image: false
test_dockerfile: Dockerfile.debian
cache_path: linux-x64
is_debug: "1"
- name: linux/arm64
platform: linux/arm64
suffix: arm64v8
os: ubuntu
machine_label: ubuntu-24.04-arm
build_test_image: false
test_dockerfile: Dockerfile.debian
cache_path: linux-arm64v8
is_debug: "1"
- name: rhel/amd64
platform: linux/amd64
suffix: rhel-x64
os: rhel
machine_label: ${{ format('rhel-build-{0}-{1}', github.run_id, github.run_number) }}
build_test_image: false
cache_path: linux-x64
is_debug: "1"
- name: rhel8/amd64
platform: linux/amd64
suffix: rhel8-x64
os: rhel8
machine_label: ${{ format('rhel8-build-{0}-{1}', github.run_id, github.run_number) }}
build_test_image: false
cache_path: linux-x64
is_debug: "1"
steps:
- name: Safe dir
run: git config --global --add safe.directory '*'
- uses: actions/checkout@v5
with:
set-safe-directory: "*"
submodules: recursive
- name: Set cache keys
run: |
echo "CACHE_KEY_GRAPHBLAS=graphblas-${{ matrix.platform.suffix }}-${{ hashFiles('./deps/GraphBLAS/Include/GraphBLAS.h', './deps/GraphBLAS/Config/GB_prejit.c') }}" >> $GITHUB_ENV
echo "CACHE_KEY_PARSER=parser-${{ matrix.platform.suffix }}-${{ hashFiles('./deps/libcypher-parser/lib/src/parser.c') }}" >> $GITHUB_ENV
echo "CACHE_KEY_SEARCH=search-${{ matrix.platform.suffix }}-${{ hashFiles('./deps/RediSearch/src/version.h') }}" >> $GITHUB_ENV
echo "CACHE_KEY_LIBCURL=libcurl-${{ matrix.platform.suffix }}-${{ hashFiles('./deps/libcurl/RELEASE-NOTES') }}" >> $GITHUB_ENV
echo "CACHE_KEY_LIBCSV=libcsv-${{ matrix.platform.suffix }}-${{ hashFiles('./deps/libcsv/ChangeLog') }}" >> $GITHUB_ENV
echo "CACHE_KEY_LAGRAPH=lagraph-${{ matrix.platform.suffix }}-${{ hashFiles('./deps/LAGraph/include/LAGraph.h') }}" >> $GITHUB_ENV
- name: Cache GraphBLAS ${{ matrix.platform.suffix }}
id: cache_graphblas
uses: actions/cache/restore@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/GraphBLAS
key: ${{ env.CACHE_KEY_GRAPHBLAS }}
enableCrossOsArchive: true
- name: Cache parser ${{ matrix.platform.suffix }}
id: cache_parser
uses: actions/cache/restore@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/libcypher-parser
key: ${{ env.CACHE_KEY_PARSER }}
enableCrossOsArchive: true
- name: Cache search ${{ matrix.platform.suffix }}
id: cache_search
uses: actions/cache/restore@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/search-static
key: ${{ env.CACHE_KEY_SEARCH }}
enableCrossOsArchive: true
- name: Cache libcurl ${{ matrix.platform.suffix }}
id: cache_libcurl
uses: actions/cache/restore@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/libcurl
key: ${{ env.CACHE_KEY_LIBCURL }}
enableCrossOsArchive: true
- name: Cache libcsv ${{ matrix.platform.suffix }}
id: cache_libcsv
uses: actions/cache/restore@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/libcsv
key: ${{ env.CACHE_KEY_LIBCSV }}
enableCrossOsArchive: true
- name: Cache LAGraph ${{ matrix.platform.suffix }}
id: cache_lagraph
uses: actions/cache/restore@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/LAGraph
key: ${{ env.CACHE_KEY_LAGRAPH }}
enableCrossOsArchive: true
# Make sure the working directory is static between runs
# and always the same for the CMake cache
- name: Relocate source
run: |
mkdir -p /FalkorDB
mv $GITHUB_WORKSPACE/* /FalkorDB
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# network=host driver-opt needed to push to local registry
driver-opts: network=host
- name: Ignore Errors if os is rhel8
if: ${{ matrix.platform.os == 'rhel8' }}
run: sed -i 's/-Werror//g' /FalkorDB/deps/RediSearch/deps/VectorSimilarity/src/VecSim/CMakeLists.txt
- name: Build compiler image
id: build_compiler
uses: docker/build-push-action@v6
with:
context: /FalkorDB
file: /FalkorDB/build/docker/${{ matrix.platform.compiler_dockerfile || 'Dockerfile.compiler' }}
platforms: ${{ matrix.platform.platform }}
tags: localhost:5000/falkordb/falkordb-compiler
# outputs: type=docker,dest=/tmp/falkordb-compiler.tar
push: true
build-args: |
TARGETPLATFORM=${{ matrix.platform.platform }}
OS=${{ matrix.platform.os }}
DEBUG=${{ matrix.platform.is_debug }}
- name: Copy bin from docker for caching
working-directory: /FalkorDB
if: steps.cache_lagraph.outputs.cache-hit == false || steps.cache_graphblas.outputs.cache-hit == false || steps.cache_parser.outputs.cache-hit == false || steps.cache_search.outputs.cache-hit == false || steps.cache_libcurl.outputs.cache-hit == false || steps.cache_libcsv.outputs.cache-hit == false
run: |
id=$(docker create --platform=${{ matrix.platform.platform }} localhost:5000/falkordb/falkordb-compiler)
docker cp $id:/FalkorDB/bin .
docker rm -v $id
ls -l -R /FalkorDB/bin
- name: Save cache for GraphBLAS
if: always() && steps.cache_graphblas.outputs.cache-hit == false && steps.build_compiler.outcome == 'success'
uses: actions/cache/save@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/GraphBLAS
key: ${{ env.CACHE_KEY_GRAPHBLAS }}
enableCrossOsArchive: true
- name: Save cache for parser
if: always() && steps.cache_parser.outputs.cache-hit == false && steps.build_compiler.outcome == 'success'
uses: actions/cache/save@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/libcypher-parser
key: ${{ env.CACHE_KEY_PARSER }}
enableCrossOsArchive: true
- name: Save cache for search
if: always() && steps.cache_search.outputs.cache-hit == false && steps.build_compiler.outcome == 'success'
uses: actions/cache/save@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/search-static
key: ${{ env.CACHE_KEY_SEARCH }}
enableCrossOsArchive: true
- name: Save cache for libcurl
if: always() && steps.cache_libcurl.outputs.cache-hit == false && steps.build_compiler.outcome == 'success'
uses: actions/cache/save@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/libcurl
key: ${{ env.CACHE_KEY_LIBCURL }}
enableCrossOsArchive: true
- name: Save cache for libcsv
if: always() && steps.cache_libcsv.outputs.cache-hit == false && steps.build_compiler.outcome == 'success'
uses: actions/cache/save@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/libcsv
key: ${{ env.CACHE_KEY_LIBCSV }}
enableCrossOsArchive: true
- name: Save cache for LAGraph
if: always() && steps.cache_lagraph.outputs.cache-hit == false && steps.build_compiler.outcome == 'success'
uses: actions/cache/save@v4
with:
path: /FalkorDB/bin/${{ matrix.platform.cache_path }}-release/LAGraph
key: ${{ env.CACHE_KEY_LAGRAPH }}
enableCrossOsArchive: true
- name: Set browser tag
if: ${{ matrix.platform.is_debug == '0' }}
id: set_browser_tag
run: |
BROWSER_TAG="latest"
# If the event is a workflow_dispatch, use the input value
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
BROWSER_TAG=${{ github.event.inputs.browser_tag }}
fi
# If the branch is master, set to "edge"
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
BROWSER_TAG="edge"
fi
# If the branch is not master, set to 'latest'
if [[ "${{ github.ref }}" != "refs/heads/master" ]]; then
BROWSER_TAG="latest"
fi
echo "BROWSER_TAG=${BROWSER_TAG}" >> $GITHUB_ENV
- name: Build tests image
uses: docker/build-push-action@v6
if: ${{ matrix.platform.build_test_image }}
with:
context: .
file: /FalkorDB/tests/${{ matrix.platform.test_dockerfile }}
outputs: type=docker,dest=/tmp/falkordb-tests-${{ matrix.platform.suffix }}.tar
tags: falkordb/falkordb-tests
platforms: ${{ matrix.platform.platform }}
build-args: |
BASE_IMAGE=localhost:5000/falkordb/falkordb-compiler
TARGETPLATFORM=${{ matrix.platform.platform }}
- name: Upload tests image
uses: actions/upload-artifact@v4
if: ${{ matrix.platform.build_test_image }}
with:
name: falkordb-tests-${{ matrix.platform.suffix }}
path: /tmp/falkordb-tests-${{ matrix.platform.suffix }}.tar
if-no-files-found: error
- name: Build base image
if: ${{ matrix.platform.is_debug == '0' }}
id: build
uses: docker/build-push-action@v6
with:
context: /FalkorDB
file: /FalkorDB/build/docker/${{ matrix.platform.dockerfile || 'Dockerfile' }}
platforms: ${{ matrix.platform.platform }}
outputs: type=docker,dest=/tmp/falkordb-${{ matrix.platform.suffix }}.tar
tags: falkordb/falkordb-${{ matrix.platform.suffix }}
build-args: |
BASE_IMAGE=localhost:5000/falkordb/falkordb-compiler
TARGETPLATFORM=${{ matrix.platform.platform }}
BROWSER_TAG=${{ env.BROWSER_TAG }}
- name: Load base image
if: ${{ matrix.platform.is_debug == '0' }}
id: load_base_image
run: |
docker load --input /tmp/falkordb-${{ matrix.platform.suffix }}.tar
- name: Upload image
if: ${{ matrix.platform.is_debug == '0' }}
uses: actions/upload-artifact@v4
with:
name: falkordb-${{ matrix.platform.suffix }}
path: /tmp/falkordb-${{ matrix.platform.suffix }}.tar
if-no-files-found: error
- name: Copy .so from image
run: |
docker run --rm --entrypoint cat localhost:5000/falkordb/falkordb-compiler /FalkorDB/bin/src/falkordb.so > /tmp/falkordb-${{ matrix.platform.is_debug == '0' && matrix.platform.suffix || format('debug-{0}', matrix.platform.suffix) }}.so
- name: Upload .so
uses: actions/upload-artifact@v4
with:
name: falkordb-${{ matrix.platform.is_debug == '0' && matrix.platform.suffix || format('debug-{0}', matrix.platform.suffix) }}.so
path: /tmp/falkordb-${{ matrix.platform.is_debug == '0' && matrix.platform.suffix || format('debug-{0}', matrix.platform.suffix) }}.so
if-no-files-found: error
cleanup-build:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- machine_label: ${{ format('rhel-build-{0}-{1}', github.run_id, github.run_number) }}
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
zone: ${{ vars.GCP_ZONE }}
instance_label: ${{ matrix.platform.machine_label }}
unit-tests:
needs: build
runs-on: ${{ matrix.platform.machine_label }}
strategy:
fail-fast: false
matrix:
platform:
- name: linux/amd64
suffix: x64
os: ubuntu
machine_label: ubuntu-latest
- name: linux/arm64
suffix: arm64v8
os: ubuntu
machine_label: ubuntu-24.04-arm
- name: linux/x86_64
suffix: alpine-x64
os: alpine
machine_label: ubuntu-latest
- name: linux/arm64
suffix: alpine-arm64v8
os: alpine
machine_label: ubuntu-24.04-arm
steps:
- name: Download image
uses: actions/download-artifact@v5
with:
name: falkordb-tests-${{ matrix.platform.suffix }}
path: /tmp
- name: Load image
id: load_image
run: |
docker load --input /tmp/falkordb-tests-${{ matrix.platform.suffix }}.tar
- name: Unit tests
run: |
mkdir -p /tmp/logs
docker run --rm -i -v /tmp/logs:/FalkorDB/tests/unit/logs falkordb/falkordb-tests make CLEAR_LOGS=0 unit-tests
- name: Upload unit test logs
uses: actions/upload-artifact@v4
with:
name: unit-test-logs-${{ matrix.platform.suffix }}
path: /tmp/logs
flow-tests:
needs: build
runs-on: ${{ matrix.platform.machine_label }}
strategy:
fail-fast: false
matrix:
platform:
- name: linux/amd64
suffix: x64
os: ubuntu
machine_label: ubuntu-latest
- name: linux/arm64
suffix: arm64v8
os: ubuntu
machine_label: ubuntu-24.04-arm
- name: linux/x86_64
suffix: alpine-x64
os: alpine
machine_label: ubuntu-latest
- name: linux/arm64
suffix: alpine-arm64v8
os: alpine
machine_label: ubuntu-24.04-arm
steps:
- name: Download image
uses: actions/download-artifact@v5
with:
name: falkordb-tests-${{ matrix.platform.suffix }}
path: /tmp
- name: Load image
id: load_image
run: |
docker load --input /tmp/falkordb-tests-${{ matrix.platform.suffix }}.tar
- name: Flow tests
run: |
mkdir -p /tmp/logs
docker run --rm -i -v /tmp/logs:/FalkorDB/tests/flow/logs falkordb/falkordb-tests make CLEAR_LOGS=0 PARALLEL=1 flow-tests
- name: Upload flow test logs
uses: actions/upload-artifact@v4
with:
name: flow-test-logs-${{ matrix.platform.suffix }}
path: /tmp/logs
tck-tests:
needs: build
runs-on: ${{ matrix.platform.machine_label }}
strategy:
fail-fast: false
matrix:
platform:
- name: linux/amd64
suffix: x64
os: ubuntu
machine_label: ubuntu-latest
- name: linux/arm64
suffix: arm64v8
os: ubuntu
machine_label: ubuntu-24.04-arm
- name: linux/x86_64
suffix: alpine-x64
os: alpine
machine_label: ubuntu-latest
- name: linux/arm64
suffix: alpine-arm64v8
os: alpine
machine_label: ubuntu-24.04-arm
steps:
- name: Download image
uses: actions/download-artifact@v5
with:
name: falkordb-tests-${{ matrix.platform.suffix }}
path: /tmp
- name: Load image
id: load_image
run: |
docker load --input /tmp/falkordb-tests-${{ matrix.platform.suffix }}.tar
- name: TCK tests
run: |
mkdir -p /tmp/logs
docker run --rm -i -v /tmp/logs:/FalkorDB/tests/tck/logs falkordb/falkordb-tests make CLEAR_LOGS=0 tck-tests
- name: Upload TCK test logs
uses: actions/upload-artifact@v4
with:
name: tck-test-logs-${{ matrix.platform.suffix }}
path: /tmp/logs
fuzz-tests:
needs: build
runs-on: ${{ matrix.platform.machine_label }}
strategy:
fail-fast: false
matrix:
platform:
- name: linux/amd64
suffix: x64
os: ubuntu
machine_label: ubuntu-latest
- name: linux/arm64
suffix: arm64v8
os: ubuntu
machine_label: ubuntu-24.04-arm
- name: linux/x86_64
suffix: alpine-x64
os: alpine
machine_label: ubuntu-latest
- name: linux/arm64
suffix: alpine-arm64v8
os: alpine
machine_label: ubuntu-24.04-arm
steps:
- name: Download image
uses: actions/download-artifact@v5
with:
name: falkordb-tests-${{ matrix.platform.suffix }}
path: /tmp
- name: Load image
id: load_image
run: |
docker load --input /tmp/falkordb-tests-${{ matrix.platform.suffix }}.tar
- name: Fuzz tests
run: |
mkdir -p /tmp/logs
docker run --rm -i -v /tmp/logs:/FalkorDB/tests/fuzz/logs falkordb/falkordb-tests make fuzz TIMEOUT=180
- name: Upload fuzz test logs
uses: actions/upload-artifact@v4
with:
name: fuzz-test-logs-${{ matrix.platform.suffix }}
path: /tmp/logs
#upgrade-tests:
# needs: build
# runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || format('upgrade-tests-{0}-{1}', github.run_id, github.run_number) }}
# strategy:
# fail-fast: false
# matrix:
# platform:
# - linux/amd64
# - linux/arm64
# env:
# ARCH: ${{ matrix.platform == 'linux/amd64' && 'x64' || 'arm64v8' }}
# steps:
# - name: Download image
# uses: actions/download-artifact@v5
# with:
# name: falkordb-tests-${{ matrix.platform.suffix }}
# path: /tmp
# - name: Load image
# id: load_image
# run: |
# docker load --input /tmp/falkordb-tests-${{ matrix.platform.suffix }}.tar
# - name: Upgrade tests
# env:
# DOCKER_NETWORK: falkordb-network
# run: |
# sudo chmod 666 /var/run/docker.sock
# docker network create --driver bridge $DOCKER_NETWORK
# docker run -i --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock --network $DOCKER_NETWORK -e DOCKER_NETWORK=$DOCKER_NETWORK falkordb/falkordb-tests make upgrade-tests TIMEOUT=180
#cleanup-upgrade-tests:
# needs: upgrade-tests
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v5
# - uses: ./.github/actions/cleanup-runner
# with:
# service_account_key: ${{ secrets.GCP_SA_KEY }}
# project_id: ${{ secrets.GCP_PROJECT_ID }}
# zone: ${{ vars.GCP_ZONE }}
# instance_label: upgrade-tests-${{ github.run_id }}-${{ github.run_number }}
trivy:
needs: build
runs-on: ${{ matrix.platform.machine_label }}
strategy:
fail-fast: false
matrix:
platform:
- name: linux/amd64
suffix: x64
os: ubuntu
machine_label: ubuntu-latest
- name: linux/arm64
suffix: arm64v8
os: ubuntu
machine_label: ubuntu-24.04-arm
- name: linux/x86_64
suffix: alpine-x64
os: alpine
machine_label: ubuntu-latest
- name: linux/arm64
suffix: alpine-arm64v8
os: alpine
machine_label: ubuntu-24.04-arm
steps:
- name: Download image
uses: actions/download-artifact@v5
with:
name: falkordb-${{ matrix.platform.suffix }}
path: /tmp
- name: Load image
id: load_image
run: |
docker load --input /tmp/falkordb-${{ matrix.platform.suffix }}.tar
- name: Set up Trivy
uses: aquasecurity/[email protected]
with:
image-ref: falkordb/falkordb-${{ matrix.platform.suffix }}
severity: CRITICAL,HIGH
format: sarif
output: trivy-results.sarif
ignore-unfixed: true
scan-type: image
# ignore-policy: .github/trivy-ignore-policy.json
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'