Skip to content

Commit

Permalink
ci: rename variables for clarity
Browse files Browse the repository at this point in the history
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
  • Loading branch information
leninmehedy committed Jan 26, 2024
1 parent ee3c7d1 commit d8af4b8
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions .github/workflows/zxc-compile-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,17 @@ jobs:
- name: List all changed files
id: check-changed-files
run: |
echo "Modified Java code"
echo "Modified files"
echo "-------------------------------------------------------------------"
for file in ${{ steps.changed-files.outputs.source_all_changed_files }}; do
echo " - ${file} was changed"
done
echo ""
if [ "${{ steps.changed-files.outputs.source_any_changed }}" ]; then
echo "run-tests=true" >> "${GITHUB_OUTPUT}"
echo "files-changed=true" >> "${GITHUB_OUTPUT}"
echo "Enabled execution of java unit tests...."
else
echo "files-changed=false" >> "${GITHUB_OUTPUT}"
echo ">> No relevant files are changed. No need to run java unit tests"
fi
Expand Down Expand Up @@ -145,7 +146,7 @@ jobs:

- name: Docker Prune
id: docker-prune
if: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && inputs.enable-unit-tests && !cancelled() && !failure() }}
run: |
docker info
docker ps -a
Expand All @@ -154,7 +155,7 @@ jobs:
- name: Setup Kind
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
if: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && inputs.enable-unit-tests && !cancelled() && !failure() }}
with:
node_image: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
config: dev/dev-cluster.yaml
Expand All @@ -164,13 +165,13 @@ jobs:

- name: Setup Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
if: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && inputs.enable-unit-tests && !cancelled() && !failure() }}
with:
version: "v3.12.3" # helm version

# 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: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && inputs.enable-unit-tests && !cancelled() && !failure() }}
run: |
kubectl config get-contexts
kubectl get crd
Expand All @@ -181,7 +182,7 @@ jobs:
- name: Authenticate to Google Cloud
id: google-auth
uses: google-github-actions/auth@67e9c72af6e0492df856527b474995862b7b6591 # v2.0.0
if: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && inputs.enable-unit-tests && !cancelled() && !failure() }}
with:
token_format: 'access_token'
workload_identity_provider: "projects/101730247931/locations/global/workloadIdentityPools/hedera-registry-pool/providers/hedera-registry-gh-actions"
Expand All @@ -190,7 +191,7 @@ jobs:
# 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: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && !cancelled() }}
if: ${{ steps.check-changed-files.outputs.files-changed && inputs.enable-unit-tests && !cancelled() }}
uses: google-github-actions/setup-gcloud@825196879a077b7efa50db2e88409f44de4635c2 # v2.0.0

- name: Compile
Expand Down Expand Up @@ -244,7 +245,7 @@ jobs:

# This step is to cache the helm charts before we start unit tests
- name: Setup Helm Charts
if: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && inputs.enable-unit-tests && !cancelled() && !failure() }}
run: |
helm repo add haproxytech https://haproxytech.github.io/helm-charts
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
Expand All @@ -253,15 +254,15 @@ jobs:
- name: Unit Tests
id: gradle-test
uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0
if: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && 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@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0
if: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && steps.gradle-build-examples.conclusion == 'success' && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && inputs.enable-unit-tests && steps.gradle-build-examples.conclusion == 'success' && !cancelled() && !failure() }}
with:
gradle-version: ${{ inputs.gradle-version }}
arguments: check --scan
Expand All @@ -270,15 +271,15 @@ jobs:
- name: Gradle Plugin Unit Tests
id: gradle-test-gradle-plugin
uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0
if: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && steps.gradle-build-gradle-plugin.conclusion == 'success' && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && 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: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && steps.gradle-build-examples.conclusion == 'success' && steps.gradle-build-gradle-plugin.conclusion == 'success' && !cancelled() && !failure() }}
if: ${{ steps.check-changed-files.outputs.files-changed && 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
Expand All @@ -289,21 +290,21 @@ jobs:
# here to prevent failures if future modules are not wired properly.
- name: Jacoco Coverage Report
uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0
if: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && steps.gradle-build-examples.conclusion == 'success' && steps.gradle-build-gradle-plugin.conclusion == 'success' && !cancelled() }}
if: ${{ steps.check-changed-files.outputs.files-changed && 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: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && !cancelled() }}
if: ${{ steps.check-changed-files.outputs.files-changed && 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: ${{ steps.check-changed-files.outputs.run-tests && inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && steps.gradle-build-examples.conclusion == 'success' && steps.gradle-build-gradle-plugin.conclusion == 'success' && !cancelled() }}
if: ${{ steps.check-changed-files.outputs.files-changed && 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/**"

0 comments on commit d8af4b8

Please sign in to comment.