Skip to content

Commit

Permalink
fix(ci): Fix yaml generation script (#2695)
Browse files Browse the repository at this point in the history
The generation script was supposed to raise an error if it detected that the integration test YAML files have changed but haven't been committed. The check is based on a hash of the contents of the YAML files, but there was a typo in the file names to consider (`integration` -> `integrations`), so it wasn't actually looking at any files and was always trivially true.

Now it'll properly complain if changes are made to `tox.ini` or to some of the constants in the splitting script that result in new YAML files, but those are not part of the commit.
  • Loading branch information
sentrivana authored Feb 1, 2024
1 parent c8e9172 commit ad86d61
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 26 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/test-integrations-databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-pymongo-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test redis latest
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-redis-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test rediscluster latest
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-rediscluster-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test sqlalchemy latest
run: |
set -x # print commands that are executed
Expand Down Expand Up @@ -146,6 +154,14 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test redis pinned
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test rediscluster pinned
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test sqlalchemy pinned
run: |
set -x # print commands that are executed
Expand Down Expand Up @@ -205,6 +221,14 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py2.7-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test redis py27
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py2.7-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test rediscluster py27
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py2.7-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test sqlalchemy py27
run: |
set -x # print commands that are executed
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/test-integrations-web-frameworks-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-quart-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test redis latest
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-redis-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test rediscluster latest
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-rediscluster-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test sanic latest
run: |
set -x # print commands that are executed
Expand Down Expand Up @@ -142,14 +134,6 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test redis pinned
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test rediscluster pinned
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test sanic pinned
run: |
set -x # print commands that are executed
Expand Down Expand Up @@ -207,14 +191,6 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py2.7-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test redis py27
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py2.7-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test rediscluster py27
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py2.7-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch
- name: Test sanic py27
run: |
set -x # print commands that are executed
Expand Down
6 changes: 4 additions & 2 deletions scripts/split-tox-gh-actions/split-tox-gh-actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
files have been changed by the scripts execution. This is used in CI to check if the yaml files
represent the current tox.ini file. (And if not the CI run fails.)
"""

import configparser
import hashlib
import sys
Expand Down Expand Up @@ -155,7 +156,8 @@ def main(fail_on_changes):

if old_hash != new_hash:
raise RuntimeError(
"The yaml configuration files have changed. This means that tox.ini has changed "
"The yaml configuration files have changed. This means that either `tox.ini` "
"or one of the constants in `split-tox-gh-actions.py` has changed "
"but the changes have not been propagated to the GitHub actions config files. "
"Please run `python scripts/split-tox-gh-actions/split-tox-gh-actions.py` "
"locally and commit the changes of the yaml configuration files to continue. "
Expand Down Expand Up @@ -235,7 +237,7 @@ def replace_and_sort(versions):
def get_files_hash():
"""Calculate a hash of all the yaml configuration files"""
hasher = hashlib.md5()
path_pattern = (OUT_DIR / "test-integration-*.yml").as_posix()
path_pattern = (OUT_DIR / "test-integrations-*.yml").as_posix()
for file in glob(path_pattern):
with open(file, "rb") as f:
buf = f.read()
Expand Down

0 comments on commit ad86d61

Please sign in to comment.