Skip to content

Commit

Permalink
update GHA config
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jun 21, 2024
1 parent e9fcb7a commit 7113bde
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 55 deletions.
62 changes: 21 additions & 41 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,37 @@

on: [push, pull_request]
name: tests
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }}
cancel-in-progress: true
jobs:
linux:
# Run unit tests
py3:
name: "py-${{ matrix.python-version }}, ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest]

steps:
- uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- name: Install pydeps
run: |
make setup-dev-env PYTHON=python
- name: Tests
- name: Install pydeps ${{ matrix.os }}
if: matrix.os == 'windows-latest'
run: |
make test PYTHON=python
windows:
runs-on: windows-2019
strategy:
matrix:
python-version: ["3.11"]

steps:
- uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

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

- name: Install pydeps
python.exe -m pip install --upgrade pypiwin32 wmi pyopenssl psutil pytest
- name: Install pydeps ${{ matrix.os }}
if: matrix.os != 'windows-latest'
run: |
python.exe -m pip install --upgrade --user setuptools pip wheel
python.exe -m pip install --upgrade mock ipaddress pypiwin32 wmi pyopenssl psutil pytest
python.exe -m pip freeze
python.exe setup.py install
make setup-dev-env
- name: Tests
run: |
Expand All @@ -63,10 +43,10 @@ jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: 'Run linters'
run: |
python3 -m pip install black ruff rstcheck toml-sort sphinx-rtd-theme
python3 -m pip install --upgrade black ruff rstcheck toml-sort sphinx-rtd-theme
python3 -m pip freeze
make lint-all
38 changes: 24 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
# Shortcuts for various tasks (UNIX only).
# To use a specific Python version run:
# $ make install PYTHON=python3.7
# $ make install PYTHON=python3.7
# To run a specific test:
# $ make test ARGS="-v -s pyftpdlib/test/test_functional.py::TestIPv6MixedEnvironment::test_port_v4"

PYTHON = python3
ARGS =

# mandatory deps for running tests
PYDEPS = \
black \
check-manifest \
coverage \
psutil \
pylint \
pyopenssl \
pytest \
pytest-cov \
rstcheck \
ruff \
setuptools \
teyit \
toml-sort \
twine
PYVER = $(shell $(PYTHON) -c "import sys; print(sys.version_info[0])")
ifeq ($(PYVER), 2)
setuptools
# dev deps
ifndef GITHUB_ACTIONS
PYDEPS += \
black \
check-manifest \
coverage \
pylint \
pytest-cov \
rstcheck \
ruff \
teyit \
toml-sort \
twine
endif
# python 2 deps
ifeq ($(shell $(PYTHON) -c "import sys; print(sys.version_info[0])"), 2)
PYDEPS = \
ipaddress \
mock \
Expand All @@ -37,6 +45,8 @@ TEST_PREFIX = PYTHONWARNINGS=always
PYTEST_ARGS = -v --tb=native -o cache_dir=/tmp/pyftpdlib-pytest-cache
NUM_WORKERS = `$(PYTHON) -c "import os; print(os.cpu_count() or 1)"`

# if make is invoked with no arg, default to `make help`
.DEFAULT_GOAL := help

# ===================================================================
# Install
Expand Down
1 change: 1 addition & 0 deletions scripts/internal/winmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"setuptools",
"wmi",
]

if sys.version_info[:2] == (2, 7):
DEPS.extend(
[
Expand Down

0 comments on commit 7113bde

Please sign in to comment.