Update requirements (#78) #622
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: build | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8, 3.9, "3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
# path: ${{ env.pythonLocation }} | |
# key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} | |
# restore-keys: | | |
# ${{ env.pythonLocation }}- | |
# This path is specific to Ubuntu | |
path: ~/.cache/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt -r requirements-test.txt | |
python -m pip install . | |
- name: PyTest | |
run: | | |
pytest --cov deepcell_spots | |
- name: Coveralls | |
if: env.COVERALLS_REPO_TOKEN != null | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
COVERALLS_FLAG_NAME: ${{ matrix.python-version }} | |
COVERALLS_PARALLEL: true | |
run: | | |
coveralls --service=github | |
test-docker: | |
name: Build docker image and run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Cache docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-buildx- | |
- name: Build image run unit tests | |
env: | |
IMAGE: ${{ github.repository }}:${{ github.sha }} | |
NAME: deepcell-spots-test | |
run: | | |
docker buildx build --load --tag ${{ env.IMAGE }} . | |
docker run -d -it \ | |
--entrypoint=bash \ | |
--name ${{ env.NAME }} \ | |
${{ env.IMAGE }} | |
docker cp requirements-test.txt ${{ env.NAME }}:/opt/deepcell-spots/requirements-test.txt | |
docker exec ${{ env.NAME }} pip install -r /opt/deepcell-spots/requirements-test.txt | |
docker exec ${{ env.NAME }} pytest /opt/deepcell-spots/deepcell_spots | |
docker kill ${{ env.NAME }} && docker rm ${{ env.NAME }} | |
coveralls: | |
name: Finish Coveralls | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@master | |
if: env.COVERALLS_REPO_TOKEN != null | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true |