From 3d8ae89ecdea44e4c2ea9fe23fa3ac4fe11fce5d Mon Sep 17 00:00:00 2001 From: Baudouin Raoult Date: Sat, 4 Dec 2021 09:36:00 +0000 Subject: [PATCH] Add testing --- .github/workflows/python-publish.yml | 56 ++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 69ca9b0..47c0588 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,21 +1,64 @@ # This workflow will upload a Python Package using Twine when a release is created # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - name: Upload Python Package on: + + push: {} + release: - types: [published] + types: [created] jobs: + quality: + name: Code QA + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: pip install black flake8 isort + - run: black --version + - run: isort --version + - run: flake8 --version + - run: isort --check . + - run: black --check . + - run: flake8 . + + checks: + strategy: + fail-fast: false + matrix: + platform: ["ubuntu-latest", "macos-latest", "windows-latest"] + python-version: ["3.7", "3.8", "3.9"] + + name: Python ${{ matrix.python-version }} on ${{ matrix.platform }} + runs-on: ${{ matrix.platform }} + needs: quality + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install + run: | + pip install pytest + pip install -e . + pip freeze + + - name: Tests + run: pytest + env: + HDA_USER: ${{ secrets.HDA_USER }} + HDA_PASSWORD: ${{ secrets.HDA_PASSWORD }} + deploy: + if: ${{ github.event_name == 'release' }} runs-on: ubuntu-latest + needs: checks steps: - uses: actions/checkout@v2 @@ -37,7 +80,6 @@ jobs: run: | python -m pip install --upgrade pip pip install setuptools wheel twine - - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}