Skip to content

Commit e56456b

Browse files
committed
create PR earlier
1 parent 7252cb3 commit e56456b

File tree

1 file changed

+50
-38
lines changed

1 file changed

+50
-38
lines changed

.github/workflows/nightly-build.yml

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ on:
44
schedule:
55
- cron: "21 3 * * *"
66
workflow_dispatch:
7-
push:
8-
branches:
9-
- zhaez/nightly-build
107

118
jobs:
12-
build-and-test:
9+
update-and-create-pr:
1310
runs-on: ubuntu-latest
11+
outputs:
12+
has_changes: ${{ steps.check_changes.outputs.has_changes }}
13+
otel_python_version: ${{ steps.get_versions.outputs.otel_python_version }}
14+
otel_contrib_version: ${{ steps.get_versions.outputs.otel_contrib_version }}
1415

1516
steps:
1617
- name: Checkout repository
@@ -35,7 +36,7 @@ jobs:
3536
- name: Install build tools
3637
run: |
3738
python -m pip install --upgrade pip
38-
pip install build pytest toml requests
39+
pip install toml requests
3940
4041
- name: Get latest upstream versions
4142
id: get_versions
@@ -47,7 +48,7 @@ jobs:
4748
OTEL_CONTRIB_VERSION: ${{ steps.get_versions.outputs.otel_contrib_version }}
4849
run: python scripts/update_dependencies.py
4950

50-
- name: Check for changes and run tests
51+
- name: Check for changes and create PR
5152
id: check_changes
5253
run: |
5354
if git diff --quiet; then
@@ -56,10 +57,52 @@ jobs:
5657
else
5758
echo "Dependencies were updated"
5859
echo "has_changes=true" >> $GITHUB_OUTPUT
60+
61+
# Create PR immediately
62+
git add aws-opentelemetry-distro/pyproject.toml
63+
git commit -m "chore: update OpenTelemetry dependencies to ${{ steps.get_versions.outputs.otel_python_version }}/${{ steps.get_versions.outputs.otel_contrib_version }}"
64+
git push origin "$BRANCH_NAME"
65+
66+
gh pr create \
67+
--title "Nightly dependency update: OpenTelemetry ${{ steps.get_versions.outputs.otel_python_version }}/${{ steps.get_versions.outputs.otel_contrib_version }}" \
68+
--body "Automated update of OpenTelemetry dependencies.
69+
70+
**Updated versions:**
71+
- OpenTelemetry Python: ${{ steps.get_versions.outputs.otel_python_version }}
72+
- OpenTelemetry Contrib: ${{ steps.get_versions.outputs.otel_contrib_version }}
73+
74+
**Status:** Tests are running in the nightly workflow. Check the workflow results for compatibility status.
75+
76+
This PR will trigger additional validation via pr-build workflow including multi-version testing and linting." \
77+
--base main \
78+
--head "$BRANCH_NAME" \
79+
--label "dependencies"
5980
fi
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
84+
build-and-test:
85+
runs-on: ubuntu-latest
86+
needs: update-and-create-pr
87+
if: needs.update-and-create-pr.outputs.has_changes == 'true'
88+
89+
steps:
90+
- name: Checkout repository
91+
uses: actions/checkout@v4
92+
with:
93+
ref: nightly-deps-$(date +%Y%m%d)
94+
95+
- name: Set up Python
96+
uses: actions/setup-python@v4
97+
with:
98+
python-version: '3.11'
99+
100+
- name: Install build tools
101+
run: |
102+
python -m pip install --upgrade pip
103+
pip install build pytest toml requests
60104
61105
- name: Build and test
62-
if: steps.check_changes.outputs.has_changes == 'true'
63106
uses: ./.github/actions/artifacts_build
64107
with:
65108
image_uri_with_tag: adot-python-nightly:snapshot
@@ -70,7 +113,6 @@ jobs:
70113
os: ubuntu-latest
71114

72115
- name: Build and Test Lambda Layer
73-
if: steps.check_changes.outputs.has_changes == 'true'
74116
uses: ./.github/actions/lambda_artifacts_build
75117
with:
76118
python_version: "3.12"
@@ -79,37 +121,7 @@ jobs:
79121
os: ubuntu-latest
80122

81123
- name: Run contract tests
82-
if: steps.check_changes.outputs.has_changes == 'true'
83124
run: |
84125
bash scripts/set-up-contract-tests.sh
85126
pip install pytest
86127
pytest contract-tests/tests
87-
88-
- name: Create PR if changes exist
89-
if: steps.check_changes.outputs.has_changes == 'true'
90-
run: |
91-
git add aws-opentelemetry-distro/pyproject.toml
92-
git commit -m "chore: update OpenTelemetry dependencies to ${{ steps.get_versions.outputs.otel_python_version }}/${{ steps.get_versions.outputs.otel_contrib_version }}"
93-
git push origin "$BRANCH_NAME"
94-
95-
gh pr create \
96-
--title "Nightly dependency update: OpenTelemetry ${{ steps.get_versions.outputs.otel_python_version }}/${{ steps.get_versions.outputs.otel_contrib_version }}" \
97-
--body "Automated update of OpenTelemetry dependencies.
98-
99-
**Updated versions:**
100-
- OpenTelemetry Python: ${{ steps.get_versions.outputs.otel_python_version }}
101-
- OpenTelemetry Contrib: ${{ steps.get_versions.outputs.otel_contrib_version }}
102-
103-
**Tests completed:**
104-
- Unit tests (tox)
105-
- Wheel building
106-
- Docker image building
107-
- Lambda layer building and testing
108-
- Contract tests
109-
110-
This PR will trigger additional validation via pr-build workflow including multi-version testing and linting." \
111-
--base main \
112-
--head "$BRANCH_NAME" \
113-
--label "dependencies"
114-
env:
115-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)