From 20821944ccb87a78b45872826fd033af6f059989 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Fri, 19 Jan 2024 10:58:47 +0100 Subject: [PATCH] Remove tox and use Github Actions (#453) --- .github/workflows/tests.yml | 82 ++++++++++++++++++------------------- .gitignore | 1 - Makefile | 9 ++-- pyproject.toml | 1 - tox.ini | 31 -------------- 5 files changed, 45 insertions(+), 79 deletions(-) delete mode 100644 tox.ini diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b0c613e..a4870ff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,56 +1,56 @@ -on: - push: - branches: - - master - pull_request: +name: Run CI checks + +on: pull_request + +permissions: + contents: read -name: Unit Testing jobs: - chore: - name: Unit Tests + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + + - name: Install dependencies + run: make install + + - name: Run linting and formatting checks + run: make lint + + unit-tests: runs-on: ubuntu-latest strategy: matrix: - toxenv: [py38, lint, functional] - include: - - toxenv: py38 - python-version: "3.8" - - toxenv: lint - python-version: "3.X" - - toxenv: functional - python-version: "3.11" - + python-version: ["3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: pyproject.toml - - name: Install virtualenv - run: | - pip install virtualenv - virtualenv --python=python3 .venv + - name: Run unit tests + run: make test - - name: Print environment - run: | - source .venv/bin/activate - python --version - pip --version + functional-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 - - name: Install dependencies - run: | - source .venv/bin/activate - pip install tox + - uses: actions/setup-python@v4 + with: + python-version: "3.11" - - name: Run Kinto - if: matrix.toxenv == 'functional' - run: | - source .venv/bin/activate - make run-kinto & sleep 5 + - name: Install dependencies + run: make install - - name: Tox - run: | - source .venv/bin/activate - tox -e ${{ matrix.toxenv }} + - name: Run kinto + run: make run-kinto & sleep 5 + - name: Run functional tests + run: make functional diff --git a/.gitignore b/.gitignore index 0a88548..5cac721 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .cache -.tox .coverage .pytest_cache .ruff_cache diff --git a/Makefile b/Makefile index e7b2818..2ef226d 100644 --- a/Makefile +++ b/Makefile @@ -28,16 +28,15 @@ format: install requirements.txt: requirements.in pip-compile requirements.in -tests-once: install +tests: test +tests-once: test +test: install $(VENV)/bin/py.test --cov-report term-missing --cov-fail-under 100 --cov kinto_emailer -tests: install - $(VENV)/bin/tox - clean: find src/ -name '*.pyc' -delete find src/ -name '__pycache__' -type d -exec rm -fr {} \; - rm -rf .tox $(VENV) mail/ *.egg-info .pytest_cache .ruff_cache .coverage build dist + rm -rf $(VENV) mail/ *.egg-info .pytest_cache .ruff_cache .coverage build dist run-kinto: install $(VENV)/bin/kinto start --ini tests/config/kinto.ini diff --git a/pyproject.toml b/pyproject.toml index 36124fa..5a9f08c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,6 @@ dev = [ "pytest", "pytest-cache", "pytest-cov", - "tox", "webtest", ] diff --git a/tox.ini b/tox.ini deleted file mode 100644 index ee3d3f2..0000000 --- a/tox.ini +++ /dev/null @@ -1,31 +0,0 @@ -[tox] -envlist = py38,kinto-master,lint,functional -skip_missing_interpreters = True - -[testenv] -commands = - python --version - py.test tests --cov-report term-missing --cov-fail-under 100 --cov kinto_emailer {posargs} -deps = -r requirements.txt -extras = dev - -[testenv:kinto-master] -commands = - python --version - py.test tests --cov-report term-missing --cov-fail-under 100 --cov kinto_emailer {posargs} -deps = - -r requirements.txt - https://github.com/Kinto/kinto/tarball/master -extras = dev - -[testenv:lint] -commands = - ruff check src tests validate_setup.py - ruff format --check src tests validate_setup.py -deps = -r requirements.txt -extras = dev - -[testenv:functional] -deps = -r requirements.txt -extras = dev -commands = py.test tests/functional.py