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 workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: lint and test | |
on: [push, pull_request] | |
jobs: | |
ruff-black-isort: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: chartboost/ruff-action@v1 | |
- name: Install dependencies | |
run: | | |
python -m pip install . | |
pip install -r dev-requirements.txt | |
- name: black check | |
run: black --check --preview . | |
- name: isort check | |
run: isort --profile black --check . | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup node (for pyright) | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "16" | |
- name: Install universal-ctags (Ubuntu) | |
if: runner.os == 'Linux' | |
run: sudo apt update && sudo apt install universal-ctags | |
- name: Install universal-ctags (OSX) | |
if: runner.os == 'macOS' | |
run: brew update && brew install universal-ctags | |
- name: Install universal-ctags (Windows) | |
if: runner.os == 'Windows' | |
run: choco install universal-ctags | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install . | |
python -m pip install -r dev-requirements.txt | |
- name: Check types with pyright | |
run: | | |
pyright | |
- name: Test with pytest | |
run: | | |
pytest | |
- name: Can run Mentat | |
# Unfortunately Github Actions Runners have trouble with prompt toolkit, so we can't do this on Windows. | |
if: runner.os != 'Windows' | |
# Ensure that python doesn't import local mentat folder and that 'mentat' command calls mentat instead of switching folders. | |
working-directory: ./testbed | |
run: | | |
mentat | |
license-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install . | |
pip install -r dev-requirements.txt | |
- name: Run license checking script | |
run: | | |
python tests/license_check.py |