Skip to content

Commit

Permalink
Add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
f0uriest committed Oct 24, 2023
1 parent 3179086 commit d95d486
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Black formatting

on: [pull_request, workflow_dispatch]

jobs:
black_format:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Check files using the black formatter
run: |
black --version
black --check quadax/ tests/ || black_return_code=$?
echo "BLACK_RETURN_CODE=$black_return_code" >> $GITHUB_ENV
black quadax/ tests/
- name: Annotate diff changes using reviewdog
uses: reviewdog/action-suggester@v1
with:
tool_name: blackfmt
- name: Fail if not formatted
run: |
exit ${{ env.BLACK_RETURN_CODE }}
38 changes: 38 additions & 0 deletions .github/workflows/jax_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Dependency test JAX

on:
pull_request:
types: [labeled]
workflow_dispatch:

jobs:
jax_tests:
if: ${{ github.event.label.name == 'test_jax' && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
jax-version: [0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.3.9, 0.3.10, 0.3.11, 0.3.12, 0.3.13, 0.3.14, 0.3.15, 0.3.16, 0.3.17, 0.3.19, 0.3.20, 0.3.21, 0.3.22, 0.3.23, 0.3.24, 0.3.25, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.7, 0.4.8, 0.4.9, 0.4.10, 0.4.11, 0.4.12, 0.4.13, 0.4.14]
group: [1, 2]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Remove jax
run: |
pip uninstall jax jaxlib -y
- name: install jax
run: |
pip install "jax[cpu]==${{ matrix.jax-version }}"
- name: Test with pytest
run: |
pwd
lscpu
python -m pytest --durations=0 --mpl --maxfail=1 --splits 3 --group ${{ matrix.group }} --splitting-algorithm least_duration
23 changes: 23 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Linting

on: [pull_request, workflow_dispatch]

jobs:
flake8_linting:
runs-on: ubuntu-latest
name: Linting
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: flake8 Lint
uses: reviewdog/action-flake8@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Build package
run: python -m build --sdist --wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
60 changes: 60 additions & 0 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Unit tests

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- 'devtools/**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
unit_tests:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Test with pytest
run: |
pwd
lscpu
python -m pytest -v --durations=0 --cov-report xml:cov.xml --cov-config=setup.cfg --cov=quadax/ --db ./prof.db
- name: save coverage file and plot comparison results
if: always()
uses: actions/upload-artifact@v3
with:
name: unit_test_artifact
path: |
./cov.xml
./prof.db
- name: Upload coverage
id : codecov
uses: Wandalen/[email protected]
with:
action: codecov/codecov-action@v3
with: |
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-umbrella
files: ./cov.xml
fail_ci_if_error: true
verbose: true
attempt_limit: 10
attempt_delay: 60000 # ms, 1 min

0 comments on commit d95d486

Please sign in to comment.