Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving to poetry #13

Merged
merged 8 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ignore = W801,E501,W605,W504,W606,W503,E203,E266
max-line-length = 88
max-complexity = 20
select = B,C,E,F,W,T4
exclude = ./.tox/*,./build/*,./docs/conf.py
exclude = ./.tox/*,./build/*,./docs/conf.py,./.env,./.venv
73 changes: 50 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: build
on: [push, pull_request]
on:
push:
pull_request:
types: [opened, reopened]
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -13,41 +16,65 @@ jobs:
- '3.9'
- '3.10'
# container: thumbororg/thumbor-test:${{ matrix.image-tag }}
services:
localstack:
image: localstack/localstack
ports:
- "4510-4530:4510-4530"
- "4566:4566"
env:
SERVICES: s3
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Set up Python
id: setup-python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Code Climate Before Build
if: matrix.python-version == '3.10'
run: |-
curl -L -O https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
chmod +x test-reporter-latest-linux-amd64
./test-reporter-latest-linux-amd64 before-build
- name: APT Update
run: sudo apt-get update -y
- name: APT Install
run: sudo apt-get install -y python3-dev libcurl4-openssl-dev libgnutls28-dev
python3-all-dev make zlib1g-dev gcc libssl-dev build-essential
- name: Create Virtualenv
run: python3 -m venv ~/thumbor-aws
- name: Activate Virtualenv
run: source ~/thumbor-aws/bin/activate
- name: Setup
run: make setup
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install thumbor-aws
run: poetry install --no-interaction
- name: Run Unit Tests
run: make ci
run: make unit
env:
# Only used for satisfying boto
AWS_ACCESS_KEY_ID: foobar
AWS_SECRET_ACCESS_KEY: foobar
- name: Lint
run: make flake pylint
- name: Generate lcov
run: make coverage
- name: Coveralls
if: matrix.python-version == '3.10'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install --upgrade coveralls
coveralls --service=github
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
flag-name: run-${{ matrix.python-version }}
parallel: true
finish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
27 changes: 13 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ OS := $(shell uname)

setup:
@pip install -U pip
@pip install -U coverage
@pip install -e .[tests]
@poetry install

services: docker-down
@docker-compose up --remove-orphans

ci: docker-down docker-up
@./wait-for-it.sh localhost:4566 -- echo "Docker Compose is Up. Running tests..."
@coverage run -m pytest tests && coverage xml && mv coverage.xml cobertura.xml
coverage:
@poetry run coverage report -m --fail-under=75
@poetry run coverage lcov

ci: unit coverage

docker-up:
@docker-compose up --remove-orphan -d
Expand All @@ -27,24 +28,22 @@ test:
@$(MAKE) flake

unit:
@pytest --cov=thumbor_aws tests/
@poetry run pytest --cov=thumbor_aws tests/

sequential-unit:
@pytest -sv --junit-xml=test-results/unit/results.xml --cov=thumbor_aws tests/
@poetry run pytest -sv --cov=thumbor_aws tests/

format:
@black .
@poetry run black .

flake:
@flake8 --config .flake8
@poetry run flake8 --config .flake8

pylint:
@pylint thumbor_aws tests
@poetry run pylint thumbor_aws tests

run:
@thumbor -c thumbor.conf -l debug
@poetry run thumbor -c thumbor.conf -l debug

publish:
@python setup.py sdist
@twine upload dist/*
@rm -rf dist/
@poetry publish --build
8 changes: 0 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ services:
ports:
- "4510-4530:4510-4530"
- "4566:4566"
- "4571:4571"
environment:
- SERVICES=${SERVICES-s3}
- DEBUG=${DEBUG-}
- DATA_DIR=${DATA_DIR-}
- LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-}
- HOST_TMP_FOLDER=${TMPDIR:-/tmp/}localstack
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
Loading