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

Automatic packaging and CI test updates #386

Merged
merged 34 commits into from
Aug 9, 2022
Merged

Automatic packaging and CI test updates #386

merged 34 commits into from
Aug 9, 2022

Conversation

HGSilveri
Copy link
Collaborator

@HGSilveri HGSilveri commented Jul 11, 2022

  • Separates the requirements and dev_requirements
  • Refactors the build workflow to install only the necessary packages for each job
  • Creates a test workflow to run the unit tests across different OSs and python versions (triggered only on push events to master and develop)
  • Adds a workflow to ensure the validity of the version numbers on master and develop
  • Adds a workflow to build and publish and check stable releases to PyPI
  • Documents the release process in detail

Closes #363 .

@HGSilveri HGSilveri marked this pull request as draft July 11, 2022 08:55
@HGSilveri HGSilveri force-pushed the auto-package branch 3 times, most recently from 8ed83bb to 0a127a4 Compare July 11, 2022 09:08
@HGSilveri HGSilveri force-pushed the auto-package branch 3 times, most recently from aba4143 to d09450d Compare July 26, 2022 13:44
@HGSilveri HGSilveri force-pushed the auto-package branch 5 times, most recently from fe57438 to b295172 Compare July 27, 2022 09:13
@HGSilveri HGSilveri marked this pull request as ready for review July 29, 2022 14:07
@HGSilveri HGSilveri changed the title Automatic packaging and CI test refactoring Automatic packaging and CI test updates Jul 29, 2022
@AdrienFontaine-PASQAL
Copy link

Since I'm not familiar with Github Actions I had a quick question about the following piece of code (used for instance in .github/workflows/ci.yml):

on:
  pull_request:
  push:
    branches:
      - master
      - develop

Do we allow pushing commits directly to those branches (if so why/when)? Or are they "push protected" in a way? Maybe is this CI rule used for tagging the release commit?

The release.md only address tagging on master, so maybe the push rule is for detecting a PR that got merged?

@HGSilveri
Copy link
Collaborator Author

Since I'm not familiar with Github Actions I had a quick question about the following piece of code (used for instance in .github/workflows/ci.yml):

on:
  pull_request:
  push:
    branches:
      - master
      - develop

Do we allow pushing commits directly to those branches (if so why/when)? Or are they "push protected" in a way? Maybe is this CI rule used for tagging the release commit?

The release.md only address tagging on master, so maybe the push rule is for detecting a PR that got merged?

Hi @AdrienFontaine-PASQAL , thanks for taking the time to look into this!
Those branches are "push protected" except for collaborators with Admin rights. The "push" case will be triggered every time a PR is merged into one of these branches (which is admittedly redundant because the PR needs to pass all these tests to be merged) or on the rare occasions when an Admin does a direct push (what we want to catch).
There is no relation with tagging on this particular workflow.

Copy link

@AdrienFontaine-PASQAL AdrienFontaine-PASQAL left a comment

Choose a reason for hiding this comment

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

As far as my expertise go on Github Actions this sounds good to me.

@CdeTerra
Copy link
Collaborator

CdeTerra commented Aug 8, 2022

Great work, and thanks for the nice and clear documentation! I only have a few tiny comments.

release.md Outdated Show resolved Hide resolved
release.md Outdated Show resolved Hide resolved
release.md Show resolved Hide resolved
.github/workflows/pulser-setup/action.yml Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
- name: Type check with mypy
run: mypy
test:
if: github.event_name != 'push'
Copy link
Collaborator

@MatthieuMoreau0 MatthieuMoreau0 Aug 9, 2022

Choose a reason for hiding this comment

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

Question: Why do we not run test on push events ? Not super familiar with all the event types in github actions, so maybe these test are triggered through a merge_request event or something which would be redundant with the push event

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just because I wrote a more complete test workflow to run only on push to the protected branches, so these would be redundant.

run: |
version="$(head -1 VERSION.txt)"
python -c "import pulser; assert pulser.__version__ == '$version'"
grep -e pytest dev_requirements.txt | sed 's/ //g' | xargs pip install
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: As per my other comment, having specific extras_require would have the extra benefit to avoid duplicating this grep magic several times

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True indeed

Copy link
Contributor

@anneclairelh anneclairelh left a comment

Choose a reason for hiding this comment

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

These are mostly questions about your overall flow (therefore hopefully complementary to Adrien and Matthieu's review ) :)

.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
.github/workflows/publish.yml Show resolved Hide resolved
.github/workflows/publish.yml Show resolved Hide resolved
Comment on lines +5 to +7
branches:
- master
- develop
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it mean that these tests would not run on feature branches before merging to develop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Exactly. I figured they are a bit excessive to be ran on every update to a PR. There are still tests in the ci.yml that should catch everything, these tests are run just to really ensure we didn't miss anything related to a specifc OS or python version.
On the rare case something fails, we can always follow up with a fix.

@HGSilveri HGSilveri merged commit 4ecad78 into develop Aug 9, 2022
@HGSilveri HGSilveri deleted the auto-package branch August 9, 2022 16:40
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.

Automatic packaging
5 participants