Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
juraskov committed Jun 27, 2024
1 parent 64607bc commit 7be2e8c
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Lint"

on:
push:
pull_request:

env:
FORCE_COLOR: 1

jobs:
pre-commit:
env:
SKIP: 'no-commit-to-branch'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run pre-commit
uses: pre-commit/[email protected]
38 changes: 38 additions & 0 deletions .github/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: pytest

on:
push:
branches: [main]
pull_request:

env:
FORCE_COLOR: 1

jobs:
test:
name: PYTESTS (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: ["ubuntu-22.04"]
python-version: ["3.10"]

steps:
- name: Checkout
- uses: actions/checkout@v4

- name: Basic install
run: pip install -r requirements.txt

- name: Run Tests
run: pytest --cov

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
flags: python-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}

22 changes: 22 additions & 0 deletions .pre-commit-config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
default_language_version:
# all hooks should run with python 3.6+
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: no-commit-to-branch
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-added-large-files
args: ['--maxkb=500', '--enforce-all']
- id: check-yaml
- id: check-toml

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.1
hooks:
# - id: ruff
# args: [--show-source, --fix]
# - id: ruff-format
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ h5py~=3.11
matplotlib~=3.9
bokeh==2.4.3
astropy~=6.0
pre-commit
h5netcdf~=1.3
pytensor~=2.23
tomli >= 2.0.0 ; python_version < "3.11"

0 comments on commit 7be2e8c

Please sign in to comment.