-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from wavefrontHQ/austinov/update_actions
Update GitHub Actions Workflows.
- Loading branch information
Showing
8 changed files
with
170 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Lint & Test | ||
|
||
inputs: | ||
python_version: | ||
default: '3.10' | ||
type: string | ||
input_pkg_name: | ||
required: true | ||
type: string | ||
extra_packages: | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set up Python ${{ inputs.python_version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ inputs.python_version }} | ||
- name: Install Latest pip and setuptools | ||
run: python -m pip install -U pip setuptools wheel | ||
shell: bash | ||
- name: Install Linters | ||
run: | | ||
python -m pip install -U flake8 flake8-colors | ||
python -m pip install -U flake8-import-order pep8-naming | ||
python -m pip install -U pydocstyle pylint | ||
shell: bash | ||
- name: Install Extra Dependencies ${{ inputs.extra_packages }} | ||
run: python -m pip install -U ${{ inputs.extra_packages }} | ||
shell: bash | ||
- name: Run Flake8 Checks | ||
run: python -m flake8 | ||
shell: bash | ||
- name: Run PyLint Checks on ${{ inputs.input_pkg_name }} | ||
run: python -m pylint -d duplicate-code ${{ inputs.input_pkg_name }} | ||
shell: bash | ||
- name: PyDocStyle | ||
run: python -m pydocstyle | ||
shell: bash | ||
- name: Execute Unit Tests | ||
run: python -m unittest discover | ||
shell: bash | ||
- name: Check Version Updated in setup.py Before Merging | ||
# if: ${{ github.event_name == 'pull_request' }} | ||
run: | | ||
test -n "$(git diff -G version= origin/master HEAD -- setup.py)" || \ | ||
exit "Package version in setup.py must be incremented before merge." | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Set Global Environment Variables | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
package_name: | ||
value: 'wavefront_sdk' | ||
requirements: | ||
value: 'Deprecated requests tdigest' | ||
|
||
jobs: | ||
debug: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "This job is supposed to set environment variables for others." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Linters & Tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
workflow_call: | ||
inputs: | ||
env_yml: | ||
default: ./.github/workflows/env.yml | ||
type: string | ||
|
||
jobs: | ||
setenv: | ||
uses: ./.github/workflows/env.yml | ||
execute: | ||
name: Check Code & Run Tests | ||
needs: setenv | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# TODO: Enable Windows | ||
# https://jira.eng.vmware.com/browse/MONIT-30833 | ||
os: [macos-latest, ubuntu-latest] # , windows-latest] | ||
python_version: ['3.7', '3.8', '3.9', '3.10'] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ./.github/actions/lint_n_test | ||
with: | ||
python_version: ${{ matrix.python_version }} | ||
input_pkg_name: ${{ needs.setenv.outputs.package_name }} | ||
extra_packages: ${{ needs.setenv.outputs.requirements }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Upload Python Package Onto TestPyPI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_call: | ||
inputs: | ||
env_yml: | ||
default: ./.github/workflows/env.yml | ||
type: string | ||
|
||
jobs: | ||
setenv: | ||
uses: ./.github/workflows/env.yml | ||
execute: | ||
name: Prepare and Publish Package | ||
needs: setenv | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ./.github/actions/lint_n_test | ||
with: | ||
input_pkg_name: ${{ needs.setenv.outputs.package_name }} | ||
extra_packages: ${{ format('{0} build', needs.setenv.outputs.requirements) }} | ||
- name: Build Package | ||
run: python -m build | ||
- name: Publish Package to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish the Package onto PyPI | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
workflow_call: | ||
inputs: | ||
env_yml: | ||
default: ./.github/workflows/env.yml | ||
type: string | ||
|
||
jobs: | ||
setenv: | ||
uses: ./.github/workflows/env.yml | ||
execute: | ||
name: Prepare and Publish Package | ||
needs: setenv | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ./.github/actions/lint_n_test | ||
with: | ||
input_pkg_name: ${{ needs.setenv.outputs.package_name }} | ||
extra_packages: ${{ format('{0} build', needs.setenv.outputs.requirements) }} | ||
- name: Build Package | ||
run: python -m build | ||
- name: Publish Package on PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters