Switch to reusable CI #54

Merged
luketainton merged 2 commits from ci into main 2023-02-28 18:15:00 +01:00
3 changed files with 57 additions and 27 deletions
Showing only changes of commit 7a6d9bfc68 - Show all commits

View File

@ -13,29 +13,6 @@ on:
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r requirements.txt && pip install -r requirements-dev.txt
- name: Lint
run: pylint --recursive=yes --output-format=parseable --output=lintreport.txt . || pylint-exit $?
continue-on-error: true
- name: Unit Test
run: |
coverage run -m pytest -v --junitxml=testresults.xml
coverage xml
sed -i 's/\/home\/runner\/work\/pypilot\/pypilot/\/github\/workspace/g' coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CLOUD }}
uses: luketainton/gha-workflows/.github/workflows/ci-python.yml@main
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

53
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: Publish
on:
push:
branches:
- "main"
paths-ignore:
- 'README.md'
- 'LICENSE.md'
- 'CHANGELOG.md'
- '.gitignore'
- 'renovate.json'
- 'CODEOWNERS'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install setuptools wheel
- name: Build wheel file
run: python setup.py bdist_wheel
- id: skip_check
uses: actions/upload-artifact@v3
with:
name: whl
path: dist/
publish:
needs: build
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Create dist folder
run: |
mkdir -p dist
- uses: actions/download-artifact@v3
with:
name: whl
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

View File

@ -3,7 +3,7 @@
## Description
IP Information Lookup Tool
## How to installx
## How to install
`pip install ipilot`
## How to use