Skip to content

Add GitHub Actions workflow for JSHooks testing source#449

Closed
tequdev wants to merge 4 commits intoXahau:jshooksfrom
tequdev:jshooks-testfile-workflow
Closed

Add GitHub Actions workflow for JSHooks testing source#449
tequdev wants to merge 4 commits intoXahau:jshooksfrom
tequdev:jshooks-testfile-workflow

Conversation

@tequdev
Copy link
Member

@tequdev tequdev commented Feb 25, 2025

High Level Overview of Change

  • Create a new GitHub Actions workflow for testing JSHooks sources
  • Update script(SetJSHook_wasm.h) to run can be any path
    • need to place qjsc in src/test/app.

Context of Change

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

- Create a new GitHub Actions workflow for testing JSHooks sources
- Update script to generate SetJSHook_wasm.h
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential clang-format bc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should pin a specific version of clang-format in some environment variable that be easily changed.

I noticed the other day that clang-format@19 would not work for some files.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that clang-format-10 is not provided in ubuntu-latest (ubuntu 22.04).

We can install clang-format-10 in ubuntu 20.04, but errors will occur around qjsc.

At the moment, there is no effect on SetJSHook_wasm.h, so I will leave it as it is.
If you could fix it, I would be very grateful.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started working on extracting an action in #450

I'll make a PR to this once that's sorted we can just use that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dangell7 wasn't a fan of touching the rippled shared clang-format workflow, in anticipation of merges, but I guess given this PR and #440 both install clang-format, we could use this action:

name: Install Clang-Format Ubuntu
description: Installs a specific version of clang-format on Ubuntu 20.04 and newer
inputs:
  clang-version:
    description: "Version of Clang-Format to install"
    required: true
    default: "10"

runs:
  using: "composite"
  steps:
    - name: Install Clang-Format
      run: |
        codename=$(lsb_release --codename --short)

        # Use modern key management for Ubuntu 20.04+ compatibility
        wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /usr/share/keyrings/llvm-archive-keyring.gpg >/dev/null

        # Update LLVM repository sources
        echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${{ inputs.clang-version }} main" | sudo tee /etc/apt/sources.list.d/llvm.list
        echo "deb-src [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${{ inputs.clang-version }} main" | sudo tee -a /etc/apt/sources.list.d/llvm.list

        # Update and install Clang-Format
        sudo apt-get update
        sudo apt-get install -y clang-format-${{ inputs.clang-version }}

        # Verify installation
        clang-format-${{ inputs.clang-version }} --version
      shell: bash

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, this is using clang-format 18 which seems to be fine for the file formatted by this.

sublimator added a commit to sublimator/xahaud that referenced this pull request Feb 27, 2025
#
# - clang-format:
# Ubuntu: $sudo apt-get install clang-format
# macOS: $brew install clang-format
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brew install r-lib/taps/clang-format@10

To match the CI clang-format I had to use that. 19 wasn't working in every case.

related to:
https://github.com/Xahau/xahaud/pull/449/files#r1972938606

Copy link
Collaborator

@sublimator sublimator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the ggrep -> grep and gsed -> sed changes, this looks good to me. I think I'd rather leave the macos defaults as they are for other scripts?

@sublimator
Copy link
Collaborator

sublimator commented Feb 27, 2025 via email

@dangell7
Copy link
Collaborator

I'm not sure how valuable the workflow is. We barely touch the test file once its merged. Right now, you will know its different because of the merge conflict.

I approve the bash changes but I really dont think the CI is necessary to run every single time when it will be touched so little.

@tequdev
Copy link
Member Author

tequdev commented Mar 12, 2025

I'm not sure how valuable the workflow is. We barely touch the test file once its merged. Right now, you will know its different because of the merge conflict.

I approve the bash changes but I really dont think the CI is necessary to run every single time when it will be touched so little.

I will create a separate script-only PR.

@tequdev
Copy link
Member Author

tequdev commented Mar 12, 2025

@sublimator
Copy link
Collaborator

I really dont think the CI is necessary to run every single time when it will be touched so little

I'll say that yesterday I forgot to update the wasm in one of the PRs, and then it seems one of the tests failed because of that. Of course the beast unit test framework, for some reason just prints that there was 1 failure rather than helpfully listing WHICH test actually failed and at what file/line.

This workflow would have helped me more quickly recognize what the issue was.

I don't think it's strictly necessary either, but it's definitely a small quality of life improvement, and you can set paths in the on config to make sure it only runs when it changes.

@sublimator
Copy link
Collaborator

I must note that I've successfully brainwashed myself into referring to the qjsc as "wasm" :)

@sublimator
Copy link
Collaborator

Closing in favour of #464

@sublimator sublimator closed this Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants