diff --git a/.github/actions/build-deps/action.yml b/.github/actions/build-deps/action.yml index 351d8a6361..a908c656e8 100644 --- a/.github/actions/build-deps/action.yml +++ b/.github/actions/build-deps/action.yml @@ -20,14 +20,18 @@ runs: steps: - name: Install Conan dependencies shell: bash + env: + BUILD_DIR: ${{ inputs.build_dir }} + BUILD_OPTION: ${{ inputs.force_build == 'true' && '*' || 'missing' }} + BUILD_TYPE: ${{ inputs.build_type }} run: | echo 'Installing dependencies.' - mkdir -p ${{ inputs.build_dir }} - cd ${{ inputs.build_dir }} + mkdir -p '${{ env.BUILD_DIR }}' + cd '${{ env.BUILD_DIR }}' conan install \ --output-folder . \ - --build ${{ inputs.force_build == 'true' && '"*"' || 'missing' }} \ - --options:host '&:tests=True' \ - --options:host '&:xrpld=True' \ - --settings:all build_type=${{ inputs.build_type }} \ + --build=${{ env.BUILD_OPTION }} \ + --options:host='&:tests=True' \ + --options:host='&:xrpld=True' \ + --settings:all build_type='${{ env.BUILD_TYPE }}' \ .. diff --git a/.github/actions/build-test/action.yml b/.github/actions/build-test/action.yml deleted file mode 100644 index cf1bac16f7..0000000000 --- a/.github/actions/build-test/action.yml +++ /dev/null @@ -1,96 +0,0 @@ -# This action build and tests the binary. The Conan dependencies must have -# already been installed (see the build-deps action). -name: Build and Test -description: "Build and test the binary." - -# Note that actions do not support 'type' and all inputs are strings, see -# https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs. -inputs: - build_dir: - description: "The directory where to build." - required: true - build_only: - description: 'Whether to only build or to build and test the code ("true", "false").' - required: false - default: "false" - build_type: - description: 'The build type to use ("Debug", "Release").' - required: true - cmake_args: - description: "Additional arguments to pass to CMake." - required: false - default: "" - cmake_target: - description: "The CMake target to build." - required: true - codecov_token: - description: "The Codecov token to use for uploading coverage reports." - required: false - default: "" - os: - description: 'The operating system to use for the build ("linux", "macos", "windows").' - required: true - -runs: - using: composite - steps: - - name: Configure CMake - shell: bash - working-directory: ${{ inputs.build_dir }} - run: | - echo 'Configuring CMake.' - cmake \ - -G '${{ inputs.os == 'windows' && 'Visual Studio 17 2022' || 'Ninja' }}' \ - -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \ - -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ - ${{ inputs.cmake_args }} \ - .. - - name: Build the binary - shell: bash - working-directory: ${{ inputs.build_dir }} - run: | - echo 'Building binary.' - cmake \ - --build . \ - --config ${{ inputs.build_type }} \ - --parallel $(nproc) \ - --target ${{ inputs.cmake_target }} - - name: Check linking - if: ${{ inputs.os == 'linux' }} - shell: bash - working-directory: ${{ inputs.build_dir }} - run: | - echo 'Checking linking.' - ldd ./rippled - if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then - echo 'The binary is statically linked.' - else - echo 'The binary is dynamically linked.' - exit 1 - fi - - name: Verify voidstar - if: ${{ contains(inputs.cmake_args, '-Dvoidstar=ON') }} - shell: bash - working-directory: ${{ inputs.build_dir }} - run: | - echo 'Verifying presence of instrumentation.' - ./rippled --version | grep libvoidstar - - name: Test the binary - if: ${{ inputs.build_only == 'false' }} - shell: bash - working-directory: ${{ inputs.build_dir }}/${{ inputs.os == 'windows' && inputs.build_type || '' }} - run: | - echo 'Testing binary.' - ./rippled --unittest --unittest-jobs $(nproc) - ctest -j $(nproc) --output-on-failure - - name: Upload coverage report - if: ${{ inputs.cmake_target == 'coverage' }} - uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 - with: - disable_search: true - disable_telem: true - fail_ci_if_error: true - files: ${{ inputs.build_dir }}/coverage.xml - plugins: noop - token: ${{ inputs.codecov_token }} - verbose: true diff --git a/.github/actions/print-env/action.yml b/.github/actions/print-env/action.yml new file mode 100644 index 0000000000..6019a6de2f --- /dev/null +++ b/.github/actions/print-env/action.yml @@ -0,0 +1,43 @@ +name: Print build environment +description: "Print environment and some tooling versions" + +runs: + using: composite + steps: + - name: Check configuration (Windows) + if: ${{ runner.os == 'Windows' }} + shell: bash + run: | + echo 'Checking environment variables.' + set + + echo 'Checking CMake version.' + cmake --version + + echo 'Checking Conan version.' + conan --version + + - name: Check configuration (Linux and macOS) + if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} + shell: bash + run: | + echo 'Checking path.' + echo ${PATH} | tr ':' '\n' + + echo 'Checking environment variables.' + env | sort + + echo 'Checking CMake version.' + cmake --version + + echo 'Checking compiler version.' + ${{ runner.os == 'Linux' && '${CC}' || 'clang' }} --version + + echo 'Checking Conan version.' + conan --version + + echo 'Checking Ninja version.' + ninja --version + + echo 'Checking nproc version.' + nproc --version diff --git a/.github/actions/setup-conan/action.yml b/.github/actions/setup-conan/action.yml index d31809dc94..02061c7a64 100644 --- a/.github/actions/setup-conan/action.yml +++ b/.github/actions/setup-conan/action.yml @@ -35,9 +35,12 @@ runs: - name: Set up Conan remote shell: bash + env: + CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }} + CONAN_REMOTE_URL: ${{ inputs.conan_remote_url }} run: | - echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}." - conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }} + echo "Adding Conan remote '${{ env.CONAN_REMOTE_NAME }}' at '${{ env.CONAN_REMOTE_URL }}'." + conan remote add --index 0 --force '${{ env.CONAN_REMOTE_NAME }}' '${{ env.CONAN_REMOTE_URL }}' echo 'Listing Conan remotes.' conan remote list diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py index ac39803fff..fd05895b0e 100755 --- a/.github/scripts/strategy-matrix/generate.py +++ b/.github/scripts/strategy-matrix/generate.py @@ -162,7 +162,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: 'config_name': config_name, 'cmake_args': cmake_args, 'cmake_target': cmake_target, - 'build_only': 'true' if build_only else 'false', + 'build_only': build_only, 'build_type': build_type, 'os': os, 'architecture': architecture, diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index a206bbf041..47323ee4a7 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -59,8 +59,11 @@ jobs: .github/actions/build-test/** .github/actions/setup-conan/** .github/scripts/strategy-matrix/** + .github/workflows/reusable-build.yml + .github/workflows/reusable-build-test-config.yml .github/workflows/reusable-build-test.yml .github/workflows/reusable-strategy-matrix.yml + .github/workflows/reusable-test.yml .codecov.yml cmake/** conan/** @@ -105,7 +108,7 @@ jobs: with: os: ${{ matrix.os }} secrets: - codecov_token: ${{ secrets.CODECOV_TOKEN }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} notify-clio: needs: diff --git a/.github/workflows/on-trigger.yml b/.github/workflows/on-trigger.yml index 7b5bda021f..b06d475a4d 100644 --- a/.github/workflows/on-trigger.yml +++ b/.github/workflows/on-trigger.yml @@ -23,8 +23,11 @@ on: - ".github/actions/build-test/**" - ".github/actions/setup-conan/**" - ".github/scripts/strategy-matrix/**" + - ".github/workflows/reusable-build.yml" + - ".github/workflows/reusable-build-test-config.yml" - ".github/workflows/reusable-build-test.yml" - ".github/workflows/reusable-strategy-matrix.yml" + - ".github/workflows/reusable-test.yml" - ".codecov.yml" - "cmake/**" - "conan/**" @@ -43,22 +46,8 @@ on: schedule: - cron: "32 6 * * 1-5" - # Run when manually triggered via the GitHub UI or API. If `force_upload` is - # true, then the dependencies that were missing (`force_rebuild` is false) or - # rebuilt (`force_rebuild` is true) will be uploaded, overwriting existing - # dependencies if needed. + # Run when manually triggered via the GitHub UI or API. workflow_dispatch: - inputs: - dependencies_force_build: - description: "Force building of all dependencies." - required: false - type: boolean - default: false - dependencies_force_upload: - description: "Force uploading of all dependencies." - required: false - type: boolean - default: false concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -82,4 +71,4 @@ jobs: os: ${{ matrix.os }} strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }} secrets: - codecov_token: ${{ secrets.CODECOV_TOKEN }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml new file mode 100644 index 0000000000..3160cef031 --- /dev/null +++ b/.github/workflows/reusable-build-test-config.yml @@ -0,0 +1,69 @@ +name: Build and test configuration + +on: + workflow_call: + inputs: + build_dir: + description: "The directory where to build." + required: true + type: string + build_only: + description: 'Whether to only build or to build and test the code ("true", "false").' + required: true + type: boolean + build_type: + description: 'The build type to use ("Debug", "Release").' + type: string + required: true + cmake_args: + description: "Additional arguments to pass to CMake." + required: false + type: string + default: "" + cmake_target: + description: "The CMake target to build." + type: string + required: true + + runs_on: + description: Runner to run the job on as a JSON string + required: true + type: string + image: + description: "The image to run in (leave empty to run natively)" + required: true + type: string + + config_name: + description: "The configuration string (used for naming artifacts and such)." + required: true + type: string + + secrets: + CODECOV_TOKEN: + description: "The Codecov token to use for uploading coverage reports." + required: true + +jobs: + build: + uses: ./.github/workflows/reusable-build.yml + with: + build_dir: ${{ inputs.build_dir }} + build_type: ${{ inputs.build_type }} + cmake_args: ${{ inputs.cmake_args }} + cmake_target: ${{ inputs.cmake_target }} + runs_on: ${{ inputs.runs_on }} + image: ${{ inputs.image }} + config_name: ${{ inputs.config_name }} + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + test: + needs: build + uses: ./.github/workflows/reusable-test.yml + with: + run_tests: ${{ !inputs.build_only }} + verify_voidstar: ${{ contains(inputs.cmake_args, '-Dvoidstar=ON') }} + runs_on: ${{ inputs.runs_on }} + image: ${{ inputs.image }} + config_name: ${{ inputs.config_name }} diff --git a/.github/workflows/reusable-build-test.yml b/.github/workflows/reusable-build-test.yml index 2197e88a42..c274cf2b21 100644 --- a/.github/workflows/reusable-build-test.yml +++ b/.github/workflows/reusable-build-test.yml @@ -13,16 +13,6 @@ on: required: false type: string default: ".build" - dependencies_force_build: - description: "Force building of all dependencies." - required: false - type: boolean - default: false - dependencies_force_upload: - description: "Force uploading of all dependencies." - required: false - type: boolean - default: false os: description: 'The operating system to use for the build ("linux", "macos", "windows").' required: true @@ -34,17 +24,9 @@ on: type: string default: "minimal" secrets: - codecov_token: + CODECOV_TOKEN: description: "The Codecov token to use for uploading coverage reports." - required: false - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.os }} - cancel-in-progress: true - -defaults: - run: - shell: bash + required: true jobs: # Generate the strategy matrix to be used by the following job. @@ -54,94 +36,23 @@ jobs: os: ${{ inputs.os }} strategy_matrix: ${{ inputs.strategy_matrix }} - # Build and test the binary. - build-test: + # Build and test the binary for each configuration. + build-test-config: needs: - generate-matrix + uses: ./.github/workflows/reusable-build-test-config.yml strategy: fail-fast: false matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} max-parallel: 10 - runs-on: ${{ matrix.architecture.runner }} - container: ${{ inputs.os == 'linux' && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-5dd7158', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version) || null }} - steps: - - name: Check strategy matrix - run: | - echo 'Operating system distro name: ${{ matrix.os.distro_name }}' - echo 'Operating system distro version: ${{ matrix.os.distro_version }}' - echo 'Operating system compiler name: ${{ matrix.os.compiler_name }}' - echo 'Operating system compiler version: ${{ matrix.os.compiler_version }}' - echo 'Architecture platform: ${{ matrix.architecture.platform }}' - echo 'Architecture runner: ${{ toJson(matrix.architecture.runner) }}' - echo 'Build type: ${{ matrix.build_type }}' - echo 'Build only: ${{ matrix.build_only }}' - echo 'CMake arguments: ${{ matrix.cmake_args }}' - echo 'CMake target: ${{ matrix.cmake_target }}' - echo 'Config name: ${{ matrix.config_name }}' - - - name: Cleanup workspace - if: ${{ runner.os == 'macOS' }} - uses: XRPLF/actions/.github/actions/cleanup-workspace@3f044c7478548e3c32ff68980eeb36ece02b364e - - - name: Checkout repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - - name: Prepare runner - uses: XRPLF/actions/.github/actions/prepare-runner@638e0dc11ea230f91bd26622fb542116bb5254d5 - with: - disable_ccache: false - - - name: Check configuration (Windows) - if: ${{ inputs.os == 'windows' }} - run: | - echo 'Checking environment variables.' - set - - echo 'Checking CMake version.' - cmake --version - - echo 'Checking Conan version.' - conan --version - - name: Check configuration (Linux and MacOS) - if: ${{ inputs.os == 'linux' || inputs.os == 'macos' }} - run: | - echo 'Checking path.' - echo ${PATH} | tr ':' '\n' - - echo 'Checking environment variables.' - env | sort - - echo 'Checking CMake version.' - cmake --version - - echo 'Checking compiler version.' - ${{ inputs.os == 'linux' && '${CC}' || 'clang' }} --version - - echo 'Checking Conan version.' - conan --version - - echo 'Checking Ninja version.' - ninja --version - - echo 'Checking nproc version.' - nproc --version - - - name: Setup Conan - uses: ./.github/actions/setup-conan - - - name: Build dependencies - uses: ./.github/actions/build-deps - with: - build_dir: ${{ inputs.build_dir }} - build_type: ${{ matrix.build_type }} - force_build: ${{ inputs.dependencies_force_build }} - - - name: Build and test binary - uses: ./.github/actions/build-test - with: - build_dir: ${{ inputs.build_dir }} - build_only: ${{ matrix.build_only }} - build_type: ${{ matrix.build_type }} - cmake_args: ${{ matrix.cmake_args }} - cmake_target: ${{ matrix.cmake_target }} - codecov_token: ${{ secrets.codecov_token }} - os: ${{ inputs.os }} + with: + build_dir: ${{ inputs.build_dir }} + build_only: ${{ matrix.build_only }} + build_type: ${{ matrix.build_type }} + cmake_args: ${{ matrix.cmake_args }} + cmake_target: ${{ matrix.cmake_target }} + runs_on: ${{ toJSON(matrix.architecture.runner) }} + image: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-5dd7158', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version) || '' }} + config_name: ${{ matrix.config_name }} + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml new file mode 100644 index 0000000000..9c994598c2 --- /dev/null +++ b/.github/workflows/reusable-build.yml @@ -0,0 +1,121 @@ +name: Build rippled + +on: + workflow_call: + inputs: + build_dir: + description: "The directory where to build." + required: true + type: string + build_type: + description: 'The build type to use ("Debug", "Release").' + required: true + type: string + cmake_args: + description: "Additional arguments to pass to CMake." + required: true + type: string + cmake_target: + description: "The CMake target to build." + required: true + type: string + + runs_on: + description: Runner to run the job on as a JSON string + required: true + type: string + image: + description: "The image to run in (leave empty to run natively)" + required: true + type: string + + config_name: + description: "The name of the configuration." + required: true + type: string + + secrets: + CODECOV_TOKEN: + description: "The Codecov token to use for uploading coverage reports." + required: true + +defaults: + run: + shell: bash + +jobs: + build: + name: Build ${{ inputs.config_name }} + runs-on: ${{ fromJSON(inputs.runs_on) }} + container: ${{ inputs.image != '' && inputs.image || null }} + steps: + - name: Cleanup workspace + if: ${{ runner.os == 'macOS' }} + uses: XRPLF/actions/.github/actions/cleanup-workspace@3f044c7478548e3c32ff68980eeb36ece02b364e + + - name: Checkout repository + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + + - name: Prepare runner + uses: XRPLF/actions/.github/actions/prepare-runner@638e0dc11ea230f91bd26622fb542116bb5254d5 + with: + disable_ccache: false + + - name: Print build environment + uses: ./.github/actions/print-env + + - name: Setup Conan + uses: ./.github/actions/setup-conan + + - name: Build dependencies + uses: ./.github/actions/build-deps + with: + build_dir: ${{ inputs.build_dir }} + build_type: ${{ inputs.build_type }} + + - name: Configure CMake + shell: bash + working-directory: ${{ inputs.build_dir }} + env: + BUILD_TYPE: ${{ inputs.build_type }} + CMAKE_ARGS: ${{ inputs.cmake_args }} + run: | + cmake \ + -G '${{ runner.os == 'Windows' && 'Visual Studio 17 2022' || 'Ninja' }}' \ + -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \ + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ + ${{ env.CMAKE_ARGS }} \ + .. + + - name: Build the binary + shell: bash + working-directory: ${{ inputs.build_dir }} + env: + BUILD_TYPE: ${{ inputs.build_type }} + CMAKE_TARGET: ${{ inputs.cmake_target }} + run: | + cmake \ + --build . \ + --config ${{ env.BUILD_TYPE }} \ + --parallel $(nproc) \ + --target ${{ env.CMAKE_TARGET }} + + - name: Upload rippled artifact + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: rippled-${{ inputs.config_name }} + path: ${{ inputs.build_dir }}/${{ runner.os == 'Windows' && inputs.build_type || '' }}/rippled${{ runner.os == 'Windows' && '.exe' || '' }} + retention-days: 3 + if-no-files-found: error + + - name: Upload coverage report + if: ${{ inputs.cmake_target == 'coverage' }} + uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 + with: + disable_search: true + disable_telem: true + fail_ci_if_error: true + files: ${{ inputs.build_dir }}/coverage.xml + plugins: noop + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true diff --git a/.github/workflows/reusable-notify-clio.yml b/.github/workflows/reusable-notify-clio.yml index 2d6fa63796..99009d953e 100644 --- a/.github/workflows/reusable-notify-clio.yml +++ b/.github/workflows/reusable-notify-clio.yml @@ -46,41 +46,44 @@ jobs: uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Generate outputs id: generate + env: + PR_NUMBER: ${{ github.event.pull_request.number }} run: | echo 'Generating user and channel.' echo "user=clio" >> "${GITHUB_OUTPUT}" - echo "channel=pr_${{ github.event.pull_request.number }}" >> "${GITHUB_OUTPUT}" + echo "channel=pr_${{ env.PR_NUMBER }}" >> "${GITHUB_OUTPUT}" echo 'Extracting version.' echo "version=$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" >> "${GITHUB_OUTPUT}" - name: Calculate conan reference id: conan_ref run: | echo "conan_ref=${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}" >> "${GITHUB_OUTPUT}" - - name: Set up Conan uses: ./.github/actions/setup-conan with: conan_remote_name: ${{ inputs.conan_remote_name }} conan_remote_url: ${{ inputs.conan_remote_url }} - - name: Log into Conan remote run: conan remote login ${{ inputs.conan_remote_name }} "${{ secrets.conan_remote_username }}" --password "${{ secrets.conan_remote_password }}" - name: Upload package + env: + CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }} run: | conan export --user=${{ steps.generate.outputs.user }} --channel=${{ steps.generate.outputs.channel }} . - conan upload --confirm --check --remote=${{ inputs.conan_remote_name }} xrpl/${{ steps.conan_ref.outputs.conan_ref }} + conan upload --confirm --check --remote=${{ env.CONAN_REMOTE_NAME }} xrpl/${{ steps.conan_ref.outputs.conan_ref }} outputs: conan_ref: ${{ steps.conan_ref.outputs.conan_ref }} notify: needs: upload runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ secrets.clio_notify_token }} steps: - name: Notify Clio + env: + GH_TOKEN: ${{ secrets.clio_notify_token }} + PR_URL: ${{ github.event.pull_request.html_url }} run: | gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \ -F "client_payload[conan_ref]=${{ needs.upload.outputs.conan_ref }}" \ - -F "client_payload[pr_url]=${{ github.event.pull_request.html_url }}" + -F "client_payload[pr_url]=${{ env.PR_URL }}" diff --git a/.github/workflows/reusable-strategy-matrix.yml b/.github/workflows/reusable-strategy-matrix.yml index 20a90fc2e3..e8621527c9 100644 --- a/.github/workflows/reusable-strategy-matrix.yml +++ b/.github/workflows/reusable-strategy-matrix.yml @@ -35,4 +35,7 @@ jobs: - name: Generate strategy matrix working-directory: .github/scripts/strategy-matrix id: generate - run: ./generate.py ${{ inputs.strategy_matrix == 'all' && '--all' || '' }} ${{ inputs.os != '' && format('--config={0}.json', inputs.os) || '' }} >> "${GITHUB_OUTPUT}" + env: + GENERATE_CONFIG: ${{ inputs.os != '' && format('--config={0}.json', inputs.os) || '' }} + GENERATE_OPTION: ${{ inputs.strategy_matrix == 'all' && '--all' || '' }} + run: ./generate.py ${{ env.GENERATE_OPTION }} ${{ env.GENERATE_CONFIG }} >> "${GITHUB_OUTPUT}" diff --git a/.github/workflows/reusable-test.yml b/.github/workflows/reusable-test.yml new file mode 100644 index 0000000000..1877a19a72 --- /dev/null +++ b/.github/workflows/reusable-test.yml @@ -0,0 +1,69 @@ +name: Test rippled + +on: + workflow_call: + inputs: + verify_voidstar: + description: "Whether to verify the presence of voidstar instrumentation." + required: true + type: boolean + run_tests: + description: "Whether to run unit tests" + required: true + type: boolean + + runs_on: + description: Runner to run the job on as a JSON string + required: true + type: string + image: + description: "The image to run in (leave empty to run natively)" + required: true + type: string + + config_name: + description: "The name of the configuration." + required: true + type: string + +jobs: + test: + name: Test ${{ inputs.config_name }} + runs-on: ${{ fromJSON(inputs.runs_on) }} + container: ${{ inputs.image != '' && inputs.image || null }} + steps: + - name: Download rippled artifact + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: rippled-${{ inputs.config_name }} + + - name: Make binary executable (Linux and macOS) + shell: bash + if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} + run: | + chmod +x ./rippled + + - name: Check linking (Linux) + if: ${{ runner.os == 'Linux' }} + shell: bash + run: | + ldd ./rippled + if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then + echo 'The binary is statically linked.' + else + echo 'The binary is dynamically linked.' + exit 1 + fi + + - name: Verifying presence of instrumentation + if: ${{ inputs.verify_voidstar }} + shell: bash + run: | + ./rippled --version | grep libvoidstar + + - name: Test the binary + if: ${{ inputs.run_tests }} + shell: bash + run: | + ./rippled --unittest --unittest-jobs $(nproc) + ctest -j $(nproc) --output-on-failure diff --git a/.github/workflows/upload-conan-deps.yml b/.github/workflows/upload-conan-deps.yml index 98db52a436..cbae8a4c86 100644 --- a/.github/workflows/upload-conan-deps.yml +++ b/.github/workflows/upload-conan-deps.yml @@ -24,13 +24,10 @@ on: branches: [develop] paths: - .github/workflows/upload-conan-deps.yml - - .github/workflows/reusable-strategy-matrix.yml - - .github/actions/build-deps/action.yml - .github/actions/setup-conan/action.yml - ".github/scripts/strategy-matrix/**" - - conanfile.py - conan.lock @@ -88,4 +85,6 @@ jobs: - name: Upload Conan packages if: ${{ github.repository_owner == 'XRPLF' && github.event_name != 'pull_request' && github.event_name != 'schedule' }} - run: conan upload "*" -r=${{ env.CONAN_REMOTE_NAME }} --confirm ${{ github.event.inputs.force_upload == 'true' && '--force' || '' }} + env: + FORCE_OPTION: ${{ github.event.inputs.force_upload == 'true' && '--force' || '' }} + run: conan upload "*" --remote='${{ env.CONAN_REMOTE_NAME }}' --confirm ${{ env.FORCE_OPTION }} diff --git a/include/xrpl/protocol/LedgerFormats.h b/include/xrpl/protocol/LedgerFormats.h index 40c9fce1bb..ff4653e5c7 100644 --- a/include/xrpl/protocol/LedgerFormats.h +++ b/include/xrpl/protocol/LedgerFormats.h @@ -188,14 +188,14 @@ enum LedgerSpecificFlags { lsfMPTCanTransfer = 0x00000020, lsfMPTCanClawback = 0x00000040, - lmfMPTCanMutateCanLock = 0x00000002, - lmfMPTCanMutateRequireAuth = 0x00000004, - lmfMPTCanMutateCanEscrow = 0x00000008, - lmfMPTCanMutateCanTrade = 0x00000010, - lmfMPTCanMutateCanTransfer = 0x00000020, - lmfMPTCanMutateCanClawback = 0x00000040, - lmfMPTCanMutateMetadata = 0x00010000, - lmfMPTCanMutateTransferFee = 0x00020000, + lsmfMPTCanMutateCanLock = 0x00000002, + lsmfMPTCanMutateRequireAuth = 0x00000004, + lsmfMPTCanMutateCanEscrow = 0x00000008, + lsmfMPTCanMutateCanTrade = 0x00000010, + lsmfMPTCanMutateCanTransfer = 0x00000020, + lsmfMPTCanMutateCanClawback = 0x00000040, + lsmfMPTCanMutateMetadata = 0x00010000, + lsmfMPTCanMutateTransferFee = 0x00020000, // ltMPTOKEN lsfMPTAuthorized = 0x00000002, diff --git a/include/xrpl/protocol/TxFlags.h b/include/xrpl/protocol/TxFlags.h index 30d991e680..dcbc10b927 100644 --- a/include/xrpl/protocol/TxFlags.h +++ b/include/xrpl/protocol/TxFlags.h @@ -156,14 +156,14 @@ constexpr std::uint32_t const tfMPTokenIssuanceCreateMask = // MPTokenIssuanceCreate MutableFlags: // Indicating specific fields or flags may be changed after issuance. -constexpr std::uint32_t const tmfMPTCanMutateCanLock = lmfMPTCanMutateCanLock; -constexpr std::uint32_t const tmfMPTCanMutateRequireAuth = lmfMPTCanMutateRequireAuth; -constexpr std::uint32_t const tmfMPTCanMutateCanEscrow = lmfMPTCanMutateCanEscrow; -constexpr std::uint32_t const tmfMPTCanMutateCanTrade = lmfMPTCanMutateCanTrade; -constexpr std::uint32_t const tmfMPTCanMutateCanTransfer = lmfMPTCanMutateCanTransfer; -constexpr std::uint32_t const tmfMPTCanMutateCanClawback = lmfMPTCanMutateCanClawback; -constexpr std::uint32_t const tmfMPTCanMutateMetadata = lmfMPTCanMutateMetadata; -constexpr std::uint32_t const tmfMPTCanMutateTransferFee = lmfMPTCanMutateTransferFee; +constexpr std::uint32_t const tmfMPTCanMutateCanLock = lsmfMPTCanMutateCanLock; +constexpr std::uint32_t const tmfMPTCanMutateRequireAuth = lsmfMPTCanMutateRequireAuth; +constexpr std::uint32_t const tmfMPTCanMutateCanEscrow = lsmfMPTCanMutateCanEscrow; +constexpr std::uint32_t const tmfMPTCanMutateCanTrade = lsmfMPTCanMutateCanTrade; +constexpr std::uint32_t const tmfMPTCanMutateCanTransfer = lsmfMPTCanMutateCanTransfer; +constexpr std::uint32_t const tmfMPTCanMutateCanClawback = lsmfMPTCanMutateCanClawback; +constexpr std::uint32_t const tmfMPTCanMutateMetadata = lsmfMPTCanMutateMetadata; +constexpr std::uint32_t const tmfMPTCanMutateTransferFee = lsmfMPTCanMutateTransferFee; constexpr std::uint32_t const tmfMPTokenIssuanceCreateMutableMask = ~(tmfMPTCanMutateCanLock | tmfMPTCanMutateRequireAuth | tmfMPTCanMutateCanEscrow | tmfMPTCanMutateCanTrade | tmfMPTCanMutateCanTransfer | tmfMPTCanMutateCanClawback | tmfMPTCanMutateMetadata | tmfMPTCanMutateTransferFee); diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp index c406a8ec5f..6fb87711c8 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp @@ -51,14 +51,18 @@ struct MPTMutabilityFlags }; static constexpr std::array mptMutabilityFlags = { - {{tmfMPTSetCanLock, tmfMPTClearCanLock, lmfMPTCanMutateCanLock}, - {tmfMPTSetRequireAuth, tmfMPTClearRequireAuth, lmfMPTCanMutateRequireAuth}, - {tmfMPTSetCanEscrow, tmfMPTClearCanEscrow, lmfMPTCanMutateCanEscrow}, - {tmfMPTSetCanTrade, tmfMPTClearCanTrade, lmfMPTCanMutateCanTrade}, - {tmfMPTSetCanTransfer, tmfMPTClearCanTransfer, lmfMPTCanMutateCanTransfer}, + {{tmfMPTSetCanLock, tmfMPTClearCanLock, lsmfMPTCanMutateCanLock}, + {tmfMPTSetRequireAuth, + tmfMPTClearRequireAuth, + lsmfMPTCanMutateRequireAuth}, + {tmfMPTSetCanEscrow, tmfMPTClearCanEscrow, lsmfMPTCanMutateCanEscrow}, + {tmfMPTSetCanTrade, tmfMPTClearCanTrade, lsmfMPTCanMutateCanTrade}, + {tmfMPTSetCanTransfer, + tmfMPTClearCanTransfer, + lsmfMPTCanMutateCanTransfer}, {tmfMPTSetCanClawback, tmfMPTClearCanClawback, - lmfMPTCanMutateCanClawback}}}; + lsmfMPTCanMutateCanClawback}}}; NotTEC MPTokenIssuanceSet::preflight(PreflightContext const& ctx) @@ -243,7 +247,7 @@ MPTokenIssuanceSet::preclaim(PreclaimContext const& ctx) return tecNO_PERMISSION; } - if (!isMutableFlag(lmfMPTCanMutateMetadata) && + if (!isMutableFlag(lsmfMPTCanMutateMetadata) && ctx.tx.isFieldPresent(sfMPTokenMetadata)) return tecNO_PERMISSION; @@ -256,7 +260,7 @@ MPTokenIssuanceSet::preclaim(PreclaimContext const& ctx) if (fee > 0u && !sleMptIssuance->isFlag(lsfMPTCanTransfer)) return tecNO_PERMISSION; - if (!isMutableFlag(lmfMPTCanMutateTransferFee)) + if (!isMutableFlag(lsmfMPTCanMutateTransferFee)) return tecNO_PERMISSION; }