70 lines
1.9 KiB
YAML
Raw Normal View History

2022-07-10 14:57:40 +01:00
name: Merge to main
2022-05-02 20:08:27 +01:00
on:
push:
branches:
2022-07-10 14:57:40 +01:00
- main
2022-05-02 20:08:27 +01:00
jobs:
2022-07-10 14:57:40 +01:00
coverage:
2022-05-02 20:08:27 +01:00
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
2022-07-10 17:30:41 +01:00
with:
fetch-depth: 0
2022-05-02 20:08:27 +01:00
- name: Setup Python
uses: actions/setup-python@v4
2022-05-02 20:08:27 +01:00
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r requirements.txt && pip install -r requirements-dev.txt
- name: Run test suite
2022-07-10 14:57:40 +01:00
run: |
coverage run -m py.test -v --junitxml=testresults.xml
2022-07-10 14:57:40 +01:00
coverage xml
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
2022-07-10 14:57:40 +01:00
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2022-06-25 22:27:01 +01:00
build:
2022-07-10 14:57:40 +01:00
needs: coverage
2022-06-25 22:27:01 +01:00
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup Python 3.10
2022-06-25 22:27:01 +01:00
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install build dependencies
run: 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:
2022-06-25 22:49:32 +01:00
- name: Create dist folder
2022-07-10 14:57:40 +01:00
run: mkdir -p dist
2022-06-25 22:49:32 +01:00
- uses: actions/download-artifact@v3
with:
name: whl
path: dist
2022-06-25 22:27:01 +01:00
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}