From 2d078a219efbaef95d714272c782a12736f1a5db Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 10 Aug 2022 16:03:40 -0700 Subject: [PATCH 1/3] Improve CI testing --- .github/workflows/lint.yml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 12 ++++-------- pyproject.toml | 8 ++------ 3 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..769ad93 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,33 @@ +name: lint + +on: [push, pull_request] + +jobs: + format: + runs-on: ${{ matrix.os }}-latest + strategy: + matrix: + os: [ubuntu] + python-version: ["3.10"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[lint] + + - name: Lint + run: pre-commit run --all-files --show-diff-on-failure --color always diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4dbd2d8..0734048 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,8 +7,8 @@ jobs: runs-on: ${{ matrix.os }}-latest strategy: matrix: - os: [ubuntu] - python-version: ["3.10"] + os: [ubuntu, macos, windows] + python-version: ["3.8", "3.9", "3.10", "3.11-dev", "pypy-3.8", "pypy-3.9"] steps: - uses: actions/checkout@v3 @@ -27,12 +27,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flit - flit install - - - name: Lint - run: pre-commit run --all-files --show-diff-on-failure --color always + pip install .[test] - name: Test run: | - pytest + pytest --doctest-modules --durations=10 --pyargs yaml2ics diff --git a/pyproject.toml b/pyproject.toml index 1aef5ef..6066979 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,12 +19,8 @@ dependencies = [ ] [project.optional-dependencies] -test = [ - "pytest", - "black", - "pre-commit", - "flake8" -] +test = ["pytest"] +lint = ["pre-commit"] [project.scripts] yaml2ics = "yaml2ics:main" From 3c5f092ae195c623a7e93bf58e95224b6fb9a66d Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 10 Aug 2022 16:11:52 -0700 Subject: [PATCH 2/3] Run pytest on source files --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0734048..165d826 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,4 +31,4 @@ jobs: - name: Test run: | - pytest --doctest-modules --durations=10 --pyargs yaml2ics + pytest --doctest-modules --durations=10 From 3ff7b436e6dfe69326731883127c3192f0c8ee64 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 10 Aug 2022 16:18:11 -0700 Subject: [PATCH 3/3] Don't run on pypy --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 165d826..f2a0660 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [ubuntu, macos, windows] - python-version: ["3.8", "3.9", "3.10", "3.11-dev", "pypy-3.8", "pypy-3.9"] + python-version: ["3.8", "3.9", "3.10", "3.11-dev"] steps: - uses: actions/checkout@v3