Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshipon committed Apr 7, 2024
1 parent dff3e36 commit a39b849
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 116 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build for test
on:
- workflow_call

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[dev,github-actions]
28 changes: 4 additions & 24 deletions .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
name: Type check
name: Perform type checking
on: [push, pull_request]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.10']
uses: ./.github/workflows/build.yaml

mypy:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mypy
pip install .
- name: Type check
- name: Perform mypy
run: |
mypy --config-file mypy.ini .
15 changes: 15 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Test aiaccel/apps/
on: [push, pull_request]

jobs:
build:
uses: ./.github/workflows/build.yaml
pytest:
strategy:
matrix:
target:
- apps
- hpo
steps:
- name: Run pytest
run: pytest -v --cov=aiaccel --cov-branch --cov-report=term-missing tests/${{ strategy.target }}
28 changes: 7 additions & 21 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
name: Validate code formats.
on: [push]
name: Check code formating
on: [push, pull_request]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.10']
uses: ./.github/workflows/build.yaml

ruff:
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Lint
- name: Perform ruff
run: |
ruff check --fix aiaccel
ruff check
ruff format --check
29 changes: 0 additions & 29 deletions .github/workflows/test_apps.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/test_hpo.yaml

This file was deleted.

20 changes: 9 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,28 @@ documentation = "https://aiaccel.readthedocs.io"
repository = "https://github.com/aistairc/aiaccel"

[project.optional-dependencies]
test = [
"pytest",
"pytest-cov",
"pytest-subprocess",
"undecorated",
]
github-actions = [
"pytest-github-actions-annotate-failures",
]
dev = [
"ruff",
"mypy",
"myst-parser",
"pre-commit",
"pytest",
"pytest-cov",
"pytest-subprocess",
"ruff",
"sphinx",
"sphinxcontrib-jquery",
"sphinx-intl",
"sphinx-fontawesome",
"sphinx-rtd-theme",
"undecorated",
]
github-actions = [
"pytest-github-actions-annotate-failures",
]

[tool.ruff]
line-length = 120
target-version = "py38"
target-version = "py310"
fix = true

select = ["E", "F", "W", "UP", "B", "SIM", "I", "C"]
Expand Down

0 comments on commit a39b849

Please sign in to comment.