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

ci: introduce releases #48

Merged
merged 12 commits into from
May 24, 2023
Merged

ci: introduce releases #48

merged 12 commits into from
May 24, 2023

Conversation

FoSix
Copy link
Contributor

@FoSix FoSix commented May 17, 2023

Description

A simple CI to do automatic releases and PR tests.

Motivation and Context

We need something automatic that will:

  • bump the version based on semantic releases and conventional commits
  • push a release on GitHub
  • upload the package to PyPI
  • run some tests on the package (formatting only for the moment, but more to follow)

How Has This Been Tested?

Tested on a copy of this repo

Screenshots (if appropriate)

Types of changes

chore, ci

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@FoSix FoSix requested a review from alperenkose as a code owner May 17, 2023 13:04
@FoSix FoSix linked an issue May 17, 2023 that may be closed by this pull request
4 tasks
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we consider a breaking change as Major release, while Minor release for feat and Patch release for bugfixes ?

As I can see that's the default for commit-analyzer and some other projects I have checked.
https://github.com/semantic-release/commit-analyzer/blob/master/lib/default-release-rules.js

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, but I'm following what we have for terraform modules. Until the project is mature enough let's not produce to many majors or minors. We might end up with a really high major release w/o actually introducing any features, but just by fixing our own bugs.

I would stick with the current rules until we agree that we can hit ver 1.0.0, then let's go for the default rules.

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.11
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we run on python 3.8 (as the oldest version we support) or it doesn't matter here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's the env to run the tools, not the env to run tests or the code itself. When we go for the actual pytests we will do a matrix run, against each supported Python version

id: rc
uses: cycjimmy/semantic-release-action@v3
with:
dry_run: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we explicitly set the ci: true as well? It says the following in the semantic release action github page.

ci can be used, e.g in combination with dry_run when generating the next release version in pull requests, where semantic_release would normally block the execution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, as this action discovers if it runs inside CI. For commonly used CIs this works pretty well (we use it for Terraform in the same way). You might want to use ci: true if you run it in some exotic environment.

Github sets an env variable, GITHUB_ACTION or something similar, that is being discovered by semantic release action to check if this is a CI env.

jobs:
lint_pr_title:
name: Lint PR
uses: PaloAltoNetworks/terraform-modules-vmseries-ci-workflows/.github/workflows/lint_pr_title.yml@plan-apply
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 it would be clear/better to include the step directly here instead of referencing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, as this is our common CI repo. We do not want to copy over the code. The whole idea is to have it centralised.

Copy link
Collaborator

@alperenkose alperenkose left a comment

Choose a reason for hiding this comment

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

I have put some comments/questions.

@FoSix FoSix requested a review from alperenkose May 24, 2023 08:41
@FoSix FoSix merged commit ebc01aa into main May 24, 2023
2 checks passed
@FoSix FoSix deleted the 27-add-cicd branch May 24, 2023 13:12
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.

add ci/cd
2 participants