fix: add all ecmascript PMD best practices rules #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Copyright (C) 2023 Hedera Hashgraph, LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
## | |
name: "ZXC: Compile Code" | |
# The purpose of this reusable workflow is to compile the code and run the unit tests on every PR and commit. | |
# This reusable component is called by the following workflows: | |
# - .github/workflows/flow-pull-request-checks.yaml | |
# - .github/workflows/flow-build-application.yaml | |
on: | |
workflow_call: | |
inputs: | |
enable-unit-tests: | |
description: "Unit Testing Enabled" | |
type: boolean | |
required: false | |
default: false | |
enable-nodejs-tests: | |
description: "NodeJS Testing Enabled" | |
type: boolean | |
required: false | |
default: false | |
enable-spotless-check: | |
description: "Spotless Check Enabled" | |
type: boolean | |
required: false | |
default: false | |
java-distribution: | |
description: "Java JDK Distribution:" | |
type: string | |
required: false | |
default: "temurin" | |
java-version: | |
description: "Java JDK Version:" | |
type: string | |
required: false | |
default: "17.0.7" | |
gradle-version: | |
description: "Gradle Version:" | |
type: string | |
required: false | |
default: "wrapper" | |
node-version: | |
description: "NodeJS Version:" | |
type: string | |
required: false | |
default: "16" | |
custom-job-label: | |
description: "Custom Job Label:" | |
type: string | |
required: false | |
default: "Compiles" | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
id-token: write | |
contents: read | |
actions: read | |
pull-requests: write | |
checks: write | |
statuses: write | |
jobs: | |
compile: | |
name: ${{ inputs.custom-job-label || 'Compiles' }} | |
runs-on: [self-hosted, Linux, medium, ephemeral] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
# the fetch depth defaults to only the commit that triggered the workflow unless the spotless check was enabled | |
fetch-depth: ${{ inputs.enable-spotless-check && '0' || '' }} | |
- name: Setup Java | |
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 | |
with: | |
distribution: ${{ inputs.java-distribution }} | |
java-version: ${{ inputs.java-version }} | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
- name: Setup Node | |
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 | |
with: | |
node-version: ${{ inputs.node-version }} | |
- name: Setup Kind | |
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0 | |
if: ${{ (inputs.enable-unit-tests || inputs.enable-nodejs-tests) && !cancelled() && !failure() }} | |
with: | |
config: dev/dev-cluster.yaml | |
version: v0.19.0 | |
verbosity: 3 | |
wait: 120s | |
- name: Setup Helm | |
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 | |
if: ${{ (inputs.enable-unit-tests || inputs.enable-nodejs-tests) && !cancelled() && !failure() }} | |
with: | |
version: "v3.12.3" # helm version | |
run: | | |
helm repo add haproxytech https://haproxytech.github.io/helm-charts | |
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx | |
helm repo update | |
# Technically, this step is not required for the unit tests to run, but it is useful for debugging setup issues. | |
- name: Kubernetes Cluster Info | |
if: ${{ (inputs.enable-unit-tests || inputs.enable-nodejs-tests) && !cancelled() && !failure() }} | |
run: | | |
kubectl config get-contexts | |
kubectl get crd | |
kubectl get node --show-labels | |
# This step is currently required because the Hedera Services artifacts are not publicly accessible. | |
# May be removed once the artifacts are publicly accessible. | |
- name: Authenticate to Google Cloud | |
id: google-auth | |
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 # v1.1.1 | |
if: ${{ (inputs.enable-unit-tests || inputs.enable-nodejs-tests) && !cancelled() && !failure() }} | |
with: | |
token_format: 'access_token' | |
workload_identity_provider: "projects/101730247931/locations/global/workloadIdentityPools/hedera-registry-pool/providers/hedera-registry-gh-actions" | |
service_account: "[email protected]" | |
# This step is currently required because the Hedera Services artifacts are not publicly accessible. | |
# May be removed once the artifacts are publicly accessible. | |
- name: Setup Google Cloud SDK | |
if: ${{ inputs.enable-unit-tests && !cancelled() }} | |
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b # v1.1.1 | |
- name: NodeJS CLI Tests | |
id: nodejs-test | |
working-directory: fullstack-network-manager | |
if: ${{ inputs.enable-nodejs-tests && !cancelled() && !failure() }} | |
run: | | |
npm i | |
npm test | |
# npm run test-e2e # tracked by #https://github.com/hashgraph/full-stack-testing/issues/501 | |
# This step tests the Helm chart direct mode of operation which uses the ubi8-init-java17 image. | |
- name: Helm Chart Test (Direct Install) | |
working-directory: dev | |
if: ${{ inputs.enable-unit-tests && !cancelled() && !failure() }} | |
run: make ci-test SCRIPT_NAME=direct-install.sh | |
# This step tests the Helm chart NMT mode of operation which uses the ubi8-init-dind image. | |
- name: Helm Chart Test (NMT Install) | |
working-directory: dev | |
if: ${{ inputs.enable-unit-tests && !cancelled() && !failure() }} | |
run: make ci-test SCRIPT_NAME=nmt-install.sh | |
- name: Compile | |
id: gradle-build | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-unit-tests && !cancelled() && !failure() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: assemble --scan | |
- name: Examples Compile | |
id: gradle-build-examples | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-unit-tests && !cancelled() && !failure() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: assemble --scan | |
build-root-directory: fullstack-examples | |
- name: Gradle Plugin Compile | |
id: gradle-build-gradle-plugin | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-unit-tests && !cancelled() && !failure() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: assemble --scan | |
build-root-directory: fullstack-gradle-plugin | |
- name: Spotless Check | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-spotless-check && steps.gradle-build.conclusion == 'success' && !cancelled() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: spotlessCheck --scan | |
- name: Examples Spotless Check | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-spotless-check && steps.gradle-build-examples.conclusion == 'success' && !cancelled() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: spotlessCheck --scan | |
build-root-directory: fullstack-examples | |
- name: Gradle Plugin Spotless Check | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-spotless-check && steps.gradle-build-gradle-plugin.conclusion == 'success' && !cancelled() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: spotlessCheck --scan | |
build-root-directory: fullstack-gradle-plugin | |
- name: Unit Tests | |
id: gradle-test | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && !cancelled() && !failure() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: check --scan | |
- name: Examples Unit Tests | |
id: gradle-test-examples | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-unit-tests && steps.gradle-build-examples.conclusion == 'success' && !cancelled() && !failure() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: check --scan | |
build-root-directory: fullstack-examples | |
- name: Gradle Plugin Unit Tests | |
id: gradle-test-gradle-plugin | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-unit-tests && steps.gradle-build-gradle-plugin.conclusion == 'success' && !cancelled() && !failure() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: check --scan | |
build-root-directory: fullstack-gradle-plugin | |
- name: Publish Unit Test Report | |
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0 | |
if: ${{ inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && steps.gradle-build-examples.conclusion == 'success' && steps.gradle-build-gradle-plugin.conclusion == 'success' && !cancelled() && !failure() }} | |
with: | |
check_name: 'Unit Test Results' | |
check_run_disabled: false | |
json_thousands_separator: ',' | |
junit_files: "**/build/test-results/test/TEST-*.xml" | |
# Technically, this step is not required since the Gradle check task implicitly includes it but is executed again | |
# here to prevent failures if future modules are not wired properly. | |
- name: Jacoco Coverage Report | |
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0 | |
if: ${{ inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && steps.gradle-build-examples.conclusion == 'success' && steps.gradle-build-gradle-plugin.conclusion == 'success' && !cancelled() }} | |
with: | |
gradle-version: ${{ inputs.gradle-version }} | |
arguments: jacocoTestReport --scan | |
- name: Publish Jacoco Coverage Report | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
if: ${{ inputs.enable-unit-tests && !cancelled() }} | |
with: | |
name: Coverage Reports | |
path: '**/jacocoTestReport.xml' | |
- name: Publish Test Reports | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
if: ${{ inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && steps.gradle-build-examples.conclusion == 'success' && steps.gradle-build-gradle-plugin.conclusion == 'success' && !cancelled() }} | |
with: | |
name: Test Reports | |
path: "**/build/reports/tests/**" |