Skip to content

No longer maintaining project. #162

No longer maintaining project.

No longer maintaining project. #162

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Python Package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e . -r requirements.txt -r requirements-tests.txt python-semantic-release
sudo apt-get update && sudo apt-get install -y nodejs npm && sudo npm install -g dockerfilelint
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 vmware_exporter tests --statistics
- name: Lint dockerfile
run: dockerfilelint ./Dockerfile
- name: Test with pytest
run: |
pytest --cov=. -v tests/unit
- uses: codecov/codecov-action@v1
- name: integration tests
run: |
pytest tests/integration
- name: Setup ruby env
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- run: |
gem install pre-commit-sign
export COMMIT_MESSAGE=$(git log -1)
ruby validate-signature.rb "${COMMIT_MESSAGE}"
deploy:
strategy:
matrix:
python-version: [3.7]
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: install semantic-release
run: |
pip install python-semantic-release
- name: deploy pip
run: |
git config --global user.name "semantic-release (via github actions)"
git config --global user.email "semantic-release@github-actions"
semantic-release publish
env: # Or as an environment variable
GH_TOKEN: ${{ secrets.GH_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}