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

Publish to pypi only once in github actions #47

Merged
merged 3 commits into from
Mar 21, 2021
Merged

Conversation

pdecat
Copy link
Collaborator

@pdecat pdecat commented Mar 13, 2021

Resolves an issue introduced in #46 (comment)

@fbradyirl
Copy link
Owner

fbradyirl commented Mar 16, 2021

Do we really need both 3.7 and 3.8? HA running with only 3.8 support will still be able to install dependancies build with 3.7 just fine.

@pdecat
Copy link
Collaborator Author

pdecat commented Mar 16, 2021

The idea is to run unit tests for both python 3.7 and 3.8 but only build and publish the package with 3.8.

@fbradyirl
Copy link
Owner

I think you just need separate jobs for build and another for publish.

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

Each job will have access to the same workspace as the previous so you should be fine to only publish as py37.

@pdecat
Copy link
Collaborator Author

pdecat commented Mar 17, 2021

Hi @fbradyirl,

I think you just need separate jobs for build and another for publish.

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

Each job will have access to the same workspace as the previous so you should be fine to only publish as py37.

Well, jobs actually do not share the same workspace, only steps of the same job do:

jobs.<job_id>.steps
A job contains a sequence of tasks called steps. Steps can run commands, run setup tasks, or run an action in your repository, a public repository, or an action published in a Docker registry. Not all steps run actions, but all actions run as a step. Each step runs in its own process in the runner environment and has access to the workspace and filesystem.

If jobs shared the same workspace, that would cause issues when jobs are executing concurrently.

See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps

Sharing artifacts between jobs requires to upload them in one job then download them in a following job.

See https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#passing-data-between-jobs-in-a-workflow
and https://docs.github.com/en/actions/learn-github-actions/migrating-from-circleci-to-github-actions#persisting-data-between-jobs
and https://docs.github.com/en/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions#sharing-files-between-jobs-and-workflows

That's why I separated the test phases as concurrent jobs from the build and publish phase as a single job.

WDYT?

@fbradyirl
Copy link
Owner

Sounds good thanks @pdecat

@pdecat pdecat force-pushed the fix_github_actions_pypi branch from f70faca to 19c77da Compare March 20, 2021 08:30
@pdecat pdecat force-pushed the fix_github_actions_pypi branch from 19c77da to f21f54d Compare March 20, 2021 08:30
@pdecat
Copy link
Collaborator Author

pdecat commented Mar 20, 2021

I pushed two changes to:

  1. fix an issue where using env in job strategy/matrix is not supported: Workflow level env does not work properly in all fields. actions/runner#480 (comment)
  2. fix an issue that caused both push and pull_request event to trigger concurrent jobs, running the same tests twice: https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662/2

@pdecat pdecat merged commit 85c57ac into master Mar 21, 2021
@pdecat pdecat deleted the fix_github_actions_pypi branch March 21, 2021 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants