Copilot commented on code in PR #34476:
URL: https://github.com/apache/beam/pull/34476#discussion_r2029872536


##########
.github/workflows/run_rc_validation_go_wordcount.yml:
##########
@@ -0,0 +1,139 @@
+name: Validate Go SDK Release Candidate
+
+on:
+  workflow_dispatch:
+    inputs:
+      rc_tag:
+        description: 'Beam RC Tag (e.g., v2.59.0-RC1)'
+        required: true
+        type: string
+      container_tag:
+        description: 'Beam Go SDK Container Tag (e.g., 2.59.0rc1)'
+        required: true
+        type: string
+
+# This allows a subsequently queued workflow run to interrupt previous runs
+concurrency:
+  group: '${{ github.workflow }} @ ${{ github.event.inputs.rc_tag }}' # Group 
by RC tag
+  cancel-in-progress: true
+
+# Setting explicit permissions (copied from Java Mobile Gaming workflow)
+permissions:
+  actions: write
+  pull-requests: write
+  checks: write
+  contents: read
+  deployments: read
+  id-token: write # Note: Likely not needed for self-hosted runners without WIF
+  issues: write
+  discussions: read
+  packages: read
+  pages: read
+  repository-projects: read
+  security-events: read
+  statuses: read
+
+env:
+  GCS_OUTPUT_PREFIX: gs://rc-validation-migration-tests/go-wordcount # 
Constant output prefix
+  GCP_PROJECT_ID: apache-beam-testing
+  GCP_REGION: us-central1
+  GCS_TEMP_LOCATION: gs://rc-validation-migration-tests/temp/
+  GCS_INPUT_PATH: gs://apache-beam-samples/shakespeare/kinglear.txt
+
+jobs:
+  setup:
+    runs-on: self-hosted
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+
+      - name: Set up environment
+        uses: ./.github/actions/setup-environment-action
+        with:
+          go-version: default
+
+      - name: Fetch Go SDK RC and Tidy Modules
+        working-directory: ./sdks/go/examples/wordcount
+        run: |
+          go get -d github.com/apache/beam/sdks/v2@${{ 
github.event.inputs.rc_tag }}
+          go mod tidy
+
+
+  validate-go-rc-prism:
+    needs: setup
+    runs-on: self-hosted # Changed to self-hosted
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+
+      - name: Set up environment
+        uses: ./.github/actions/setup-environment-action
+        with:
+          go-version: default
+
+
+      # Assuming gcloud/gsutil is available and authenticated on the 
self-hosted runner
+      - name: Download Input File from GCS (Prism)
+        working-directory: ./sdks/go/examples/wordcount
+        run: gsutil cp ${{ env.GCS_INPUT_PATH }} ./kinglear.txt
+
+      - name: Run Go WordCount with PrismRunner
+        working-directory: ./sdks/go/examples/wordcount
+        run: |
+          go run wordcount.go \
+            --input ./kinglear.txt \
+            --output ./output_prism.txt \
+            --runner=PrismRunner \
+            --environment_type=DOCKER \
+            --environment_config=apache/beam_go_sdk:${{ 
github.event.inputs.container_tag }}
+
+      - name: Check output file
+        working-directory: ./sdks/go/examples/wordcount
+        run: |
+          echo "--- PrismRunner WordCount Output ---"
+          cat output_prism.txt* # Output might be sharded
+          echo "--- End Output ---"
+          # Basic check - verify the output file(s) exist and are not empty
+          if ls output_prism.txt* 1> /dev/null 2>&1 && [ -n "$(find . -name 
'output_prism.txt*' -print -quit)" ]; then

Review Comment:
   The check for output files uses both ls and find commands, which is 
redundant. Consider simplifying the condition by relying on a single method, 
such as find, for clarity and maintainability.
   ```suggestion
             if [ -n "$(find . -name 'output_prism.txt*' -size +0 -print 
-quit)" ]; then
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to