diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 41e2af9ae..0af8d98fd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,6 +12,6 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: giancosta86/aurora-github/actions/tag-and-release@v2 diff --git a/actions/publish-rust-wasm/action.yml b/actions/publish-rust-wasm/action.yml index b7b3f7aa9..67fa06827 100644 --- a/actions/publish-rust-wasm/action.yml +++ b/actions/publish-rust-wasm/action.yml @@ -24,7 +24,7 @@ runs: using: composite steps: - name: Set up NodeJS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: ${{ inputs.project-directory }}/client_tests/.nvmrc registry-url: https://registry.npmjs.org diff --git a/actions/validate-rust-wasm/README.md b/actions/validate-rust-wasm/README.md index 7919eea2f..2b6952678 100644 --- a/actions/validate-rust-wasm/README.md +++ b/actions/validate-rust-wasm/README.md @@ -10,38 +10,42 @@ The action can be placed right after checking out the source code: steps: - uses: actions/checkout@v4 - - uses: giancosta86/aurora-github/actions/validate-rust-crate + - uses: giancosta86/aurora-github/actions/validate-rust-wasm ``` ## How it works -1. Optionally run [check-artifact-version](../check-artifact-version/README.md). +1. Invoke the [install-wasm-pack](../install-wasm-pack/README.md) action, passing all the matching inputs, to install the `wasm-pack` command -1. Display the version info for the main components of the Rust toolchain - ensuring the existence of `rust-toolchain.toml`. +1. Invoke the [validate-rust-crate](../validate-rust-crate/README.md) action, passing all the matching inputs, to perform code analysis over the Rust source code -1. Check the style of the Rust source files - via `cargo fmt`. +1. Run `wasm-pack test` to run headless browser tests -1. Lint via `cargo clippy`, enabling all features and targets. All warnings are considered errors. +1. If the `client-tests-directory` input parameter is not set to an empty string: -1. Run `cargo test` with no features. + 1. Ensure the directory really exists -1. Run `cargo test` enabling all features. + 1. Run `pnpm install` to install its dependencies + + 1. Run `pnpm test` to run the NodeJS-based client tests ## Requirements - `rust-toolchain.toml` must be present in `project-directory` - as described in [print-rust-info](../print-rust-info/README.md) -- if the `client-tests-directory` input parameter is not set to an empty string, it must contain: +- if `client-tests-directory` is not set to an empty string, it must be the **relative path** of a directory containing: - - a `.nvmrc` file, containing the requested Node.js version + - a `.nvmrc` file, with the requested Node.js version - - a `package.json` descriptor containing: + - a `package.json` descriptor having: - a `test` script, in the `scripts` section + - as usual, all the dependencies required by the test + - an updated `pnpm-lock.yaml` lockfile - It is worth mentioning that no quality checks - such as code formatting and linting - are performed on this test project + It is worth mentioning that no quality checks - such as code formatting and linting - are performed on this test project. ## Inputs @@ -54,7 +58,9 @@ steps: ## Further references -- [check-artifact-version](../check-artifact-version/README.md) +- [install-wasm-pack](../install-wasm-pack/README.md) + +- [validate-rust-crate](../validate-rust-crate/README.md) - [print-rust-info](../print-rust-info/README.md) diff --git a/actions/validate-rust-wasm/action.yml b/actions/validate-rust-wasm/action.yml index 9734b0d84..a47359f6e 100644 --- a/actions/validate-rust-wasm/action.yml +++ b/actions/validate-rust-wasm/action.yml @@ -4,7 +4,7 @@ description: Validates the source files of a Rust web assembly. inputs: client-tests-directory: description: Relative directory containing the NodeJS-based client tests. - required: true + required: false default: client-tests check-artifact-version: @@ -23,7 +23,7 @@ inputs: default: bash runs: - using: "composite" + using: composite steps: - name: Install wasm-pack uses: giancosta86/aurora-github/install-wasm-pack @@ -48,25 +48,24 @@ runs: working-directory: ${{ inputs.project-directory }} run: | client_tests_directory="${{ inputs.client-tests-directory }}" - " + if [[ ! -d "$client_tests_directory" ]] then - echo "The test directory '$client_tests_directory' does not exist" + echo "The client test directory '$client_tests_directory' does not exist" exit 1 fi - name: Set up NodeJS if: ${{ inputs.client-tests-directory != '' }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: ${{ inputs.project-directory }}/${{ inputs.client-tests-directory }}/.nvmrc - registry-url: https://registry.npmjs.org - name: Install client-side test dependencies if: ${{ inputs.client-tests-directory != '' }} shell: ${{ inputs.shell }} working-directory: ${{ inputs.project-directory }}/${{ inputs.client-tests-directory }} - run: pnpm install --no-frozen-lockfile + run: pnpm install --frozen-lockfile - name: Perform client-side tests if: ${{ inputs.client-tests-directory != '' }}