tests #471
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: tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: | |
- main | |
schedule: | |
# Run every Sunday | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
jobs: | |
code-quality: | |
name: Code Quality | |
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" | |
cache: "pip" | |
cache-dependency-path: | | |
pyproject.toml | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements_lint.txt | |
- name: Lint package | |
run: | | |
make lint | |
tests: | |
name: Test suite (${{ matrix.os }}, Python ${{ matrix.python-version }}) | |
needs: code-quality | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.10", 3.11] | |
env: | |
TERM: dumb | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" # caching pip dependencies | |
cache-dependency-path: | | |
pyproject.toml | |
- name: Install OpenMP with Homebrew | |
if: ${{ runner.os == 'macOS' && runner.arch == 'ARM64' }} | |
run: | | |
brew install libomp | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e .[dev] | |
- name: Run tests | |
run: | | |
make test | |
- name: Upload coverage to codecov | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
fail_ci_if_error: true | |
- name: Build distribution and test installation | |
shell: bash | |
run: | | |
make dist | |
python -m pip install dist/cyfi-*.whl --no-deps --force-reinstall | |
cyfi --version | |
python -m pip install dist/cyfi-*.tar.gz --no-deps --force-reinstall | |
cyfi --version | |
notify: | |
name: Notify failed build | |
needs: [code-quality, tests] | |
if: failure() && github.event.pull_request == null | |
runs-on: ubuntu-latest | |
steps: | |
- uses: jayqi/failed-build-issue-action@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} |