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

chore: fix run tests script #19

Closed
wants to merge 21 commits into from

Conversation

alon-dotan-starkware
Copy link
Contributor

@alon-dotan-starkware alon-dotan-starkware commented Jul 17, 2024

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Other information


This change is Reviewable

dafnamatsry and others added 18 commits May 2, 2024 14:06
fix(format): run format fix on all repo
Signed-off-by: Dori Medini <dori@starkware.co>
* feature(ci): Identify which package need to be built according to file changed
---------

Signed-off-by: Dori Medini <dori@starkware.co>
Co-authored-by: Dori Medini <dori@starkware.co>
Signed-off-by: Dori Medini <dori@starkware.co>
* chore: fix ci to always compare changes against the target branch
* chore: copy all crates

* chore: switch to local dependencies

* chore: delete old papyrus_test_utils crate

* chore: rename crate test_utils -> papyrus_test_utils

* chore: fix RPCTransactio name in the mempool

* chore: fix mockito deps in papyrus and gateway

* chore: update cairo-* deps version

* chore: update config and presets for mempool and papyrus

* chore: rename default_config.json -> papyrus_default_config.json

* chore: rustfmt

* chore: reorg folders

* chore: reorg folders

* chore: fix unused deps

* chore: update papyrus Dockerfile

* chore: update scripts folder

* chore: copy build_native_blockifier.sh

* chore: copy BUILD and WORKSPACE files (from blockifier and committer)

* chore: update papyrus non crates folders and files

* chore: copy blockifier docs

* chore: copy committer taplo.toml

* chore: fix config tests

* chore: copy blockifier docker file

* fix: papyrus integration test runs only Papyrus related tests

* chore: rename conflicting dump_config.rs files

* chore: fix cargo doc errors

* chore: fix CI

* chore: small optimizations for the papyrus CI

* chore: copy README files

* chore: meld common repo files

---------

Co-authored-by: alon.dotan <alon.dotan@starkware.co>
Co-authored-by: Dan Brownstein <dan@starkware.co>
@alon-dotan-starkware alon-dotan-starkware changed the title chore: Fix run tests script chore: fix run tests script Jul 18, 2024
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @alon-dotan-starkware and @dan-starkware)


.github/workflows/main.yml line 81 at r1 (raw file):

  run-tests:
    if: github.event_name == 'pull_request'

why?

Code quote:

if: github.event_name == 'pull_request'

.github/workflows/main.yml line 86 at r1 (raw file):

      - uses: actions/checkout@v4
        with:
          fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

what's this?

Code quote:

        with:
          fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

.github/workflows/main.yml line 108 at r1 (raw file):

          ci/bin/pip install -r scripts/requirements.txt
          ci/bin/python scripts/run_tests.py --changes_only --commit_id HEAD^1
          ci/bin/python scripts/run_tests.py --changes_only --features concurrency --commit_id HEAD^1

what is the HEAD^?

Code quote:

          ci/bin/python scripts/run_tests.py --changes_only --commit_id HEAD^1
          ci/bin/python scripts/run_tests.py --changes_only --features concurrency --commit_id HEAD^1

scripts/run_tests.py line 36 at r1 (raw file):

        raise

    return [c.a_path for c in repo.head.commit.diff(commit_id)]

when I add another commit to a PR I expect tests to run relative to all files changed between the merge target and the tip of the branch, this is what's happening here?

Code quote:

def get_local_changes(repo_path, commit_id: Optional[str]) -> List[str]:
    os.environ["GIT_PYTHON_REFRESH"] = "quiet"  # noqa
    repo = Repo(repo_path)
    try:
        repo.head.object  # Check if local_repo is a git repo.
    except ValueError:
        print(f"unable to validate {repo_path} as a git repo.")
        raise

    return [c.a_path for c in repo.head.commit.diff(commit_id)]

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @alon-dotan-starkware and @dan-starkware)


.github/workflows/main.yml line 103 at r1 (raw file):

        run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
      - name: "Run tests pull request"
        if: github.event_name == 'pull_request'

isn't this always true if you're in run-tests?

Code quote:

if: github.event_name == 'pull_request'

Signed-off-by: Dori Medini <dori@starkware.co>
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @alon-dotan-starkware and @dan-starkware)


.github/workflows/main.yml line 103 at r1 (raw file):

Previously, dorimedini-starkware wrote…

isn't this always true if you're in run-tests?

still relevant... this if is also at the tpo of the entire step, when can we reach this point with github.event_name != 'pull_request'?


.github/workflows/main.yml line 93 at r2 (raw file):

          # in a pull request, we need 2 commits, the commit the pr born from on the target branch, and the merge one,
          # in pull we need the entire history.
          fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

fetch depth 0 means "all history"?


.github/workflows/main.yml line 123 at r2 (raw file):

        # See comments above.
        if: github.event_name == 'push'
        # TODO: Better support for running tests on push.

can you elaborate? what is the current issue?
also, since this is in the run-tests step which only runs when the event is a pull request, when will Run tests on push ever run?

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @alon-dotan-starkware and @dan-starkware)

a discussion (no related file):
@alon-dotan-starkware this should be closed (we did something else)


@liorgold2 liorgold2 closed this Jul 24, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 27, 2024
@alon-dotan-starkware alon-dotan-starkware deleted the alon.dotan/main/fix_run_tests branch August 4, 2024 07:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants