Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Test using setup-python directly for common packages #190

Closed
wants to merge 1 commit into from

Conversation

lefticus
Copy link
Member

@lefticus lefticus commented Feb 5, 2022

  • gcovr, conan, ninja, cmake are all fully supported with pip install on all 3 platforms
  • using setup-python and pip3 directly removes one variable from the build process
  • using pip3 directly to install all 3 provides consistency across platforms

 * gcovr, conan, pip, cmake are all fully supported with pip install on
   all 3 platforms
 * using setup-python and pip3 directly removes one variable from the
   build process
 * using pip3 directly to install all 3 provides consistency across
   platforms
@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2022

Codecov Report

Merging #190 (b1f45dc) into main (26a39b1) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #190   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           20        20           
=========================================
  Hits            20        20           
Flag Coverage Δ
Linux ∅ <ø> (∅)
Windows 100.00% <ø> (ø)
macOS ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 26a39b1...b1f45dc. Read the comment docs.

@lefticus
Copy link
Member Author

lefticus commented Feb 5, 2022

This partially a workaround for aminya/setup-cpp#27 but also I think it is not a bad idea, as mentioned in the commit message, it gives consistency across all platforms for the versions and mechanism that common tools are installed.

@lefticus lefticus marked this pull request as ready for review February 5, 2022 17:38
@ddalcino
Copy link
Collaborator

ddalcino commented Feb 5, 2022

Just for clarification: Is this meant to be permanent, or just a temporary fix until aminya/setup-cpp#27 is fixed?

@lefticus
Copy link
Member Author

lefticus commented Feb 5, 2022

Just for clarification: Is this meant to be permanent, or just a temporary fix until aminya/setup-cpp#27 is fixed?

In my opinion, it would be permanent. I see it as one less potential issue while maintaining this project, and for our users in the future. I don't see any reason to use a mix of chocolatey, package managers, etc, when python gives us the same versions of the same packages across all platforms.

Copy link
Contributor

@aminya aminya left a comment

Choose a reason for hiding this comment

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

It is not setup-cpp's fault that the pre-installed Python broke on Windows images. In fact setup-cpp does not call "setup-python" until it actually needed. I do not approve of this, as this is like discarding all the things it was considered in setup-cpp and trying to re-implement them in bash.

Comment on lines +114 to +115
cmake: false
ninja: false
Copy link
Contributor

@aminya aminya Feb 5, 2022

Choose a reason for hiding this comment

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

Cmake and Ninja do not need python. Why should they be installed with pip?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because it gives a simple consistent command that works on all 3 platforms that are supported on github. Since we are working specifically on a github workflow here.

@@ -101,22 +101,26 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-${{matrix.build_type}}-${{matrix.generator}}-${{matrix.developer_mode}}

- uses: actions/setup-python@v2

- run: pip3 install cmake ninja conan gcovr
Copy link
Contributor

@aminya aminya Feb 5, 2022

Choose a reason for hiding this comment

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

This is incomplete. It does not put the paths that conan and gcovr are called from on the path. Have you tried this locally?

https://github.com/aminya/setup-cpp/blob/94827f017e0e4445837e4cc099daf7ce849a059c/src/utils/setup/setupPipPack.ts#L35-L56

Copy link
Member Author

@lefticus lefticus Feb 5, 2022

Choose a reason for hiding this comment

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

It is not setup-cpp's fault that the pre-installed Python broke on Windows images. In fact setup-cpp does not call "setup-python" until it actually needed. I do not approve of this, as this is like discarding all the things it was considered in setup-cpp and trying to re-implement them in bash.

It is not discarding everything setup-cpp is used for. Setup-cpp still does all of the hard work of finding and installing compilers across compilers.

Here I specifically meant the pip installations. As I mentioned in the above comments, it is needed to check if:

* python paths are added to PATH on all platforms

* if pip is installed and is up to date

It's good that setup-cpp is now fixed, but I think it's worth mentioning that all of this worked without any other path manipulations. All tests passed and even properly posted coverage reports.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that what @aminya’s not saying here is that setup-cpp works just as well on a self-hosted runner. The setup-Python action takes a little more work for that. Some users depend on being able to build their projects with a self-hosted runner; maybe we should try to support them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We could add additional code here to make self-hosted runners work; there are directions on how to do that here: https://github.com/actions/setup-python.

Or, we could just use setup-cpp.

@@ -101,22 +101,26 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-${{matrix.build_type}}-${{matrix.generator}}-${{matrix.developer_mode}}

- uses: actions/setup-python@v2

- run: pip3 install cmake ninja conan gcovr
Copy link
Contributor

@aminya aminya Feb 5, 2022

Choose a reason for hiding this comment

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

On the GitHub images, it happens that pip3 is on the path. But a lot of the time, it is actually called pip, which means it is needed to check if pip has version 3 or above.

https://github.com/aminya/setup-cpp/blob/94827f017e0e4445837e4cc099daf7ce849a059c/src/utils/setup/setupPipPack.ts#L19-L29

Copy link
Member Author

Choose a reason for hiding this comment

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

On the GitHub images, it happens that pip3 is on the path. But a lot of the time, it is actually called pip, which means it is needed to check if pip has version 3 or above.

But isn't this yml file only used on github images?

It's specifically in .github/workflows/ci.yml, so shouldn't that be the primary concern here?

@lefticus
Copy link
Member Author

lefticus commented Feb 5, 2022

It is not setup-cpp's fault that the pre-installed Python broke on Windows images. In fact setup-cpp does not call "setup-python" until it actually needed. I do not approve of this, as this is like discarding all the things it was considered in setup-cpp and trying to re-implement them in bash.

It is not discarding everything setup-cpp is used for. Setup-cpp still does all of the hard work of finding and installing compilers across compilers.

Copy link
Contributor

@aminya aminya left a comment

Choose a reason for hiding this comment

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

The issue is fixed in setup-cpp. The pre-installed pip executable is broken on Windows images. The workaround is to use python -m pip install package

aminya/setup-cpp#27 (comment)

I don't think this is needed anymore
https://github.com/cpp-best-practices/cpp_starter_project/actions/runs/1800095489

@aminya
Copy link
Contributor

aminya commented Feb 5, 2022

It is not setup-cpp's fault that the pre-installed Python broke on Windows images. In fact setup-cpp does not call "setup-python" until it actually needed. I do not approve of this, as this is like discarding all the things it was considered in setup-cpp and trying to re-implement them in bash.

It is not discarding everything setup-cpp is used for. Setup-cpp still does all of the hard work of finding and installing compilers across compilers.

Here I specifically meant the pip installations. As I mentioned in the above comments, it is needed to check if:

  • python paths are added to PATH on all platforms
  • if pip is installed and is up to date

@lefticus
Copy link
Member Author

lefticus commented Feb 6, 2022

I'm just going to close and remove this PR, since setup-cpp's python integration is working again.

@lefticus lefticus closed this Feb 6, 2022
@aminya aminya deleted the use_python_for_common_dependencies branch February 6, 2022 18:51
@aminya
Copy link
Contributor

aminya commented Feb 6, 2022

Worth mentioning that the pip issue is a serious problem in their launchers. It is affecting many people on Windows.
See the progress here:
pypa/pip#10875

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.

None yet

4 participants