Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @mure @spanglerco @cameronwaterman
* @rbell517 @spanglerco @cameronwaterman
45 changes: 36 additions & 9 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Python package

on:
push:
branches: [master, main]
branches: [master, main, '*.x']
pull_request:
branches: [master, main]
branches: [master, main, '*.x']

jobs:
build:
Expand All @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry==1.8.5
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -30,31 +30,58 @@ jobs:
- run: poetry run poe types
release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
needs: [build]
if: >
github.event_name == 'push' &&
(
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main' ||
(
startsWith(github.ref, 'refs/heads/') &&
endsWith(github.ref, '.x')
)
)
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Install poetry
run: pipx install poetry
run: pipx install poetry==1.8.5
- uses: actions/setup-python@v4
with:
python-version: 3.8
cache: "poetry"
- run: poetry install
- name: Semantic release
run: |
pip install python-semantic-release==7.34.6
pip install python-semantic-release==10.6.1
git config --global user.name "github-actions"
git config --global user.email "action@github.com"
semantic-release version
env:
# To generate a new token use the following guide, providing access to the "repo" scope.
# https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
# Once you update the secret on the repo, ensure you update the master/main protected branch policy
# to allow your user permission to "bypass required pull requests".
GH_TOKEN: ${{secrets.GH_TOKEN}}
- name: Publish package distributions to PyPI using Twine
# Only publish if Semantic release built packages under "dist/"; hashFiles returns '' when no files match the given pattern.
if: hashFiles('dist/*') != ''
run: |
pip install twine==6.1.0
python -m twine upload dist/*
env:
TWINE_USERNAME: ${{secrets.REPOSITORY_USERNAME}}
TWINE_PASSWORD: ${{secrets.PYPI_PASSWORD}}
- name: Semantic release - Publish package distributions to GitHub Releases
# Only publish if Semantic release built packages under "dist/"; hashFiles returns '' when no files match the given pattern.
if: hashFiles('dist/*') != ''
run: |
semantic-release publish
env:
# To generate a new token use the following guide, providing access to the "repo" scope.
# https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
# Once you update the secret on the repo, ensure you update the master/main protected branch policy
# to allow your user permission to "bypass required pull requests".
GH_TOKEN: ${{secrets.GH_TOKEN}}
REPOSITORY_USERNAME: ${{secrets.REPOSITORY_USERNAME}}
REPOSITORY_PASSWORD: ${{secrets.PYPI_PASSWORD}}
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
os: ubuntu-lts-latest
tools:
python: "3.8"
python: "3.10"

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@ To contribute to this project, it is recommended that you follow these steps:
6. Send a GitHub Pull Request to the main repository's master branch. GitHub
Pull Requests are the expected method of code collaboration on this project.

## Patching older versions
1. Contact the [repository owners](/.github/CODEOWNERS) for approval and ask them to create a
branch based on the commit that was used to generate the release to be patched.
The naming for this branch should follow this guideline:
- "1.x", if we want to create a new minor version for version 1
- "1.3.x", if we want to create a new patch version for version 1.3

2. Fork the repository on GitHub.
3. Fetch and check out the maintenance branch created in step 1, then create and
switch to a working branch from it.
4. Run the unit tests on your system (see Testing section). At this point,
if any tests fail, do not begin development. Try to investigate these
failures. If you're unable to do so, report an issue through our
[GitHub issues page](https://github.com/ni/nisystemlink-clients-python/issues).
5. Write new tests that demonstrate your bug or feature. Ensure that these
new tests fail.
6. Make your change.
7. Run all the unit tests again (which include the tests you just added),
and confirm that they all pass.
8. Send a GitHub Pull Request to the main repository branch that was created as a result of step 1. GitHub
Pull Requests are the expected method of code collaboration on this project.

## Testing

Before running any tests, you must have a supported version of Python (3.8+) and [Poetry](https://python-poetry.org/docs/) installed locally.
Expand Down
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,18 @@ markers = [
exclude = ".*\\.pyi"

[tool.semantic_release]
branch = "master"
version_toml = ["pyproject.toml:tool.poetry.version"]
build_command = "poetry build"

# Allow releasing from the `master` branch.
[tool.semantic_release.branches.master]
match = "^master$"

# Allow releasing from maintenance branches named "1.x", "1.2.x", etc.
[tool.semantic_release.branches.maintenance]
match = "^\\d+(?:\\.\\d+)*\\.x$"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading