Run Tests #242
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: "Run Tests" | |
on: | |
push: | |
branches: | |
- "master" | |
pull_request: | |
branches: | |
- "*" | |
schedule: | |
# Run tests every Sunday at 12am | |
- cron: "0 0 * * 0" | |
concurrency: | |
group: environment-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Determine if tests should be run based on commit message. | |
check_skip: | |
runs-on: ubuntu-latest | |
outputs: | |
skip: ${{ steps.result_step.outputs.ci-skip }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- id: result_step | |
uses: mstachniuk/ci-skip@master | |
with: | |
commit-filter: "[skip ci];[ci skip];[skip github]" | |
commit-filter-separator: ";" | |
run_tests: | |
needs: check_skip | |
if: ${{ needs.check_skip.outputs.skip == 'false' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-12"] | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
name: ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v2 | |
- name: "Set up python" | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: "Display Python version" | |
shell: bash {0} | |
run: python -c "import sys; print(sys.version)" | |
- name: "Install PyMARE" | |
shell: bash {0} | |
run: pip install -e .[tests,stan] | |
- name: "Run tests" | |
shell: bash {0} | |
run: python -m pytest --pyargs pymare --cov=pymare | |
- name: "Upload coverage to CodeCov" | |
uses: codecov/codecov-action@v4 | |
if: success() | |
flake8-lint: | |
runs-on: ubuntu-latest | |
name: Lint with flake8 | |
steps: | |
- name: Check out source repository | |
uses: actions/checkout@v2 | |
- name: Set up Python environment | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: "Install the package" | |
shell: bash {0} | |
run: | | |
python -m pip install --progress-bar off --upgrade pip setuptools wheel | |
python -m pip install -e .[tests] | |
- name: "Run flake8" | |
shell: bash {0} | |
run: | | |
flake8 pymare |