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

move to gh actions #29

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
116 changes: 0 additions & 116 deletions .circleci/config.yml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
on:
push:
branches: [ "master" ]
tags:
- v*
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install .[dev]
pip install .[optional]
pip install flake8
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# The GitHub editor is 127 chars wide
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
- name: pylint
run: pylint pytest_lockable
- name: Build coverage file
run: |
python3 -m coverage run --source pytest_lockable -m xmlrunner discover -s tests --output-file results.xml
python3 -m coverage xml -o coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: run example
working-directory: example
run: |
pytest --allocation_hostname localhost -s --allocation_lock_folder .
- name: install release deps
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
run: |
pip install wheel twine
python setup.py sdist
python setup.py bdist_wheel
- name: upload to pypi
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
env:
TWINE_USERNAME: "${{secrets.TWINE_USERNAME}}"
TWINE_PASSWORD: "${{secrets.TWINE_PASSWORD}}"
run: |
export PATH=$HOME/.local/bin:$PATH;
twine upload dist/*
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
'lockable>=0.8.0,<0.9.0'
],
extras_require={ # Optional
'dev': ['nose', 'coveralls', 'pylint', 'coverage'],
'dev': ['coveralls', 'pylint', 'coverage', 'unittest-xml-reporting'],
'optional': ['pytest-metadata']
},

Expand Down
9 changes: 9 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sonar.projectKey=jupe_pytest-lockable
sonar.organization=jupe

# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=pytest-lockable
sonar.sources=pytest_lockable
sonar.tests=tests
sonar.python.coverage.reportPaths=coverage.xml
sonar.python.xunit.reportPath=results.xml