mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-11 15:25:52 +00:00
test: Add build_and_test reusable workflow (#2048)
This commit is contained in:
10
.github/actions/build_clio/action.yml
vendored
10
.github/actions/build_clio/action.yml
vendored
@@ -1,13 +1,15 @@
|
|||||||
name: Build clio
|
name: Build clio
|
||||||
description: Build clio in build directory
|
description: Build clio in build directory
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
target:
|
targets:
|
||||||
description: Build target name
|
description: Space-separated build target names
|
||||||
default: all
|
default: all
|
||||||
subtract_threads:
|
subtract_threads:
|
||||||
description: An option for the action get_number_of_threads. See get_number_of_threads
|
description: An option for the action get_number_of_threads. See get_number_of_threads
|
||||||
required: true
|
required: true
|
||||||
default: "0"
|
default: "0"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
@@ -17,8 +19,8 @@ runs:
|
|||||||
with:
|
with:
|
||||||
subtract_threads: ${{ inputs.subtract_threads }}
|
subtract_threads: ${{ inputs.subtract_threads }}
|
||||||
|
|
||||||
- name: Build Clio
|
- name: Build targets
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd build
|
cd build
|
||||||
cmake --build . --parallel ${{ steps.number_of_threads.outputs.threads_number }} --target ${{ inputs.target }}
|
cmake --build . --parallel ${{ steps.number_of_threads.outputs.threads_number }} --target ${{ inputs.targets }}
|
||||||
|
|||||||
57
.github/workflows/build.yml
vendored
57
.github/workflows/build.yml
vendored
@@ -1,4 +1,5 @@
|
|||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master, release/*, develop]
|
branches: [master, release/*, develop]
|
||||||
@@ -7,8 +8,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-test:
|
||||||
name: Build
|
name: Build and Test
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -42,7 +44,8 @@ jobs:
|
|||||||
build_type: Release
|
build_type: Release
|
||||||
code_coverage: false
|
code_coverage: false
|
||||||
static: false
|
static: false
|
||||||
uses: ./.github/workflows/build_impl.yml
|
|
||||||
|
uses: ./.github/workflows/build_and_test.yml
|
||||||
with:
|
with:
|
||||||
runs_on: ${{ matrix.os }}
|
runs_on: ${{ matrix.os }}
|
||||||
container: ${{ matrix.container }}
|
container: ${{ matrix.container }}
|
||||||
@@ -50,55 +53,13 @@ jobs:
|
|||||||
build_type: ${{ matrix.build_type }}
|
build_type: ${{ matrix.build_type }}
|
||||||
code_coverage: ${{ matrix.code_coverage }}
|
code_coverage: ${{ matrix.code_coverage }}
|
||||||
static: ${{ matrix.static }}
|
static: ${{ matrix.static }}
|
||||||
unit_tests: true
|
run_unit_tests: true
|
||||||
integration_tests: true
|
run_integration_tests: false
|
||||||
clio_server: true
|
clio_server: true
|
||||||
|
|
||||||
test:
|
|
||||||
name: Run Tests
|
|
||||||
needs: build
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: heavy
|
|
||||||
conan_profile: gcc
|
|
||||||
build_type: Release
|
|
||||||
container:
|
|
||||||
image: ghcr.io/xrplf/clio-ci:latest
|
|
||||||
- os: heavy
|
|
||||||
conan_profile: clang
|
|
||||||
build_type: Release
|
|
||||||
container:
|
|
||||||
image: ghcr.io/xrplf/clio-ci:latest
|
|
||||||
- os: heavy
|
|
||||||
conan_profile: clang
|
|
||||||
build_type: Debug
|
|
||||||
container:
|
|
||||||
image: ghcr.io/xrplf/clio-ci:latest
|
|
||||||
- os: macos15
|
|
||||||
conan_profile: default_apple_clang
|
|
||||||
build_type: Release
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
container: ${{ matrix.container }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Clean workdir
|
|
||||||
if: ${{ runner.os == 'macOS' }}
|
|
||||||
uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce #v1.0
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: clio_tests_${{ runner.os }}_${{ matrix.build_type }}_${{ matrix.conan_profile }}
|
|
||||||
|
|
||||||
- name: Run clio_tests
|
|
||||||
run: |
|
|
||||||
chmod +x ./clio_tests
|
|
||||||
./clio_tests
|
|
||||||
|
|
||||||
check_config:
|
check_config:
|
||||||
name: Check Config Description
|
name: Check Config Description
|
||||||
needs: build
|
needs: build-and-test
|
||||||
runs-on: heavy
|
runs-on: heavy
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/xrplf/clio-ci:latest
|
image: ghcr.io/xrplf/clio-ci:latest
|
||||||
|
|||||||
99
.github/workflows/build_and_test.yml
vendored
Normal file
99
.github/workflows/build_and_test.yml
vendored
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
name: Reusable build and test
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
runs_on:
|
||||||
|
description: Runner to run the job on
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
container:
|
||||||
|
description: "The container object as a JSON string (leave empty to run natively)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
conan_profile:
|
||||||
|
description: Conan profile to use
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
build_type:
|
||||||
|
description: Build type
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
disable_cache:
|
||||||
|
description: Whether ccache and conan cache should be disabled
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
code_coverage:
|
||||||
|
description: Whether to enable code coverage
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
static:
|
||||||
|
description: Whether to build static binaries
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
|
||||||
|
run_unit_tests:
|
||||||
|
description: Whether to run unit tests
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
run_integration_tests:
|
||||||
|
description: Whether to run integration tests
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
clio_server:
|
||||||
|
description: Whether to build clio_server
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
targets:
|
||||||
|
description: Space-separated build target names
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: all
|
||||||
|
|
||||||
|
sanitizer:
|
||||||
|
description: Sanitizer to use
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "false"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
uses: ./.github/workflows/build_impl.yml
|
||||||
|
with:
|
||||||
|
runs_on: ${{ inputs.runs_on }}
|
||||||
|
container: ${{ inputs.container }}
|
||||||
|
conan_profile: ${{ inputs.conan_profile }}
|
||||||
|
build_type: ${{ inputs.build_type }}
|
||||||
|
disable_cache: ${{ inputs.disable_cache }}
|
||||||
|
code_coverage: ${{ inputs.code_coverage }}
|
||||||
|
static: ${{ inputs.static }}
|
||||||
|
clio_server: ${{ inputs.clio_server }}
|
||||||
|
targets: ${{ inputs.targets }}
|
||||||
|
sanitizer: ${{ inputs.sanitizer }}
|
||||||
|
|
||||||
|
test:
|
||||||
|
needs: build
|
||||||
|
# TODO: We don't upload tests if code coverage is enabled
|
||||||
|
if: ${{ !inputs.code_coverage }}
|
||||||
|
uses: ./.github/workflows/test_impl.yml
|
||||||
|
with:
|
||||||
|
runs_on: ${{ inputs.runs_on }}
|
||||||
|
container: ${{ inputs.container }}
|
||||||
|
conan_profile: ${{ inputs.conan_profile }}
|
||||||
|
build_type: ${{ inputs.build_type }}
|
||||||
|
run_unit_tests: ${{ inputs.run_unit_tests }}
|
||||||
|
run_integration_tests: ${{ inputs.run_integration_tests }}
|
||||||
|
sanitizer: ${{ inputs.sanitizer }}
|
||||||
35
.github/workflows/build_impl.yml
vendored
35
.github/workflows/build_impl.yml
vendored
@@ -1,4 +1,5 @@
|
|||||||
name: Reusable build
|
name: Reusable build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
@@ -6,13 +7,11 @@ on:
|
|||||||
description: Runner to run the job on
|
description: Runner to run the job on
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
default: heavy
|
|
||||||
|
|
||||||
container:
|
container:
|
||||||
description: "The container object as a JSON string (leave empty to run natively)"
|
description: "The container object as a JSON string (leave empty to run natively)"
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
default: ""
|
|
||||||
|
|
||||||
conan_profile:
|
conan_profile:
|
||||||
description: Conan profile to use
|
description: Conan profile to use
|
||||||
@@ -28,49 +27,31 @@ on:
|
|||||||
description: Whether ccache and conan cache should be disabled
|
description: Whether ccache and conan cache should be disabled
|
||||||
required: false
|
required: false
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
|
||||||
|
|
||||||
code_coverage:
|
code_coverage:
|
||||||
description: Whether to enable code coverage
|
description: Whether to enable code coverage
|
||||||
required: true
|
required: true
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
|
||||||
|
|
||||||
static:
|
static:
|
||||||
description: Whether to build static binaries
|
description: Whether to build static binaries
|
||||||
required: true
|
required: true
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
|
||||||
|
|
||||||
unit_tests:
|
|
||||||
description: Whether to run unit tests
|
|
||||||
required: true
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
integration_tests:
|
|
||||||
description: Whether to run integration tests
|
|
||||||
required: true
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
clio_server:
|
clio_server:
|
||||||
description: Whether to build clio_server
|
description: Whether to build clio_server
|
||||||
required: true
|
required: true
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
|
||||||
|
|
||||||
target:
|
targets:
|
||||||
description: Build target name
|
description: Space-separated build target names
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: all
|
|
||||||
|
|
||||||
sanitizer:
|
sanitizer:
|
||||||
description: Sanitizer to use
|
description: Sanitizer to use
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: "false"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -121,7 +102,7 @@ jobs:
|
|||||||
- name: Build Clio
|
- name: Build Clio
|
||||||
uses: ./.github/actions/build_clio
|
uses: ./.github/actions/build_clio
|
||||||
with:
|
with:
|
||||||
target: ${{ inputs.target }}
|
targets: ${{ inputs.targets }}
|
||||||
|
|
||||||
- name: Show ccache's statistics
|
- name: Show ccache's statistics
|
||||||
if: ${{ !inputs.disable_cache }}
|
if: ${{ !inputs.disable_cache }}
|
||||||
@@ -134,11 +115,11 @@ jobs:
|
|||||||
cat /tmp/ccache.stats
|
cat /tmp/ccache.stats
|
||||||
|
|
||||||
- name: Strip unit_tests
|
- name: Strip unit_tests
|
||||||
if: ${{ inputs.unit_tests && !inputs.code_coverage && inputs.sanitizer == 'false' }}
|
if: ${{ !inputs.code_coverage && inputs.sanitizer == 'false' }}
|
||||||
run: strip build/clio_tests
|
run: strip build/clio_tests
|
||||||
|
|
||||||
- name: Strip integration_tests
|
- name: Strip integration_tests
|
||||||
if: ${{ inputs.integration_tests && !inputs.code_coverage }}
|
if: ${{ !inputs.code_coverage }}
|
||||||
run: strip build/clio_integration_tests
|
run: strip build/clio_integration_tests
|
||||||
|
|
||||||
- name: Upload clio_server
|
- name: Upload clio_server
|
||||||
@@ -149,14 +130,14 @@ jobs:
|
|||||||
path: build/clio_server
|
path: build/clio_server
|
||||||
|
|
||||||
- name: Upload clio_tests
|
- name: Upload clio_tests
|
||||||
if: ${{ inputs.unit_tests && !inputs.code_coverage }}
|
if: ${{ !inputs.code_coverage }}
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: clio_tests_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }}
|
name: clio_tests_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }}
|
||||||
path: build/clio_tests
|
path: build/clio_tests
|
||||||
|
|
||||||
- name: Upload clio_integration_tests
|
- name: Upload clio_integration_tests
|
||||||
if: ${{ inputs.integration_tests && !inputs.code_coverage }}
|
if: ${{ !inputs.code_coverage }}
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: clio_integration_tests_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }}
|
name: clio_integration_tests_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }}
|
||||||
|
|||||||
79
.github/workflows/nightly.yml
vendored
79
.github/workflows/nightly.yml
vendored
@@ -1,4 +1,5 @@
|
|||||||
name: Nightly release
|
name: Nightly release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 8 * * 1-5"
|
- cron: "0 8 * * 1-5"
|
||||||
@@ -9,8 +10,9 @@ on:
|
|||||||
- ".github/workflows/build_clio_docker_image.yml"
|
- ".github/workflows/build_clio_docker_image.yml"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-test:
|
||||||
name: Build clio
|
name: Build and Test
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -29,7 +31,8 @@ jobs:
|
|||||||
build_type: Debug
|
build_type: Debug
|
||||||
static: true
|
static: true
|
||||||
container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }'
|
container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }'
|
||||||
uses: ./.github/workflows/build_impl.yml
|
|
||||||
|
uses: ./.github/workflows/build_and_test.yml
|
||||||
with:
|
with:
|
||||||
runs_on: ${{ matrix.os }}
|
runs_on: ${{ matrix.os }}
|
||||||
container: ${{ matrix.container }}
|
container: ${{ matrix.container }}
|
||||||
@@ -37,73 +40,13 @@ jobs:
|
|||||||
build_type: ${{ matrix.build_type }}
|
build_type: ${{ matrix.build_type }}
|
||||||
code_coverage: false
|
code_coverage: false
|
||||||
static: ${{ matrix.static }}
|
static: ${{ matrix.static }}
|
||||||
unit_tests: true
|
run_unit_tests: true
|
||||||
integration_tests: true
|
run_integration_tests: ${{ matrix.os != 'macos15' }}
|
||||||
clio_server: true
|
clio_server: true
|
||||||
disable_cache: true
|
disable_cache: true
|
||||||
|
|
||||||
run_tests:
|
|
||||||
needs: build
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: macos15
|
|
||||||
conan_profile: default_apple_clang
|
|
||||||
build_type: Release
|
|
||||||
integration_tests: false
|
|
||||||
- os: heavy
|
|
||||||
conan_profile: gcc
|
|
||||||
build_type: Release
|
|
||||||
container:
|
|
||||||
image: ghcr.io/xrplf/clio-ci:latest
|
|
||||||
integration_tests: true
|
|
||||||
- os: heavy
|
|
||||||
conan_profile: gcc
|
|
||||||
build_type: Debug
|
|
||||||
container:
|
|
||||||
image: ghcr.io/xrplf/clio-ci:latest
|
|
||||||
integration_tests: true
|
|
||||||
runs-on: [self-hosted, "${{ matrix.os }}"]
|
|
||||||
container: ${{ matrix.container }}
|
|
||||||
|
|
||||||
services:
|
|
||||||
scylladb:
|
|
||||||
image: ${{ (matrix.integration_tests) && 'scylladb/scylla' || '' }}
|
|
||||||
options: >-
|
|
||||||
--health-cmd "cqlsh -e 'describe cluster'"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Clean workdir
|
|
||||||
if: ${{ runner.os == 'macOS' }}
|
|
||||||
uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce #v1.0
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: clio_tests_${{ runner.os }}_${{ matrix.build_type }}_${{ matrix.conan_profile }}
|
|
||||||
|
|
||||||
- name: Run clio_tests
|
|
||||||
run: |
|
|
||||||
chmod +x ./clio_tests
|
|
||||||
./clio_tests
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: clio_integration_tests_${{ runner.os }}_${{ matrix.build_type }}_${{ matrix.conan_profile }}
|
|
||||||
|
|
||||||
# To be enabled back once docker in mac runner arrives
|
|
||||||
# https://github.com/XRPLF/clio/issues/1400
|
|
||||||
- name: Run clio_integration_tests
|
|
||||||
if: matrix.integration_tests
|
|
||||||
run: |
|
|
||||||
chmod +x ./clio_integration_tests
|
|
||||||
./clio_integration_tests --backend_host=scylladb
|
|
||||||
|
|
||||||
nightly_release:
|
nightly_release:
|
||||||
needs: run_tests
|
needs: build-and-test
|
||||||
uses: ./.github/workflows/release_impl.yml
|
uses: ./.github/workflows/release_impl.yml
|
||||||
with:
|
with:
|
||||||
overwrite_release: true
|
overwrite_release: true
|
||||||
@@ -113,7 +56,7 @@ jobs:
|
|||||||
|
|
||||||
build_and_publish_docker_image:
|
build_and_publish_docker_image:
|
||||||
uses: ./.github/workflows/build_clio_docker_image.yml
|
uses: ./.github/workflows/build_clio_docker_image.yml
|
||||||
needs: run_tests
|
needs: build-and-test
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
tags: |
|
tags: |
|
||||||
@@ -124,7 +67,7 @@ jobs:
|
|||||||
publish_image: ${{ github.event_name != 'pull_request' }}
|
publish_image: ${{ github.event_name != 'pull_request' }}
|
||||||
|
|
||||||
create_issue_on_failure:
|
create_issue_on_failure:
|
||||||
needs: [build, run_tests, nightly_release, build_and_publish_docker_image]
|
needs: [build-and-test, nightly_release, build_and_publish_docker_image]
|
||||||
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name != 'pull_request' }}
|
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name != 'pull_request' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
|
|||||||
91
.github/workflows/sanitizers.yml
vendored
91
.github/workflows/sanitizers.yml
vendored
@@ -1,4 +1,5 @@
|
|||||||
name: Run tests with sanitizers
|
name: Run tests with sanitizers
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 4 * * 1-5"
|
- cron: "0 4 * * 1-5"
|
||||||
@@ -8,8 +9,9 @@ on:
|
|||||||
- ".github/workflows/sanitizers.yml"
|
- ".github/workflows/sanitizers.yml"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-test:
|
||||||
name: Build clio tests
|
name: Build and Test
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -18,89 +20,20 @@ jobs:
|
|||||||
compiler: gcc
|
compiler: gcc
|
||||||
- sanitizer: asan
|
- sanitizer: asan
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
# - sanitizer: ubsan # todo: enable when heavy runners are available
|
- sanitizer: ubsan
|
||||||
# compiler: gcc
|
compiler: gcc
|
||||||
uses: ./.github/workflows/build_impl.yml
|
|
||||||
|
uses: ./.github/workflows/build_and_test.yml
|
||||||
with:
|
with:
|
||||||
runs_on: ubuntu-latest # todo: change to heavy
|
runs_on: heavy
|
||||||
container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }'
|
container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }'
|
||||||
disable_cache: true
|
disable_cache: true
|
||||||
conan_profile: ${{ matrix.compiler }}.${{ matrix.sanitizer }}
|
conan_profile: ${{ matrix.compiler }}.${{ matrix.sanitizer }}
|
||||||
build_type: Release
|
build_type: Release
|
||||||
code_coverage: false
|
code_coverage: false
|
||||||
static: false
|
static: false
|
||||||
unit_tests: true
|
run_unit_tests: true
|
||||||
integration_tests: false
|
run_integration_tests: false
|
||||||
clio_server: false
|
clio_server: false
|
||||||
target: clio_tests
|
targets: clio_tests clio_integration_tests
|
||||||
sanitizer: ${{ matrix.sanitizer }}
|
sanitizer: ${{ matrix.sanitizer }}
|
||||||
|
|
||||||
# consider combining this with the previous matrix instead
|
|
||||||
run_tests:
|
|
||||||
needs: build
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- sanitizer: tsan
|
|
||||||
compiler: gcc
|
|
||||||
- sanitizer: asan
|
|
||||||
compiler: gcc
|
|
||||||
# - sanitizer: ubsan # todo: enable when heavy runners are available
|
|
||||||
# compiler: gcc
|
|
||||||
runs-on: ubuntu-latest # todo: change to heavy
|
|
||||||
container:
|
|
||||||
image: ghcr.io/xrplf/clio-ci:latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
issues: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: clio_tests_${{ runner.os }}_Release_${{ matrix.compiler }}.${{ matrix.sanitizer }}
|
|
||||||
|
|
||||||
- name: Run clio_tests [${{ matrix.compiler }} / ${{ matrix.sanitizer }}]
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
chmod +x ./clio_tests
|
|
||||||
./.github/scripts/execute-tests-under-sanitizer ./clio_tests
|
|
||||||
|
|
||||||
- name: Check for sanitizer report
|
|
||||||
shell: bash
|
|
||||||
id: check_report
|
|
||||||
run: |
|
|
||||||
if ls .sanitizer-report/* 1> /dev/null 2>&1; then
|
|
||||||
echo "found_report=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "found_report=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Upload report
|
|
||||||
if: ${{ steps.check_report.outputs.found_report == 'true' }}
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.compiler }}_${{ matrix.sanitizer }}_report
|
|
||||||
path: .sanitizer-report/*
|
|
||||||
include-hidden-files: true
|
|
||||||
|
|
||||||
#
|
|
||||||
# todo: enable when we have fixed all currently existing issues from sanitizers
|
|
||||||
#
|
|
||||||
# - name: Create an issue
|
|
||||||
# if: ${{ steps.check_report.outputs.found_report == 'true' }}
|
|
||||||
# uses: ./.github/actions/create_issue
|
|
||||||
# env:
|
|
||||||
# GH_TOKEN: ${{ github.token }}
|
|
||||||
# with:
|
|
||||||
# labels: 'bug'
|
|
||||||
# title: '[${{ matrix.sanitizer }}/${{ matrix.compiler }}] reported issues'
|
|
||||||
# body: >
|
|
||||||
# Clio tests failed one or more sanitizer checks when built with ${{ matrix.compiler }}`.
|
|
||||||
|
|
||||||
# Workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/
|
|
||||||
# Reports are available as artifacts.
|
|
||||||
|
|||||||
130
.github/workflows/test_impl.yml
vendored
Normal file
130
.github/workflows/test_impl.yml
vendored
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
name: Reusable test
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
runs_on:
|
||||||
|
description: Runner to run the job on
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
container:
|
||||||
|
description: "The container object as a JSON string (leave empty to run natively)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
conan_profile:
|
||||||
|
description: Conan profile to use
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
build_type:
|
||||||
|
description: Build type
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
run_unit_tests:
|
||||||
|
description: Whether to run unit tests
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
run_integration_tests:
|
||||||
|
description: Whether to run integration tests
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
sanitizer:
|
||||||
|
description: Sanitizer to use
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unit_tests:
|
||||||
|
name: Unit testing ${{ inputs.container != '' && 'in container' || 'natively' }}
|
||||||
|
runs-on: ${{ inputs.runs_on }}
|
||||||
|
container: ${{ inputs.container != '' && fromJson(inputs.container) || null }}
|
||||||
|
|
||||||
|
if: inputs.run_unit_tests
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clean workdir
|
||||||
|
if: ${{ runner.os == 'macOS' }}
|
||||||
|
uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce #v1.0
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: clio_tests_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }}
|
||||||
|
|
||||||
|
- name: Run clio_tests
|
||||||
|
run: |
|
||||||
|
chmod +x ./clio_tests
|
||||||
|
${{ inputs.sanitizer != 'false' && './.github/scripts/execute-tests-under-sanitizer' || '' }} ./clio_tests
|
||||||
|
|
||||||
|
- name: Check for sanitizer report
|
||||||
|
shell: bash
|
||||||
|
id: check_report
|
||||||
|
run: |
|
||||||
|
if ls .sanitizer-report/* 1> /dev/null 2>&1; then
|
||||||
|
echo "found_report=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "found_report=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload sanitizer report
|
||||||
|
if: ${{ steps.check_report.outputs.found_report == 'true' }}
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.conan_profile }}_report
|
||||||
|
path: .sanitizer-report/*
|
||||||
|
include-hidden-files: true
|
||||||
|
|
||||||
|
# TODO: enable when we have fixed all currently existing issues from sanitizers
|
||||||
|
- name: Create an issue
|
||||||
|
if: ${{ false && steps.check_report.outputs.found_report == 'true' }}
|
||||||
|
uses: ./.github/actions/create_issue
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
with:
|
||||||
|
labels: "bug"
|
||||||
|
title: "[${{ inputs.conan_profile }}] reported issues"
|
||||||
|
body: >
|
||||||
|
Clio tests failed one or more sanitizer checks when built with ${{ inputs.conan_profile }}`.
|
||||||
|
|
||||||
|
Workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/
|
||||||
|
Reports are available as artifacts.
|
||||||
|
|
||||||
|
integration_tests:
|
||||||
|
name: Integration testing ${{ inputs.container != '' && 'in container' || 'natively' }}
|
||||||
|
runs-on: ${{ inputs.runs_on }}
|
||||||
|
container: ${{ inputs.container != '' && fromJson(inputs.container) || null }}
|
||||||
|
|
||||||
|
if: inputs.run_integration_tests
|
||||||
|
|
||||||
|
services:
|
||||||
|
scylladb:
|
||||||
|
image: "scylladb/scylla"
|
||||||
|
options: >-
|
||||||
|
--health-cmd "cqlsh -e 'describe cluster'"
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clean workdir
|
||||||
|
if: ${{ runner.os == 'macOS' }}
|
||||||
|
uses: kuznetsss/workspace-cleanup@80b9863b45562c148927c3d53621ef354e5ae7ce #v1.0
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: clio_integration_tests_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }}
|
||||||
|
|
||||||
|
# To be enabled back once docker in mac runner arrives
|
||||||
|
# https://github.com/XRPLF/clio/issues/1400
|
||||||
|
- name: Run clio_integration_tests
|
||||||
|
run: |
|
||||||
|
chmod +x ./clio_integration_tests
|
||||||
|
./clio_integration_tests --backend_host=scylladb
|
||||||
Reference in New Issue
Block a user