Thanks to visit codestin.com
Credit goes to github.com

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
25 changes: 13 additions & 12 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'Develop'
name: "Develop"

on:
# Trigger the workflow on push to develop
Expand All @@ -38,13 +38,14 @@ jobs:

job_build_python_package_and_docker_container:
runs-on: ubuntu-latest
needs: [job_run_unit_tests_and_sonarqube, job_run_unit_tests_previous_versions]
needs:
[job_run_unit_tests_and_sonarqube, job_run_unit_tests_previous_versions]
permissions:
packages: write
contents: read
contents: read
steps:
- uses: actions/checkout@v3
- name: Setup Python
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: 3.11
Expand All @@ -62,7 +63,7 @@ jobs:
import semver
import os
from packaging.version import Version as PyPIVersion

def get_semver_version(pypi_url: str, package: str, include_prereleases=False) -> semver.Version:
response = requests.get(f'{pypi_url}/pypi/{package}/json')
if response.status_code != 200:
Expand Down Expand Up @@ -90,7 +91,7 @@ jobs:

test_pypi_ver = get_semver_version("https://test.pypi.org", package)
print("Current TestPyPi version: " + str(test_pypi_ver))

if next_ver == "0.0.1":
next_ver = test_pypi_ver
elif test_pypi_ver.major == next_ver.major and test_pypi_ver.minor == next_ver.minor and test_pypi_ver.patch == next_ver.patch and test_pypi_ver.prerelease != None:
Expand All @@ -99,17 +100,17 @@ jobs:
next_ver = next_ver.bump_prerelease()
print("Next version: " + str(next_ver))
print(f'::set-output name=rtdip_sdk_next_ver::{str(next_ver)}')
shell: python
shell: python
- name: Build Wheel
run: |
python -m build
env:
RTDIP_SDK_NEXT_VER: ${{ steps.next_ver.outputs.rtdip_sdk_next_ver }}
RTDIP_SDK_NEXT_VER: ${{ steps.next_ver.outputs.rtdip_sdk_next_ver }}
- name: Upload Python wheel as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: rtdip_sdk_whl
path: ./dist/*.whl
path: ./dist/*.whl
- name: Publish distribution 📦 to Test PyPI
run: |
twine upload --repository testpypi --username __token__ --password ${{ secrets.TEST_PYPI_API_TOKEN }} --verbose dist/*
Expand All @@ -120,7 +121,7 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
Expand All @@ -136,7 +137,7 @@ jobs:
rtdip/prerelease
tags: |
type=semver,pattern={{version}},prefix=api-azure-,value=${{ steps.next_ver.outputs.rtdip_sdk_next_ver }}

- name: Build and push Docker images
uses: docker/build-push-action@v3
with:
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'PR'
name: "PR"

on:
# Trigger the workflow on pull request
Expand All @@ -25,25 +25,25 @@ jobs:
uses: rtdip/core/.github/workflows/test.yml@develop

job_pr_artifact:
needs: job_run_unit_tests
defaults:
run:
shell: bash -l {0}
runs-on: ubuntu-latest
steps:
- name: Save PR number to file
env:
PR_NUMBER: ${{ github.event.number }}
PR_HEAD_REF: ${{ github.head_ref }}
PR_BASE_REF: ${{ github.base_ref }}
run: |
JSON_FMT='{"pr_number":"%s","pr_head_ref":"%s","pr_base_ref":"%s"}\n'
mkdir -p ./pr
printf "$JSON_FMT" "$PR_NUMBER" "$PR_HEAD_REF" "$PR_BASE_REF" > ./pr/pr_number
needs: job_run_unit_tests
defaults:
run:
shell: bash -l {0}
runs-on: ubuntu-latest
steps:
- name: Save PR number to file
env:
PR_NUMBER: ${{ github.event.number }}
PR_HEAD_REF: ${{ github.head_ref }}
PR_BASE_REF: ${{ github.base_ref }}
run: |
JSON_FMT='{"pr_number":"%s","pr_head_ref":"%s","pr_base_ref":"%s"}\n'
mkdir -p ./pr
printf "$JSON_FMT" "$PR_NUMBER" "$PR_HEAD_REF" "$PR_BASE_REF" > ./pr/pr_number

- name: Upload PR Json
uses: actions/upload-artifact@v3
with:
name: pr_number
path: pr/
retention-days: 5
- name: Upload PR Json
uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr/
retention-days: 5
19 changes: 9 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'Release'
name: "Release"

on:
# Trigger the workflow on release published
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: 3.11
Expand All @@ -37,9 +37,9 @@ jobs:
env:
RTDIP_SDK_NEXT_VER: ${{ github.ref_name }}
- name: Upload Python wheel as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: rtdip_sdk_whl
name: rtdip_sdk_whl
path: ./dist/*.whl
- name: Publish distribution 📦 to PyPI
run: |
Expand All @@ -54,20 +54,20 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
Expand All @@ -94,11 +94,11 @@ jobs:
runs-on: ubuntu-latest
needs: job_build_python_whl
env:
PYTHONPATH: home/runner/work/core/
PYTHONPATH: home/runner/work/core/
steps:
- uses: actions/checkout@v3

- name: Setup Python
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: 3.11
Expand All @@ -117,4 +117,3 @@ jobs:
- name: Deploy
run: |
mkdocs gh-deploy --force --remote-branch gh-pages-main

4 changes: 3 additions & 1 deletion docs/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def github_releases(owner, repo):
if release_env != "job_deploy_mkdocs_github_pages":
return "----\r\n"

github_client = Github(retry=0, timeout=5)
github_client = Github(
login_or_token=os.environ.get("GITHUB_TOKEN", None), retry=0, timeout=5
)
repo = github_client.get_repo("{}/{}".format(owner, repo))
output = "----\r\n"
for release in repo.get_releases():
Expand Down