2020-01-17 16:41:18 +01:00
|
|
|
name: Test & publish
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
release:
|
|
|
|
types: [created]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Python ${{ matrix.python-version }} / ${{ matrix.os }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
max-parallel: 9
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2020-01-17 16:46:24 +01:00
|
|
|
python-version: [3.7, 3.8]
|
2020-01-17 16:41:18 +01:00
|
|
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
|
|
|
|
|
|
steps:
|
2020-02-28 20:43:56 +01:00
|
|
|
- uses: actions/checkout@v2
|
2020-01-17 16:41:18 +01:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2020-02-28 20:43:56 +01:00
|
|
|
uses: actions/setup-python@v1.1.1
|
2020-01-17 16:41:18 +01:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install poetry
|
|
|
|
poetry install
|
|
|
|
- name: Test with pytest
|
|
|
|
run: |
|
2020-02-28 20:43:56 +01:00
|
|
|
poetry run coverage run --source=ofx_processor -m pytest --color=yes
|
|
|
|
poetry run coverage xml
|
|
|
|
- name: Coverage report upload
|
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
with:
|
|
|
|
name: coverage_${{ matrix.os }}_${{ matrix.python-version }}
|
|
|
|
path: coverage.xml
|
|
|
|
|
|
|
|
sonarCloudTrigger:
|
|
|
|
name: SonarCloud Trigger
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Download coverage report
|
|
|
|
uses: actions/download-artifact@v1
|
|
|
|
with:
|
|
|
|
name: coverage_ubuntu-latest_3.8
|
|
|
|
path: coverage-reports
|
|
|
|
- name: SonarCloud Scan
|
|
|
|
uses: sonarsource/sonarcloud-github-action@v1.1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
2020-01-17 16:41:18 +01:00
|
|
|
|
|
|
|
publish:
|
|
|
|
name: Publish to PyPI
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
if: github.event_name == 'release'
|
|
|
|
steps:
|
2020-02-28 20:43:56 +01:00
|
|
|
- uses: actions/checkout@v2
|
2020-01-17 16:41:18 +01:00
|
|
|
- name: Set up Python
|
2020-02-28 20:43:56 +01:00
|
|
|
uses: actions/setup-python@v1.1.1
|
2020-01-17 16:41:18 +01:00
|
|
|
with:
|
|
|
|
python-version: '3.8'
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install poetry
|
|
|
|
- name: Build and publish
|
|
|
|
env:
|
|
|
|
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
|
|
|
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
poetry publish --build -u $PYPI_USERNAME -p $PYPI_PASSWORD
|