-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: Update for Python 3.9 * feat(server): Apply PidfdChildWatcher if available (this will be revisited in a separate PR) * feat: A new `fork` module for pidfd-based race-free async `fork()` - Note: PID file descriptors are only available on Python 3.9+ and Linux kernel 5.4+ - Now the test suite for the `fork` module works with the GitHub Actions CI environment with `os.setpgrp()` to confine signals to the spawned child processes.
- Loading branch information
Showing
11 changed files
with
565 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: default | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Cache pip packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: lint-flake8-${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }} | ||
restore-keys: | | ||
lint-flake8-${{ runner.os }}-pip-${{ matrix.python-version }} | ||
lint-flake8-${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip setuptools | ||
python -m pip install -U -r requirements/lint.txt | ||
- name: Lint with flake8 | ||
run: | | ||
if [ "$GITHUB_EVENT_NAME" == "pull_request" -a -n "$GITHUB_HEAD_REF" ]; then | ||
echo "(skipping matchers for pull request from local branches)" | ||
else | ||
echo "::add-matcher::.github/workflows/flake8-matcher.json" | ||
fi | ||
python -m flake8 src/aiotools tests | ||
typecheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Cache pip packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: typecheck-mypy-${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }} | ||
restore-keys: | | ||
typecheck-mypy-${{ runner.os }}-pip-${{ matrix.python-version }} | ||
typecheck-mypy-${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip setuptools | ||
python -m pip install -U -r requirements/typecheck.txt | ||
- name: Type check with mypy | ||
run: | | ||
if [ "$GITHUB_EVENT_NAME" == "pull_request" -a -n "$GITHUB_HEAD_REF" ]; then | ||
echo "(skipping matchers for pull request from local branches)" | ||
else | ||
echo "::add-matcher::.github/workflows/mypy-matcher.json" | ||
fi | ||
python -m mypy --no-color-output src/aiotools tests | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache pip packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: typecheck-mypy-${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }} | ||
restore-keys: | | ||
typecheck-mypy-${{ runner.os }}-pip-${{ matrix.python-version }} | ||
typecheck-mypy-${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip setuptools | ||
python -m pip install -U -r requirements/test.txt | ||
- name: Prepare testing | ||
run: | | ||
mkdir -p /tmp/etcd | ||
docker run -d -p 2379:2379 -p 2380:2380 \ | ||
-v /tmp/etcd:/etcd-data \ | ||
--name backendai-etcd \ | ||
quay.io/coreos/etcd:v3.4.1 \ | ||
/usr/local/bin/etcd \ | ||
--name backendai-etcd \ | ||
--data-dir /etcd-data \ | ||
--listen-client-urls http://0.0.0.0:2379 \ | ||
--advertise-client-urls http://0.0.0.0:2379 \ | ||
--listen-peer-urls http://0.0.0.0:2380 \ | ||
--initial-advertise-peer-urls http://0.0.0.0:2380 \ | ||
--initial-cluster backendai-etcd=http://0.0.0.0:2380 \ | ||
--initial-cluster-token backendai-etcd-token \ | ||
--initial-cluster-state new \ | ||
--auto-compaction-retention 1 | ||
- name: Test with pytest | ||
timeout-minutes: 1 | ||
run: | | ||
python -m pytest -v --cov=src tests | ||
- name: Send code coverage report | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
env_vars: GHA_OS,GHA_PYTHON | ||
|
||
deploy-to-pypi: | ||
needs: [lint, typecheck, test] | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Install dependencies | ||
env: | ||
REQUIREMENTS_FILE: build | ||
run: | | ||
python -m pip install -U pip setuptools | ||
pip install -U wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: timeline-check | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
towncrier: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Cache pip packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: lint-towncrier-${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }} | ||
restore-keys: | | ||
lint-towncrier-${{ runner.os }}-pip-${{ matrix.python-version }} | ||
lint-towncrier-${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip setuptools | ||
python -m pip install -U towncrier | ||
- name: Check existence of news fragment | ||
run: | | ||
git fetch --no-tags origin +refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH} | ||
python -m towncrier.check --compare-with=origin/${BASE_BRANCH} | ||
env: | ||
BASE_BRANCH: ${{ github.base_ref }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Now the primary target is Python 3.9 | ||
Add a new module `fork` to support PID file descriptors in Linux 5.4+ and a POSIX-compatible fallback to asynchornously fork the Python process without signal/PID races. |
Oops, something went wrong.