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

NH-26173 Add sdist and wheel extension checks at package build #75

Merged
merged 22 commits into from
Nov 10, 2022

Conversation

tammy-baylis-swi
Copy link
Contributor

Add sdist and wheel extension checks at package build as part of the make package target. make package is called locally or by GH workflows via package_solarwinds_apm (by all of TestPyPI, PackageCloud, PyPI publishes). This way, the extensions are checked immediately after sdist/wheel creation and exit 1 if they fail. For the GH workflows, this should stop everything before the actual upload step.

To implement this I've split up the existing install test bash scripts so that the check sdist/wheel calls can be accessed separately by Makefile without doing the full install, instrument, and startup checks (is that what we want?)

I've been tested this locally with:

  1. ./run_docker_dev then make package
  2. cd tests/docker/install and MODE=local docker-compose up py3.7-install-alpine3.13
  3. Same as (2) but MODE=testpypi

So far this hasn't caught anything unusual like what happened with solarwinds-apm 0.2.0 publish to PyPI.

I think I'll have to wait until our next TestPyPI/PackageCloud/PyPI publish to make sure this works there too.

Bonus: I've also updated some of the GH workflows themselves. The PyPI release PRs will be a bit more informative than this one and will be drafts because most times an additional commit for changelog update is needed. The publish and release creation workflow should also be a bit more clean than this run; the 2nd action now has a name and the third action gives some separation.

Please let me know what you think!

cheempz
cheempz previously approved these changes Nov 10, 2022
Copy link
Contributor

@cheempz cheempz left a comment

Choose a reason for hiding this comment

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

LGTM and your approach of splitting them up makes sense to me @tammy-baylis-swi! I left some minor comments, none are blockers :)

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/package_solarwinds_apm
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the Create draft release job need these above steps to checkout the repo (maybe?) and build the package (seems no?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, package_solarwinds_apm isn't needed. Removed in 0f755db.

I thiiiink the checkout isn't needed either for gh release create if we specify --repo. This doc doesn't make it super clear to me: https://cli.github.com/manual/gh_release_create. But this blog (haha) says:

In fact GitHub releases created by any means trigger the package build and upload workflow. For example I could run GitHub CLI’s gh release create command from any directory on my local machine. This doesn’t require me to have a local copy of the project or to have anything setup locally other than GitHub CLI itself:

$ gh release create --repo seanh/gha-python-packaging-demo --generate-notes 0.0.1
https://github.com/seanh/gha-python-packaging-demo/releases/tag/0.0.1

So I'm going to give this a try and report back!

Copy link
Contributor Author

@tammy-baylis-swi tammy-baylis-swi Nov 10, 2022

Choose a reason for hiding this comment

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

...Actually don't think I can test this as is until next release. Changed in 70e469b and trying something else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do need the checkout! This run failed: https://github.com/appoptics/solarwinds-apm-python/actions/runs/3441033073/jobs/5740153872

Run git config user.name "GitHub Actions"
  git config user.name "GitHub Actions"
  git config user.email noreply@github.com
  shell: /usr/bin/bash -e {0}
  env:
    RELEASE_NAME: rel-0.[2](https://github.com/appoptics/solarwinds-apm-python/actions/runs/3441033073/jobs/5740153872#step:2:2).2
fatal: not in a git directory
Error: Process completed with exit code 12[8](https://github.com/appoptics/solarwinds-apm-python/actions/runs/3441033073/jobs/5740153872#step:2:9).

- name: Open Pull Request for version bump
run: gh pr create --title "Update agent version to ${{ env.RELEASE_VERSION }}" --body "Upgrade agent version"
- name: Open draft Pull Request for version bump
run: gh pr create --draft --title "solarwinds-apm ${{ env.RELEASE_VERSION }}" --body "For PyPI release of solarwinds-apm ${{ env.RELEASE_VERSION }}. See also CHANGELOG.md."
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!


if [ -z "$PIP_INSTALL" ]; then
echo -e "PIP_INSTALL not specified."
echo -e "Using APM_ROOT to use one existing cp38 x86_64 wheel"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: may be clearer to say something like "only testing the cp38 x86_64 wheel under ${APM ROOT}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good! Changed in 5496b3b

@cd $(CURR_DIR)

# Build and check the full Python agent distribution (sdist and wheels)
package: sdist check-sdist-local manylinux-wheels check-wheel-local
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor, the check-* tasks already depend on the sdist and manylinux-wheels tasks, so don't need them in the package task... or if it seems clearer, the check-* tasks don't have them as deps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes good call! Addressed in 5496b3b

@tammy-baylis-swi
Copy link
Contributor Author

Thanks @cheempz ! I've addressed your comments. We will have to keep the checkout for the Create_release. Please let me know if anything else!

Copy link
Contributor

@cheempz cheempz left a comment

Choose a reason for hiding this comment

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

Good to know, thanks for the revisit @tammy-baylis-swi!

@tammy-baylis-swi tammy-baylis-swi merged commit bc24110 into main Nov 10, 2022
@tammy-baylis-swi tammy-baylis-swi deleted the NH-26173-add-sdist-check branch November 10, 2022 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants