diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..b0963c9 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,58 @@ +name: Checks + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + format: + name: Formatting (with black) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + - name: Cache python environment + id: cache-env + uses: actions/cache@v3 + with: + path: ${{ env.pythonLocation }} + key: ${{ runner.os }}-formatting-black-22.3.0 + - name: Install black + if: steps.cache-env.outputs.cache-hit != 'true' + run: | + pip install black==23.3.0 + - name: Black Format Check + run: | + black --check pydid + + test: + name: Tests + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Install poetry + run: pipx install poetry + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: poetry + - name: Install dependencies + run: poetry install + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Run pytest + run: poetry run pytest diff --git a/.github/workflows/code-quality-check.yml b/.github/workflows/code-quality-check.yml deleted file mode 100644 index 21cb2ad..0000000 --- a/.github/workflows/code-quality-check.yml +++ /dev/null @@ -1,84 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Code Quality Check - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - format: - name: Formatting (with black) - # TODO Update to latest after dropping Python 3.6 support - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.6 - uses: actions/setup-python@v2 - with: - python-version: 3.6 - - name: Cache python environment - id: cache-env - uses: actions/cache@v2 - with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-formatting-black-22.3.0 - - name: Install black - if: steps.cache-env.outputs.cache-hit != 'true' - run: | - pip install black==22.3.0 - - name: Black Format Check - run: | - black --check pydid - - test: - name: Tests - # TODO Update to latest after dropping Python 3.6 support - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Cache python environment - id: cache-env - uses: actions/cache@v2 - with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-testing-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - - name: Install poetry - if: steps.cache-env.outputs.cache-hit != 'true' - run: | - pip install poetry==1.1.5 - - name: Setup poetry environment - id: setup-poetry-env - run: | - poetry env use $(which python) - echo "::set-output name=poetry-env::$(poetry env info --path)" - - name: Cache poetry environment - id: cache-poetry - uses: actions/cache@v2 - with: - path: ${{ steps.setup-poetry-env.outputs.poetry-env }} - key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} - - name: Install dependencies - if: steps.cache-poetry.outputs.cache-hit != 'true' - run: | - poetry install - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - poetry run pytest