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

Fix the CI/CD pipeline #236

Merged
merged 3 commits into from
Nov 30, 2021
Merged
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
116 changes: 38 additions & 78 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,21 @@ jobs:
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages for Linting"
run: "pip install --upgrade pip wheel invoke toml"
- name: "Install Poetry Packages"
run: |
pip install poetry
poetry config virtualenvs.create false
poetry config installer.parallel false
poetry install --no-interaction --no-ansi --no-root
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this to include Python pinned to version 3.9.7?

Copy link
Contributor

Choose a reason for hiding this comment

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

- name: "Setup environment"
  uses: "networktocode/gh-action-setup-poetry-environment@v2"
    with:
      python-version: "3.9.7" 

- name: "Linting: Black"
run: "invoke black"
run: "poetry run invoke black"
bandit:
runs-on: "ubuntu-20.04"
env:
INVOKE_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages for Linting"
run: "pip install --upgrade pip wheel invoke toml"
- name: "Install Poetry Packages"
run: |
pip install poetry
poetry config virtualenvs.create false
poetry config installer.parallel false
poetry install --no-interaction --no-ansi --no-root
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
- name: "Linting: Bandit"
run: "invoke bandit"
run: "poetry run invoke bandit"
needs:
- "black"
pydocstyle:
Expand All @@ -55,20 +35,10 @@ jobs:
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages for Linting"
run: "pip install --upgrade pip wheel invoke toml"
- name: "Install Poetry Packages"
run: |
pip install poetry
poetry config virtualenvs.create false
poetry config installer.parallel false
poetry install --no-interaction --no-ansi --no-root
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
- name: "Linting: pydocstyle"
run: "invoke pydocstyle"
run: "poetry run invoke pydocstyle"
needs:
- "black"
flake8:
Expand All @@ -91,7 +61,7 @@ jobs:
poetry config installer.parallel false
poetry install --no-interaction --no-ansi --no-root
- name: "Linting: flake8"
run: "invoke flake8"
run: "poetry run invoke flake8"
needs:
- "black"
yamllint:
Expand All @@ -101,35 +71,21 @@ jobs:
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages for Linting"
run: "pip install --upgrade pip wheel invoke toml"
- name: "Install Poetry Packages"
run: |
pip install poetry
poetry config virtualenvs.create false
poetry config installer.parallel false
poetry install --no-interaction --no-ansi --no-root
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
- name: "Linting: yamllint"
run: "invoke yamllint"
run: "poetry run invoke yamllint"
needs:
- "black"
build:
runs-on: "ubuntu-20.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages for Setup"
run: "pip install invoke poetry toml"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
- name: "Build Container"
run: "invoke build-image"
run: "poetry run invoke build-image"
needs:
- "bandit"
- "pydocstyle"
Expand All @@ -140,16 +96,12 @@ jobs:
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages for Linting"
run: "pip install invoke poetry toml"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
- name: "Build Container"
run: "invoke build-image"
run: "poetry run invoke build-image"
- name: "Linting: Pylint"
run: "invoke pylint"
run: "poetry run invoke pylint"
needs:
- "build"
pytest:
Expand All @@ -163,16 +115,12 @@ jobs:
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages for Linting"
run: "pip install invoke poetry toml"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
- name: "Build Container"
run: "invoke build-image"
run: "poetry run invoke build-image"
- name: "Run Tests"
run: "invoke pytest"
run: "poetry run invoke pytest"
needs:
- "pylint"
integration_nautobot:
Expand Down Expand Up @@ -284,9 +232,9 @@ jobs:
with:
python-version: "3.9"
- name: "Install Python Packages for Publishing"
run: "pip install invoke poetry toml"
run: "pip install poetry"
- name: "Set env"
run: "echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})"
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
- name: "Run Poetry Version"
run: "poetry version $RELEASE_VERSION"
- name: "Run Poetry Build"
Expand All @@ -311,6 +259,18 @@ jobs:
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages"
run: "pip install poetry"
- name: "Set env"
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
- name: "Run Poetry Version"
run: "poetry version $RELEASE_VERSION"
- name: "Run Poetry Build"
run: "poetry build"
- name: "Push to PyPI"
uses: "pypa/gh-action-pypi-publish@release/v1"
with:
Expand Down