ofx-processor/.github/workflows/package.yml

80 lines
2.1 KiB
YAML
Raw Normal View History

2020-01-17 16:41:18 +01:00
name: Test & publish
on:
push:
release:
2020-09-01 19:38:21 +02:00
types: [published]
2020-01-17 16:41:18 +01:00
jobs:
2020-02-29 13:38:50 +01:00
sonarCloudTrigger:
name: SonarCloud Trigger
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
2020-02-29 14:02:52 +01:00
- run: git fetch --prune --unshallow
2020-02-29 13:38:50 +01:00
- name: Set up Python
uses: actions/setup-python@v1.1.1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Test with pytest
run: |
poetry run coverage run --source=ofx_processor -m pytest --color=yes
poetry run coverage xml
- 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
build:
name: Python ${{ matrix.python-version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 9
fail-fast: false
matrix:
python-version: [3.7, 3.8]
2020-01-17 16:41:18 +01:00
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
2020-01-17 16:41:18 +01:00
- name: Set up Python ${{ matrix.python-version }}
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-29 13:38:50 +01:00
poetry run pytest --color=yes
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:
- uses: actions/checkout@v2
2020-01-17 16:41:18 +01:00
- name: Set up Python
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