diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff27296..5cb5e9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ permissions: contents: read jobs: - test-action: - name: GitHub Actions Test + test-java-action: + name: Java Smoke Test runs-on: ubuntu-latest container: image: adoptopenjdk/openjdk11:latest @@ -38,3 +38,299 @@ jobs: java -version 2>&1 | tee $LOG_FILE grep -q "$TRACER_INIT_LOG" $LOG_FILE || { echo "Error: Output does not contain tracer initialisation log: $TRACER_INIT_LOG"; exit 1; } + + test-go-action-matrix: + name: Go Matrix (${{ matrix.name }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - case_id: root_go_124_success + name: root go1.24 success + runner_go: '1.26.1' + layout: root + project_go: '1.24.0' + go_module_dir: '' + expect_action_failure: false + run_go_tests: true + test_workdir: . + expected_dd_trace_go_version: v2.6.0 + - case_id: root_go_125_success + name: root go1.25 success + runner_go: '1.26.1' + layout: root + project_go: '1.25.0' + go_module_dir: '' + expect_action_failure: false + run_go_tests: true + test_workdir: . + expected_dd_trace_go_version: v2.7.0 + - case_id: root_go_122_skip + name: root go1.22 skip + runner_go: '1.26.1' + layout: root + project_go: '1.22.0' + go_module_dir: '' + expect_action_failure: false + run_go_tests: false + test_workdir: . + expected_dd_trace_go_version: '' + - case_id: runner_below_min_skip + name: runner below minimum partial failure + runner_go: '1.23.12' + layout: root + project_go: '1.24.0' + go_module_dir: '' + expect_action_failure: true + run_go_tests: false + test_workdir: . + expected_dd_trace_go_version: '' + - case_id: single_nested_go_124_auto + name: single nested go1.24 auto-detect + runner_go: '1.26.1' + layout: single_nested + project_go: '1.24.0' + go_module_dir: '' + expect_action_failure: false + run_go_tests: true + test_workdir: services/payments + expected_dd_trace_go_version: v2.6.0 + - case_id: single_nested_go_125_auto + name: single nested go1.25 auto-detect + runner_go: '1.26.1' + layout: single_nested + project_go: '1.25.0' + go_module_dir: '' + expect_action_failure: false + run_go_tests: true + test_workdir: services/payments + expected_dd_trace_go_version: v2.7.0 + - case_id: multiple_modules_without_override_skip + name: multiple modules without override skip + runner_go: '1.26.1' + layout: multiple_modules + project_go: '1.24.0' + second_project_go: '1.25.0' + go_module_dir: '' + expect_action_failure: false + run_go_tests: false + test_workdir: . + expected_dd_trace_go_version: '' + - case_id: multiple_modules_with_override_success + name: multiple modules with override success + runner_go: '1.26.1' + layout: multiple_modules + project_go: '1.25.0' + second_project_go: '1.24.0' + go_module_dir: ./services/payments + expect_action_failure: false + run_go_tests: true + test_workdir: services/payments + expected_dd_trace_go_version: v2.7.0 + - case_id: missing_directory_fail + name: missing override directory failure + runner_go: '1.26.1' + layout: root + project_go: '1.24.0' + go_module_dir: ./services/does-not-exist + expect_action_failure: true + run_go_tests: false + test_workdir: . + expected_dd_trace_go_version: '' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.runner_go }} + cache: false + + - name: Create Go Scenario + shell: bash + run: | + set -euo pipefail + + create_module() { + local module_dir="$1" + local module_name="$2" + local go_version="$3" + local package_name="$4" + + mkdir -p "$module_dir" + + cat > "$module_dir/go.mod" < "$module_dir/smoke_test.go" <> $GITHUB_PATH shell: bash env: - INSTALLATION_SCRIPT_URL: https://install.datadoghq.com/scripts/install_test_visibility_v11.sh - INSTALLATION_SCRIPT_CHECKSUM: fc64c45fd4b45b4b01773c58a3a116bef212dc4095508a6e27e19e50e901bd55 + INSTALLATION_SCRIPT_URL: https://install.datadoghq.com/scripts/install_test_visibility_v12.sh + INSTALLATION_SCRIPT_CHECKSUM: 91b6c7bb2c28ef5604c2a2b233da7d931a9b3b5d20b7872254ebb0e689e62f4a GITHUB_ACTION_PATH: ${{ github.action_path }} - name: Get Go cache directories @@ -151,6 +154,7 @@ runs: DD_SET_TRACER_VERSION_PYTHON: ${{ inputs.python-tracer-version }} DD_SET_TRACER_VERSION_RUBY: ${{ inputs.ruby-tracer-version }} DD_SET_TRACER_VERSION_GO: ${{ inputs.go-tracer-version }} + DD_CIVISIBILITY_GO_MODULE_DIR: ${{ inputs.go-module-dir }} DD_INSTRUMENTATION_BUILD_SYSTEM_JAVA: ${{ inputs.java-instrumented-build-system }} - name: Propagate optional site input to environment variable @@ -203,4 +207,3 @@ runs: rm -f $GITHUB_STEP_SUMMARY fi shell: bash -