forked from pryorda/vmware_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (79 loc) · 2.64 KB
/
python-package.yml
File metadata and controls
85 lines (79 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# 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.13]
steps:
- uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.4.0
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
- name: integration tests
run: |
pytest tests/integration
- name: Setup ruby env
uses: ruby/setup-ruby@v1.227.0
with:
ruby-version: 2.7
- run: |
gem install pre-commit-sign
export COMMIT_MESSAGE=$(git log -1)
ruby validate-signature.rb "${COMMIT_MESSAGE}"
# Deactivated pypi publishing until adoption process is done
#
# 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 }}