Skip to content

Commit

Permalink
chore: lint with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
kalekundert committed Aug 31, 2023
1 parent f6960a8 commit 3db6e2c
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 38 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release
on: workflow_dispatch

jobs:
release:
name: Release to PyPI
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs:
- lint
- test-python
- test-r

steps:
- uses: actions/checkout@v2
with:
# Make sure the whole repository history is present, so that
# python-semantic-release can decide if a new release is needed.
fetch-depth: 0

- uses: relekang/python-semantic-release@v7.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}




Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
name: Test and release
name: Test

on: [push]
on:
push:
pull_request:
schedule:
- cron: '0 17 1,15 * *'

jobs:

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- run: pip install ruff
- run: ruff check --format=github .

test-python:
name: Test Python
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.x']
operating-system:
- ubuntu-latest
- macos-latest
- windows-latest

runs-on: ${{ matrix.operating-system }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade pip
pip install '.[tests]'
- name: Run test suite
run: |
Expand All @@ -32,24 +50,26 @@ jobs:
test-r:
name: Test R
runs-on: ubuntu-latest

strategy:
matrix:
R: ['3.0', '3.6', '4.0']

defaults:
run:
shell: Rscript {0}
working-directory: wellmapr

strategy:
matrix:
R: ['3.0', '3.6', '4.0']
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/work/_temp/Library
key: R-${{ runner.os }}-${{ matrix.R }}-${{ hashFiles('DESCRIPTION') }}
- uses: actions/setup-python@v2
- uses: r-lib/actions/setup-r@v1
- uses: actions/setup-python@v4
- uses: r-lib/actions/setup-r@v2
- name: Install test dependencies (apt-get)
shell: bash
run: |
Expand All @@ -69,26 +89,3 @@ jobs:
reticulate::py_config()
rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error")
release:
name: Release to PyPI
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs:
- test-python
- test-r

steps:
- uses: actions/checkout@v2
with:
# Make sure the whole repository history is present, so that
# python-semantic-release can decide if a new release is needed.
fetch-depth: 0

- uses: relekang/python-semantic-release@v7.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}




7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ version_pattern = [
'wellmapr/DESCRIPTION:Version: {version}',
'wellmapr/DESCRIPTION:list\(package = "wellmap", version = "{version}"'
]

[tool.ruff]
select = ["F"]
ignore = ["F405", "F403"]

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]

0 comments on commit 3db6e2c

Please sign in to comment.