Skip to content

Commit

Permalink
update pre-commit and ga workflows to be consistent with mesa
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-boyu authored and Corvince committed Jan 5, 2024
1 parent f9f7d6a commit b904dbf
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 13 deletions.
8 changes: 8 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
hist
hart
mutch
ist
inactivate
ue
fpr
falsy
17 changes: 9 additions & 8 deletions .github/workflows/build_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ jobs:
fail-fast: False
matrix:
os: [windows, ubuntu, macos]
python-version: ["3.11"]
python-version: ["3.12"]
include:
- os: ubuntu
python-version: "3.11"
- os: ubuntu
python-version: "3.10"
- os: ubuntu
Expand Down Expand Up @@ -54,24 +56,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
- run: pip install ruff==0.0.254
python-version: "3.12"
- run: pip install ruff==0.1.5
- name: Lint with ruff
# Include `--format=github` to enable automatic inline annotations.
# Use settings from pyproject.toml.
run: ruff . --format=github
run: ruff .

lint-black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- run: pip install black[jupyter]
- name: Lint with black
run: black --check .
18 changes: 18 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: build

on:
push:
branches:
- main
- release**
pull_request:

jobs:
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@master
with:
ignore_words_file: .codespellignore
skip: .*bootstrap.*,*.js,.*bootstrap-theme.css.map
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release
on:
push:
branches:
- main
- release**
paths-ignore:
- '**.md'
- '**.rst'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'
workflow_dispatch:

permissions:
id-token: write

jobs:
release:
name: Deploy release to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -U pip build wheel setuptools
- name: Build distributions
run: python -m build
- name: Upload package as artifact to GitHub
if: github.repository == 'projectmesa/mesa-geo' && startsWith(github.ref, 'refs/tags')
uses: actions/upload-artifact@v3
with:
name: package
path: dist/
- name: Publish package to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
16 changes: 11 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ ci:
autofix_prs: false

repos:
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black-jupyter
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.5
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi, jupyter ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
Expand All @@ -17,4 +23,4 @@ repos:
hooks:
- id: trailing-whitespace
- id: check-toml
- id: check-yaml
- id: check-yaml

0 comments on commit b904dbf

Please sign in to comment.