Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger windows e2e tests when windows-related files change #36857

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/e2e-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,22 @@ env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2

jobs:
windows-file-changed:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Did windows files changed
run: echo "changed=$(./.github/workflows/scripts/is_changed_file_windows.sh )" >> "$GITHUB_OUTPUT"
- run: echo $(./.github/workflows/scripts/is_changed_file_windows.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} )

collector-build:
runs-on: windows-latest
if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') }}
needs: [windows-file-changed]
if: ${{ github.actor != 'dependabot[bot]' && ((contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') || needs.windows-file-changed.outputs.changed == 'true') }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/scripts/is_changed_file_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

#
# verifies if any changed file is related to windows architecture.
# this script is used to determine if e2e tests should be run on windows.
#
# It's intended to be used in a GitHub Actions workflow:
# bash .github/workflows/scripts/is_changed_file_windows.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }}


# Get changed files
base_sha=$1
head_sha=$2
changed_files=$(git diff --name-only $base_sha $head_sha)

# Find windows related files
windows_files=$(find * -regex ".*windows.*.go")


# Loop over changed files and check if they exist in windows_files
found_windows_file=false
for file in $changed_files; do
for windows_file in $windows_files; do
if [[ $file == "$windows_file" ]]; then
found_windows_file=true
break
fi
done
done

echo "$found_windows_file"
Loading