Skip to content

Commit

Permalink
Merge pull request #216 from Whist-Team/poetry
Browse files Browse the repository at this point in the history
Switch to Poetry build system
  • Loading branch information
iTitus authored Jul 18, 2022
2 parents 1d6ba67 + 7d06bef commit 2af523c
Show file tree
Hide file tree
Showing 81 changed files with 1,346 additions and 500 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
exclude =
.git
.github
.venv
__pycache__
.eggs
*.egg
Expand Down
3 changes: 3 additions & 0 deletions .github/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: "My CodeQL config"
paths:
- whist_core
17 changes: 9 additions & 8 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
name: "CodeQL"

on:
push:
branches: [ main, develop ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '39 22 * * 0'

#push:
# branches: [ main, develop ]
#pull_request:
# # The branches below must be a subset of the branches above
# branches: [ main ]
#schedule:
# - cron: '39 22 * * 0'
K
jobs:
analyze:
name: Analyze
Expand Down Expand Up @@ -48,6 +48,7 @@ jobs:
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,33 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ 3.9, '3.10']
python-version: [ 3.9 ]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v3
- name: Install poetry
uses: snok/install-poetry@v1

- name: Load cached venv
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install --upgrade -r requirements/lint.txt
pip install --upgrade -r requirements/requirements.txt
- name: Lint everything with flake8
run: |
flake8 whist --count --show-source --statistics
run: poetry install --no-interaction

- name: Lint sources with flake8
run: poetry run flake8 whist_core --count --show-source --statistics

- name: Lint sources with pylint
run: |
pylint whist
run: poetry run pylint whist_core
25 changes: 15 additions & 10 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,28 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3

- name: Install poetry
uses: snok/install-poetry@v1

- name: Load cached venv
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install .[testing]
run: poetry install --no-interaction

- name: Test with pytest
run: |
python -m pytest --cov=whist --cov-report=xml
run: poetry run python -m pytest --cov=whist_core --cov-report=xml

- name: Upload to codecoverage
uses: codecov/codecov-action@v3
with:
Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,29 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install poetry
uses: snok/install-poetry@v1

- name: Load cached venv
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel twine
pip install --upgrade -r requirements/lint.txt
pip install --upgrade -r requirements/requirements.txt
- name: Build and publish
run: poetry install --no-interaction

- name: Build project
run: poetry build

- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
Loading

0 comments on commit 2af523c

Please sign in to comment.