2022-07-10 14:57:40 +01:00
|
|
|
name: Merge to main
|
2022-05-02 20:08:27 +01:00
|
|
|
on:
|
|
|
|
push:
|
2022-06-25 22:43:52 +01:00
|
|
|
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
|
2022-06-08 17:02:11 +00:00
|
|
|
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: |
|
2022-07-10 17:27:44 +01:00
|
|
|
coverage run -m py.test -v --junitxml=testresults.xml
|
2022-07-10 14:57:40 +01:00
|
|
|
coverage xml
|
2022-07-10 17:27:44 +01:00
|
|
|
- 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:
|
2022-07-10 17:27:44 +01:00
|
|
|
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
|
2022-06-25 22:43:52 +01:00
|
|
|
- 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 }}
|