Version Testing #972
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Version Testing | |
on: | |
push: | |
schedule: | |
- cron: "0 7 * * *" | |
jobs: | |
# If this key gets renamed, noxfile.py needs to be updated accordingly | |
test-untested-versions: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# If this key gets renamed, noxfile.py needs to be updated accordingly | |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] | |
name: test-untested-versions | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: pip3 install -r requirements.txt | |
- run: python3 -m nox | |
continue-on-error: true | |
env: | |
TEST_ONLY_UNTESTED_NEW_VERSIONS: true | |
- run: git --no-pager diff | |
- run: mkdir versions_artifact | |
- run: for path in `git diff --name-only`; do cp "$path" versions_artifact; done | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.python-version }} | |
path: versions_artifact | |
create-pr-for-new-versions: | |
runs-on: ubuntu-latest | |
name: create-pr-for-new-versions | |
needs: test-untested-versions | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- run: mkdir versions_artifacts | |
- uses: actions/download-artifact@v3 | |
continue-on-error: true | |
with: | |
name: 3.8 | |
path: versions_artifacts/3.8 | |
- uses: actions/download-artifact@v3 | |
continue-on-error: true | |
with: | |
name: 3.9 | |
path: versions_artifacts/3.9 | |
- uses: actions/download-artifact@v3 | |
continue-on-error: true | |
with: | |
name: '3.10' | |
path: versions_artifacts/3.10 | |
- uses: actions/download-artifact@v3 | |
continue-on-error: true | |
with: | |
name: '3.11' | |
path: versions_artifacts/3.11 | |
- uses: actions/download-artifact@v3 | |
continue-on-error: true | |
with: | |
name: '3.12' | |
path: versions_artifacts/3.12 | |
- run: python3 -m pip install -r requirements.txt | |
- run: python3 -m scripts.gather_version_artifacts | |
- run: git --no-pager diff | |
- run: rm -rf versions_artifacts # the artifacts shouldn't be committed | |
- run: echo "::set-output name=branch_name::$(date +version-testing-%Y%m%d)" | |
id: branch_name | |
- run: | # update 'Supported packages' section in README.md | |
python3 -m scripts.update_supported_packages_documentation | |
- run: | # need to set an env var in order to support multi-lines output https://trstringer.com/github-actions-multiline-strings/ | |
new_versions="$(./scripts/describe_supported_versions_diff.sh)" | |
echo "new_versions<<EOF" >> $GITHUB_ENV | |
echo "$new_versions" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Create Pull Request | |
# WARNING: the create pull request action must be the last action in the job, it changes the current branch | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
title: ${{steps.branch_name.outputs.branch_name}} | |
branch: ${{steps.branch_name.outputs.branch_name}} | |
commit-message: ${{ env.new_versions }} | |
body: ${{ env.new_versions }} | |
base: main | |
labels: version-testing, automerge | |
reviewers: GuyMoses,saartochner,shanishiri | |
# WARNING: the create pull request action must be the last action in the job, it changes the current branch | |
- run: | # post update to #microservices slack channel | |
slack_channel_webhook="${{secrets.VERSION_TESTING_SLACK_CHANNEL_WEBHOOK}}" | |
if [[ -n "$slack_channel_webhook" ]]; then | |
branch_name="${{steps.branch_name.outputs.branch_name}}" | |
text_property="New version testing PR has been opened: | |
\nRepository: opentelemetry-python-distro | |
\nBranch name: ${branch_name} | |
\n | |
\nPlease review, approve and merge the PR *only* if the results are desirable." | |
echo \{ \"text\": "$text_property" \} | \ | |
curl -X POST "${slack_channel_webhook}" --header "Content-Type: application/json" -v --data-binary @- | |
else | |
echo "Slack channel webhook is not set, skipping posting to slack" | |
fi | |
delete-old-version-testing-branches: | |
runs-on: ubuntu-latest | |
name: delete-old-version-testing-branches | |
needs: create-pr-for-new-versions | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | # remove all the version testing branches that aren't from today | |
./scripts/delete_old_version_testing_branches.sh |