From ce1434a75aaf0f98893852e83f018eec7b740a86 Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Fri, 8 Dec 2023 08:15:02 -0500 Subject: [PATCH 1/6] import central travis scripts --- .travis.yml | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index af3881ef..474ddd97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: python env: global: - PYTEST_SETTINGS="not requires_gpu and not memory_intense and not slow and not travis_slow" + - DOMAIN="language" - MODIFIES_PLUGIN="False" - PLUGIN_ONLY="False" - WEB_SUBMISSION="False" @@ -18,28 +19,8 @@ install: - pip list # install singularity for container models - conda install -yc conda-forge singularity -before_script: - - git fetch --depth=50 origin refs/heads/main:refs/heads/main -script: - # if ONLY plugin files changed, ONLY run tests for those plugins; otherwise, run full test suite - - | - if [ ! -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then - CHANGED_FILES=$( git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch && echo $(git diff --name-only origin/$TRAVIS_PULL_REQUEST_BRANCH origin/$TRAVIS_BRANCH -C $TRAVIS_BUILD_DIR) | tr '\n' ' ' ) && - TESTING_NEEDED=$( python -c "from brainscore_core.plugin_management.parse_plugin_changes import get_testing_info; get_testing_info(\"${CHANGED_FILES}\", 'brainscore_language')" ) && - read MODIFIES_PLUGIN PLUGIN_ONLY <<< $TESTING_NEEDED && echo MODIFIES_PLUGIN: $MODIFIES_PLUGIN && echo PLUGIN_ONLY: $PLUGIN_ONLY; - fi - - if [ "$MODIFIES_PLUGIN" = "True" ]; then python -c "from brainscore_core.plugin_management.parse_plugin_changes import run_changed_plugin_tests; run_changed_plugin_tests(\"${CHANGED_FILES}\", 'brainscore_language')"; fi - - if [ "$PRIVATE_ACCESS" = 1 ] && [ -n "${GITHUB_TOKEN}" ] && [ "$PLUGIN_ONLY" = "False" ]; then pytest -m "private_access and $PYTEST_SETTINGS"; fi - - if [ "$PRIVATE_ACCESS" != 1 ] && [ "$PLUGIN_ONLY" = "False" ]; then pytest -m "not private_access and $PYTEST_SETTINGS" --ignore "tests/test_submission"; fi -after_failure: - # if web submission, notify submitter via email - - PR_TITLE=$(curl https://github.com/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST} 2> /dev/null | grep "title" | head -1) - - if [[ "$PR_TITLE" = "brain-score.org (user:"* ]]; then WEB_SUBMISSION="True"; fi - - | - if $WEB_SUBMISSION = "True"; then - BRAINSCORE_UID=$(<<<$PR_TITLE | sed -E 's/.*\(user:([^)]+)\).*/\1/') && - python -c "from brainscore_language.submission.endpoints import send_email_to_submitter; send_email_to_submitter(\"${BRAINSCORE_UID}\", 'language', \"${$TRAVIS_PULL_REQUEST}\", \"${$GMAIL_USERNAME}\", \"${GMAIL_PASSWORD}\")"; - fi +import: brain-score/core:tools/script.yml@main +import: brain-score/core:tools/submission_failure.yml@main jobs: @@ -58,10 +39,4 @@ jobs: python: '3.9' install: python -m pip install -e ".[test]" if: type = pull_request - script: - - | - if [ ! -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then - CHANGED_FILES=$( git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch && echo $(git diff --name-only origin/$TRAVIS_PULL_REQUEST_BRANCH origin/$TRAVIS_BRANCH -C $TRAVIS_BUILD_DIR) | tr '\n' ' ' ) && - PLUGIN_ONLY=$( python -c "from brainscore_core.plugin_management.parse_plugin_changes import is_plugin_only; is_plugin_only(\"${CHANGED_FILES}\", 'brainscore_language')" ) - fi - - if [ "$PLUGIN_ONLY" = "True" ]; then bash ${TRAVIS_BUILD_DIR}/.github/workflows/travis_trigger.sh $GH_WORKFLOW_TRIGGER $TRAVIS_PULL_REQUEST_SHA; fi + import: brain-score/core:tools/automerge_check.yml@main \ No newline at end of file From c27801d19a5012bbd36aef91282b73b14655bc5d Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Tue, 12 Dec 2023 15:27:02 -0500 Subject: [PATCH 2/6] update core travis script paths --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 474ddd97..89b94ee9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,8 @@ install: - pip list # install singularity for container models - conda install -yc conda-forge singularity -import: brain-score/core:tools/script.yml@main -import: brain-score/core:tools/submission_failure.yml@main +import: brain-score/core:brainscore_core/travis/script.yml@main +import: brain-score/core:brainscore_core/travis/submission_failure.yml@main jobs: @@ -39,4 +39,4 @@ jobs: python: '3.9' install: python -m pip install -e ".[test]" if: type = pull_request - import: brain-score/core:tools/automerge_check.yml@main \ No newline at end of file + import: brain-score/core:brainscore_core/travis/automerge_check.yml@main From 8f4e250c40274c013e1c6c69a3027ce0522ff7dc Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Wed, 13 Dec 2023 11:47:26 -0500 Subject: [PATCH 3/6] add version --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 89b94ee9..739722ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +version: ~> 1.0 language: python env: global: From db07eef7327ffad423de65704599fb8dd67a519a Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Wed, 13 Dec 2023 13:18:31 -0500 Subject: [PATCH 4/6] remove script import from jobs --- .travis.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 739722ef..6aab7094 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,8 +20,9 @@ install: - pip list # install singularity for container models - conda install -yc conda-forge singularity -import: brain-score/core:brainscore_core/travis/script.yml@main -import: brain-score/core:brainscore_core/travis/submission_failure.yml@main +import: + - brain-score/core:brainscore_core/travis/script.yml@main + - brain-score/core:brainscore_core/travis/submission_failure.yml@main jobs: @@ -40,4 +41,11 @@ jobs: python: '3.9' install: python -m pip install -e ".[test]" if: type = pull_request - import: brain-score/core:brainscore_core/travis/automerge_check.yml@main + script: + - | + if [ ! -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then + CHANGED_FILES=$( git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch && echo $(git diff --name-only origin/$TRAVIS_PULL_REQUEST_BRANCH origin/$TRAVIS_BRANCH -C $TRAVIS_BUILD_DIR) | tr '\n' ' ' ) && + PLUGIN_ONLY=$( python -c "from brainscore_core.plugin_management.parse_plugin_changes import is_plugin_only; is_plugin_only(\"${CHANGED_FILES}\", \"brainscore_${DOMAIN}\")" ) + fi + - if [ "$PLUGIN_ONLY" = "True" ]; then bash ${TRAVIS_BUILD_DIR}/.github/workflows/travis_trigger.sh $GH_WORKFLOW_TRIGGER $TRAVIS_PULL_REQUEST_SHA; fi + From 73e4ce0926e6c891852e3d456ca5e71879fad3cf Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Tue, 2 Jan 2024 20:21:29 -0500 Subject: [PATCH 5/6] typo --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6aab7094..387d602c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,10 +42,10 @@ jobs: install: python -m pip install -e ".[test]" if: type = pull_request script: - - | - if [ ! -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then - CHANGED_FILES=$( git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch && echo $(git diff --name-only origin/$TRAVIS_PULL_REQUEST_BRANCH origin/$TRAVIS_BRANCH -C $TRAVIS_BUILD_DIR) | tr '\n' ' ' ) && - PLUGIN_ONLY=$( python -c "from brainscore_core.plugin_management.parse_plugin_changes import is_plugin_only; is_plugin_only(\"${CHANGED_FILES}\", \"brainscore_${DOMAIN}\")" ) - fi - - if [ "$PLUGIN_ONLY" = "True" ]; then bash ${TRAVIS_BUILD_DIR}/.github/workflows/travis_trigger.sh $GH_WORKFLOW_TRIGGER $TRAVIS_PULL_REQUEST_SHA; fi + - | + if [ ! -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then + CHANGED_FILES=$( git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch && echo $(git diff --name-only origin/$TRAVIS_PULL_REQUEST_BRANCH origin/$TRAVIS_BRANCH -C $TRAVIS_BUILD_DIR) | tr '\n' ' ' ) && + PLUGIN_ONLY=$( python -c "from brainscore_core.plugin_management.parse_plugin_changes import is_plugin_only; is_plugin_only(\"${CHANGED_FILES}\", \"brainscore_${DOMAIN}\")" ) + fi + - if [ "$PLUGIN_ONLY" = "True" ]; then bash ${TRAVIS_BUILD_DIR}/.github/workflows/travis_trigger.sh $GH_WORKFLOW_TRIGGER $TRAVIS_PULL_REQUEST_SHA; fi From 73a781913145e14867315d174ddb2125c058474a Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Tue, 2 Jan 2024 20:22:36 -0500 Subject: [PATCH 6/6] break multiline conditional --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 387d602c..3df0b153 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,5 +47,8 @@ jobs: CHANGED_FILES=$( git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch && echo $(git diff --name-only origin/$TRAVIS_PULL_REQUEST_BRANCH origin/$TRAVIS_BRANCH -C $TRAVIS_BUILD_DIR) | tr '\n' ' ' ) && PLUGIN_ONLY=$( python -c "from brainscore_core.plugin_management.parse_plugin_changes import is_plugin_only; is_plugin_only(\"${CHANGED_FILES}\", \"brainscore_${DOMAIN}\")" ) fi - - if [ "$PLUGIN_ONLY" = "True" ]; then bash ${TRAVIS_BUILD_DIR}/.github/workflows/travis_trigger.sh $GH_WORKFLOW_TRIGGER $TRAVIS_PULL_REQUEST_SHA; fi + - | + if [ "$PLUGIN_ONLY" = "True" ]; then + bash ${TRAVIS_BUILD_DIR}/.github/workflows/travis_trigger.sh $GH_WORKFLOW_TRIGGER $TRAVIS_PULL_REQUEST_SHA; + fi