Merge pull request #303 from artefactory/ci/update-ci-cd #856
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
# GNU Lesser General Public License v3.0 only | |
# Copyright (C) 2020 Artefact | |
# [email protected] | |
# | |
# This program is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU Lesser General Public | |
# License as published by the Free Software Foundation; either | |
# version 3 of the License, or (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
# Lesser General Public License for more details. | |
# | |
# You should have received a copy of the GNU Lesser General Public License | |
# along with this program; if not, write to the Free Software Foundation, | |
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
name: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'draft') }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install poetry | |
run: make download-poetry | |
- name: Set up pip cache | |
uses: actions/[email protected] | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }} | |
- name: Set up mypy cache | |
uses: actions/[email protected] | |
with: | |
path: ${{ github.workspace }}/.mypy_cache | |
key: mypy-${{ matrix.python-version }} | |
- name: Set Poetry Path | |
run: | | |
echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: | | |
poetry run pip install --upgrade pip | |
poetry install -E torch -E dask | |
- name: Run safety checks | |
run: | | |
STRICT=1 make check-safety | |
- name: Lint and format | |
run: | | |
make format-code | |
- name: Run tests | |
run: | | |
make test |