This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 850ba8efa15 Add GitHub Actions workflow for Go SDK (#51071)
850ba8efa15 is described below
commit 850ba8efa15ae0e1c9d4aec28effdba050862921
Author: Amogh Desai <[email protected]>
AuthorDate: Mon May 26 16:37:04 2025 +0530
Add GitHub Actions workflow for Go SDK (#51071)
---
.github/boring-cyborg.yml | 3 +
.github/workflows/ci-amd.yml | 31 ++++++++++
.github/workflows/ci-arm.yml | 19 ++++++
.github/workflows/go-sdk-tests.yml | 68 ++++++++++++++++++++++
.../src/airflow_breeze/utils/selective_checks.py | 8 +++
dev/breeze/tests/test_selective_checks.py | 5 ++
go-sdk/worker/runner_test.go | 10 ++--
scripts/ci/testing/run_unit_tests.sh | 11 ++++
8 files changed, 150 insertions(+), 5 deletions(-)
diff --git a/.github/boring-cyborg.yml b/.github/boring-cyborg.yml
index 63717f1adca..5755fe5c01b 100644
--- a/.github/boring-cyborg.yml
+++ b/.github/boring-cyborg.yml
@@ -431,6 +431,9 @@ labelPRBasedOnFilePath:
area:task-sdk:
- task-sdk/**/*
+ area:go-sdk:
+ - go-sdk/**/*
+
area:db-migrations:
- airflow-core/src/airflow/migrations/versions/*
diff --git a/.github/workflows/ci-amd.yml b/.github/workflows/ci-amd.yml
index 49921996f3c..932fc85038d 100644
--- a/.github/workflows/ci-amd.yml
+++ b/.github/workflows/ci-amd.yml
@@ -113,6 +113,7 @@ jobs:
run-coverage: ${{ steps.source-run-info.outputs.run-coverage }}
run-kubernetes-tests: ${{
steps.selective-checks.outputs.run-kubernetes-tests }}
run-task-sdk-tests: ${{
steps.selective-checks.outputs.run-task-sdk-tests }}
+ run-go-sdk-tests: ${{ steps.selective-checks.outputs.run-go-sdk-tests }}
run-system-tests: ${{ steps.selective-checks.outputs.run-system-tests }}
run-tests: ${{ steps.selective-checks.outputs.run-tests }}
run-ui-tests: ${{ steps.selective-checks.outputs.run-ui-tests }}
@@ -756,6 +757,36 @@ jobs:
needs.build-info.outputs.run-tests == 'true' &&
needs.build-info.outputs.only-new-ui-files != 'true')
+ tests-go-sdk:
+ name: "Go SDK tests"
+ needs: [build-info, build-ci-images]
+ runs-on: ${{ fromJSON(needs.build-info.outputs.amd-runners) }}
+ timeout-minutes: 15
+ permissions:
+ contents: read
+ packages: read
+ if: >
+ ( needs.build-info.outputs.run-go-sdk-tests == 'true' ||
+ needs.build-info.outputs.run-tests == 'true' &&
+ needs.build-info.outputs.only-new-ui-files != 'true')
+ env:
+ GITHUB_REPOSITORY: ${{ github.repository }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GITHUB_USERNAME: ${{ github.actor }}
+ VERBOSE: "true"
+ steps:
+ - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
+ uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+
+ - name: "Cleanup dist files"
+ run: rm -fv ./dist/*
+
+ - name: Run Go tests
+ working-directory: ./go-sdk
+ run: go test -v ./...
+
tests-airflow-ctl:
name: "Airflow CTL tests"
uses: ./.github/workflows/airflow-distributions-tests.yml
diff --git a/.github/workflows/ci-arm.yml b/.github/workflows/ci-arm.yml
index 7718a9e2b1a..78468d7c114 100644
--- a/.github/workflows/ci-arm.yml
+++ b/.github/workflows/ci-arm.yml
@@ -106,6 +106,7 @@ jobs:
run-coverage: ${{ steps.source-run-info.outputs.run-coverage }}
run-kubernetes-tests: ${{
steps.selective-checks.outputs.run-kubernetes-tests }}
run-task-sdk-tests: ${{
steps.selective-checks.outputs.run-task-sdk-tests }}
+ run-go-sdk-tests: ${{ steps.selective-checks.outputs.run-go-sdk-tests }}
run-system-tests: ${{ steps.selective-checks.outputs.run-system-tests }}
run-tests: ${{ steps.selective-checks.outputs.run-tests }}
run-ui-tests: ${{ steps.selective-checks.outputs.run-ui-tests }}
@@ -507,6 +508,24 @@ jobs:
( needs.build-info.outputs.run-kubernetes-tests == 'true' ||
needs.build-info.outputs.needs-helm-tests == 'true')
+ tests-go-sdk:
+ name: "Go SDK tests"
+ uses: ./.github/workflows/go-sdk-tests.yml
+ needs: [build-info, build-ci-images]
+ permissions:
+ contents: read
+ packages: read
+ with:
+ runners: ${{ needs.build-info.outputs.arm-runners }}
+ platform: "linux/arm64"
+ canary-run: ${{ needs.build-info.outputs.canary-run }}
+ distribution-name: "go-sdk"
+ test-type: "go-sdk-tests"
+ if: >
+ ( needs.build-info.outputs.run-go-sdk-tests == 'true' ||
+ needs.build-info.outputs.run-tests == 'true' &&
+ needs.build-info.outputs.only-new-ui-files != 'true')
+
finalize-tests:
name: Finalize tests
permissions:
diff --git a/.github/workflows/go-sdk-tests.yml
b/.github/workflows/go-sdk-tests.yml
new file mode 100644
index 00000000000..49b072a62b2
--- /dev/null
+++ b/.github/workflows/go-sdk-tests.yml
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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: Go SDK Tests
+
+on: # yamllint disable-line rule:truthy
+ workflow_call:
+ inputs:
+ runners:
+ description: "The array of labels (in JSON form) determining runners."
+ required: true
+ type: string
+ platform:
+ description: "Platform for the build - 'linux/amd64' or 'linux/arm64'"
+ required: true
+ type: string
+ distribution-name:
+ description: "The name of the distribution to test"
+ required: true
+ type: string
+ test-type:
+ description: "Distribution test type" # e.g. go-sdk-tests
+ required: true
+ type: string
+ canary-run:
+ description: "Whether this is a canary run (true/false)"
+ required: true
+ type: string
+
+permissions:
+ contents: read
+
+jobs:
+ go-sdk-tests:
+ # small timeout is good enough for now
+ timeout-minutes: 15
+ name: ${{ inputs.distribution-name }} tests
+ runs-on: ${{ fromJSON(inputs.runners) }}
+ env:
+ GITHUB_REPOSITORY: ${{ github.repository }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GITHUB_USERNAME: ${{ github.actor }}
+ VERBOSE: "true"
+ steps:
+ - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
+ uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - name: "Cleanup dist files"
+ run: rm -fv ./dist/*
+ - name: Run Go tests
+ working-directory: ./go-sdk
+ run: go test -v ./...
diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
index cc76ee7769f..da4a0363826 100644
--- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
+++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
@@ -109,6 +109,7 @@ class FileGroupForCi(Enum):
SYSTEM_TEST_FILES = "system_tests"
KUBERNETES_FILES = "kubernetes_files"
TASK_SDK_FILES = "task_sdk_files"
+ GO_SDK_FILES = "go_sdk_files"
AIRFLOW_CTL_FILES = "airflow_ctl_files"
ALL_PYTHON_FILES = "all_python_files"
ALL_SOURCE_FILES = "all_sources_for_tests"
@@ -271,6 +272,9 @@ CI_FILE_GROUP_MATCHES = HashableDict(
r"^task-sdk/src/airflow/sdk/.*\.py$",
r"^task-sdk/tests/.*\.py$",
],
+ FileGroupForCi.GO_SDK_FILES: [
+ r"^go-sdk/.*\.go$",
+ ],
FileGroupForCi.ASSET_FILES: [
r"^airflow-core/src/airflow/assets/",
r"^airflow-core/src/airflow/models/assets/",
@@ -779,6 +783,10 @@ class SelectiveChecks:
def run_task_sdk_tests(self) -> bool:
return self._should_be_run(FileGroupForCi.TASK_SDK_FILES)
+ @cached_property
+ def run_go_sdk_tests(self) -> bool:
+ return self._should_be_run(FileGroupForCi.GO_SDK_FILES)
+
@cached_property
def run_airflow_ctl_tests(self) -> bool:
return self._should_be_run(FileGroupForCi.AIRFLOW_CTL_FILES)
diff --git a/dev/breeze/tests/test_selective_checks.py
b/dev/breeze/tests/test_selective_checks.py
index 5f20da3c753..ce43423ccb3 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -1245,6 +1245,11 @@ def assert_outputs_are_printed(expected_outputs:
dict[str, str], stderr: str):
},
id="Run docs-build for SECURITY.md",
),
+ pytest.param(
+ ("go-sdk/sdk/variable.go",),
+ {"run-go-sdk-tests": "true"},
+ id="Run go tests for go-sdk",
+ ),
],
)
def test_expected_output_pull_request_main(
diff --git a/go-sdk/worker/runner_test.go b/go-sdk/worker/runner_test.go
index 0787bb3adbe..d00ad44bbce 100644
--- a/go-sdk/worker/runner_test.go
+++ b/go-sdk/worker/runner_test.go
@@ -159,17 +159,17 @@ func (s *WorkerSuite) TestTaskNotRegisteredErrors() {
// TestStartContextErrorTaskDoesntStart checks that if the /run endpoint
returns an error that task doesn't
// start, but that it is logged
func (s *WorkerSuite) TestStartContextErrorTaskDoesntStart() {
- s.T().Fatal("TODO")
+ s.T().Skip("TODO: Not implemented yet")
}
// TestTaskPanicReportsFailedState tests that when the task/user code panics
that we catch it and report thr
// error upstream
func (s *WorkerSuite) TestTaskPanicReportsFailedState() {
- s.T().Fatal("TODO")
+ s.T().Skip("TODO: Not implemented yet")
}
func (s *WorkerSuite) TestTaskReturnErrorReportsFailedState() {
- s.T().Fatal("TODO")
+ s.T().Skip("TODO: Not implemented yet")
}
func (s *WorkerSuite) TestTaskHeartbeatsWhlieRunning() {
@@ -203,9 +203,9 @@ func (s *WorkerSuite) TestTaskHeartbeatsWhlieRunning() {
}
func (s *WorkerSuite) TestTaskHeatbeatErrorStopsTaskAndLogs() {
- s.T().Fatal("TODO")
+ s.T().Skip("TODO: Not implemented yet")
}
func (s *WorkerSuite) TestTokenRefreshHeaderRespected() {
- s.T().Fatal("TODO")
+ s.T().Skip("TODO: Not implemented yet")
}
diff --git a/scripts/ci/testing/run_unit_tests.sh
b/scripts/ci/testing/run_unit_tests.sh
index 9db2b44b9b2..03db52d6581 100755
--- a/scripts/ci/testing/run_unit_tests.sh
+++ b/scripts/ci/testing/run_unit_tests.sh
@@ -119,6 +119,15 @@ function task_sdk_tests() {
echo "${COLOR_BLUE}Task SDK tests completed${COLOR_RESET}"
}
+function go_sdk_tests() {
+ echo "${COLOR_BLUE}Running Go SDK tests${COLOR_RESET}"
+ set -x
+ cd go-sdk
+ go test -v ./...
+ set +x
+ echo "${COLOR_BLUE}Go SDK tests completed${COLOR_RESET}"
+}
+
function airflow_ctl_tests() {
echo "${COLOR_BLUE}Running Airflow CTL tests${COLOR_RESET}"
@@ -136,6 +145,8 @@ function run_tests() {
providers_tests
elif [[ "${TEST_GROUP}" == "task-sdk" ]]; then
task_sdk_tests
+ elif [[ "${TEST_GROUP}" == "go-sdk" ]]; then
+ go_sdk_tests
elif [[ "${TEST_GROUP}" == "airflow-ctl" ]]; then
airflow_ctl_tests
else