From 38542054877dc8863e11a17dd2dec4ab66757853 Mon Sep 17 00:00:00 2001 From: Malthe Borch Date: Thu, 18 Apr 2024 22:29:13 +0200 Subject: [PATCH] Add GitHub workflow to build distribution artifacts and run automated tests --- .github/workflows/main.yml | 55 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 18 ------------- MANIFEST.in | 2 ++ fsevents.py | 30 +++++++++++++++++++++ tox.ini | 2 +- 5 files changed, 88 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml create mode 100644 MANIFEST.in diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..293a456 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,55 @@ +on: + push: + pull_request: + # Allow to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - run: python -m pip install setuptools wheel + - run: python setup.py sdist + - run: python setup.py bdist_wheel + - uses: actions/upload-artifact@v4 + with: + name: MacFSEvents + path: ./dist/ + test: + strategy: + # We want to see all failures: + fail-fast: false + matrix: + config: + - ["3.8", "py38 lint", "macos-12"] + - ["3.9", "py39", "macos-12"] + - ["3.10", "py310", "macos-12"] + - ["3.11", "py311", "macos-12"] + - ["3.12", "py312", "macos-12"] + - ["3.12", "py312", "macos-13"] + - ["3.12", "py312", "macos-14"] + runs-on: ${{ matrix.config[2] }} + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + name: ${{ matrix.config[0] }}-${{ matrix.config[1] }} + steps: + - run: git config --global core.autocrlf false + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.config[0] }} + - name: Pip cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.config[0] }}- + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Test + run: tox -- ${{ matrix.config[1] }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a85cd59..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: false -osx_image: xcode7.1 - -language: objective-c - -before_install: -- brew install python3 - -script: -- python setup.py build -- python setup.py test -- python3 setup.py build -- python3 setup.py test - -notifications: - email: - on_success: never - on_failure: change diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..a1ccdad --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include *.py +include tox.ini diff --git a/fsevents.py b/fsevents.py index 9bd3161..ff874d6 100644 --- a/fsevents.py +++ b/fsevents.py @@ -4,6 +4,7 @@ import unicodedata from _fsevents import ( + FS_CFLAGFILEEVENTS, FS_CFLAGNONE, FS_EVENTIDSINCENOW, FS_FLAGEVENTIDSWRAPPED, @@ -320,3 +321,32 @@ def snapshot(self, path): entry[obj] = os.lstat(os.path.join(root, obj)) except OSError: continue + + +__all__ = ( + FS_CFLAGFILEEVENTS, + FS_CFLAGNONE, + FS_EVENTIDSINCENOW, + FS_FLAGEVENTIDSWRAPPED, + FS_FLAGHISTORYDONE, + FS_FLAGKERNELDROPPED, + FS_FLAGMOUNT, + FS_FLAGMUSTSCANSUBDIRS, + FS_FLAGROOTCHANGED, + FS_FLAGUNMOUNT, + FS_FLAGUSERDROPPED, + FS_ITEMCHANGEOWNER, + FS_ITEMCREATED, + FS_ITEMFINDERINFOMOD, + FS_ITEMINODEMETAMOD, + FS_ITEMISDIR, + FS_ITEMISFILE, + FS_ITEMISSYMLINK, + FS_ITEMMODIFIED, + FS_ITEMREMOVED, + FS_ITEMRENAMED, + FS_ITEMXATTRMOD, + FileEvent, + Stream, + Observer, +) diff --git a/tox.ini b/tox.ini index 45830a8..c4af272 100644 --- a/tox.ini +++ b/tox.ini @@ -27,7 +27,7 @@ basepython = python3 skip_install = true commands = isort --check-only --diff . - flake8 *.py + flake8 -v tests.py fsevents.py check-manifest check-python-versions deps =