-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from nicholasjng/github-actions
Add GitHub Actions lint+test setup
- Loading branch information
Showing
5 changed files
with
83 additions
and
15 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,63 @@ | ||
name: Lint and test shelf | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
env: | ||
MYPY_CACHE_DIR: "${{ github.workspace }}/.cache/mypy" | ||
RUFF_CACHE_DIR: "${{ github.workspace }}/.cache/ruff" | ||
PRE_COMMIT_HOME: "${{ github.workspace }}/.cache/pre-commit" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python and dependencies | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
cache: pip | ||
cache-dependency-path: | | ||
requirements-dev.txt | ||
pyproject.toml | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements-dev.txt | ||
pip install -e . --no-deps | ||
- name: Cache pre-commit tools | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ env.MYPY_CACHE_DIR }} | ||
${{ env.RUFF_CACHE_DIR }} | ||
${{ env.PRE_COMMIT_HOME }} | ||
key: ${{ hashFiles('requirements-dev.txt', '.pre-commit-config.yaml') }}-linter-cache | ||
- name: Run pre-commit checks | ||
run: pre-commit run --all-files --verbose --show-diff-on-failure | ||
test: | ||
name: Test shelf on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest, macos-latest, windows-latest ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up oldest supported Python on ${{ matrix.os }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
- name: Run tests on oldest supported Python | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install ".[dev]" | ||
python -m pytest |
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
import types | ||
from typing import Callable, NamedTuple | ||
|
||
|
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
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