Fix code style issues with Black #357
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: # on all branches except `typos` | |
- '**' | |
- '!typos' | |
paths-ignore: | |
- 'docs/**' | |
- 'scripts/**' | |
- 'data/**' | |
- '.git*' | |
- 'README.md' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
caching: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/my-env | |
# For later compatibility with Windows and macOS: | |
# - os: macos-latest | |
# label: osx-64 | |
# prefix: /Users/runner/miniconda3/envs/my-env | |
# | |
# - os: windows-latest | |
# label: win-64 | |
# prefix: C:\Miniconda3\envs\my-env | |
name: Cache for ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: sb_env | |
use-mamba: true | |
- name: Show environment info | |
run: | | |
conda info | |
conda list | |
- name: Cache Conda env | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CONDA }}/envs | |
key: | |
conda-${{ runner.os }}--${{ runner.arch }}--${{ | |
hashFiles('environment.yml') }}-${{ env.CACHE_NUMBER }} | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
id: cache | |
- name: Update environment | |
run: # Install if cache not found | |
mamba env update -n sb_env -f environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
run-tests: | |
needs: caching | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
submodule: | |
- { | |
name: "Metrics & Graph Stats", | |
pytest_args: "tests/metrics/ tests/test_graph_stats.py" } | |
- { name: "Approaches", pytest_args: "tests/partitioning/approaches/" } | |
- { name: "Partitioning Base", pytest_args: "tests/partitioning/test_base.py" } | |
- { | |
name: "Partitioning Rest", | |
pytest_args: "tests/partitioning/ --ignore=tests/partitioning/approaches/ --ignore=tests/partitioning/test_base.py" | |
} | |
- { name: "Population", pytest_args: "tests/population/" } | |
- { name: "Attribute", pytest_args: "tests/test_attribute.py" } | |
- { name: "Plot", pytest_args: "tests/test_plot.py" } | |
- { name: "Utils", pytest_args: "tests/test_utils.py" } | |
name: ${{ matrix.submodule.name }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: sb_env | |
use-mamba: true | |
- name: Use cache for ${{ matrix.submodule.name }} | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CONDA }}/envs | |
fail-on-cache-miss: true | |
key: | |
conda-${{ runner.os }}--${{ runner.arch }}--${{ | |
hashFiles('environment.yml') }}-${{ env.CACHE_NUMBER }} | |
env: | |
CACHE_NUMBER: 0 # Same as in caching job | |
- name: Show environment info | |
run: | | |
conda info | |
conda list | |
conda config --show | |
- name: "Run tests ${{ matrix.submodule.name }} with coverage" | |
run: | | |
pytest --cov=superblockify ${{ matrix.submodule.pytest_args }} | |
env: | |
COVERAGE_FILE: ".coverage.${{ matrix.submodule.name }}" | |
- name: Store coverage file | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: ".coverage.${{ matrix.submodule.name }}" | |
coverage: | |
name: Merge Coverage | |
runs-on: ubuntu-latest | |
needs: run-tests | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Load coverages | |
uses: actions/download-artifact@v3 | |
id: download | |
with: | |
name: 'coverage' | |
- name: Install coverage | |
run: pip install coverage | |
- name: Merge coverage files | |
run: coverage combine | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |