Skip to content

.github/workflows/workflow.yaml #226

.github/workflows/workflow.yaml

.github/workflows/workflow.yaml #226

Workflow file for this run

on:
push:
schedule:
- cron: '0 3 * * 6'
jobs:
check:
name: "Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.12"
- name: 'Install Dependencies'
run: |
python -m pip install --upgrade pip
python -m pip install pipenv
pipenv install --system --dev
- name: 'Check Formatting (flake8)'
run: flake8 nessclient nessclient_tests
- name: 'Check Formatting (black)'
run: black --check nessclient nessclient_tests
- name: 'Check Types'
run: python3 -m mypy --strict nessclient
build:
name: "Build and Test"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11, 3.12]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: 'Install Dependencies'
run: |
python -m pip install --upgrade pip
python -m pip install pipenv wheel
pipenv install --system --dev
- name: 'Run Tests (with coverage)'
run: |
coverage run --source=nessclient -m pytest
- uses: codecov/codecov-action@v2
if: ${{ matrix.python-version == '3.12' }}
- name: "Build"
run: |
sed -i "s/0.0.0-dev/$(git describe --tags --exact-match)/" nessclient/__init__.py
python setup.py sdist bdist_wheel
- uses: actions/upload-artifact@v2
# Only publish artifacts from Python latest build.
if: ${{ matrix.python-version == '3.12' }}
with:
name: dist
path: dist/
if-no-files-found: error
release:
name: "Release 🚀"
runs-on: ubuntu-latest
needs:
- build
- check
if: startsWith(github.ref, 'refs/tags')
permissions:
id-token: write
contents: write
steps:
- uses: actions/[email protected]
with:
name: dist
path: dist/
- name: Release to PyPi 📦
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: dist/*