Skip to content

Use pre-commit hooks in tox configuration #3244

Use pre-commit hooks in tox configuration

Use pre-commit hooks in tox configuration #3244

name: Test Integration with dandi-cli
on:
push:
branches:
- master
paths-ignore:
- "web/**"
pull_request:
paths-ignore:
- "web/**"
jobs:
build-image:
runs-on: ubuntu-22.04
steps:
- name: Check out this repository
uses: actions/checkout@v4
- name: Build Docker image
run: |
docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN"
docker build \
-t dandiarchive/dandiarchive-api \
-f dev/django-public.Dockerfile \
.
env:
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
- name: Export Docker image
run: |
docker image save -o dandiarchive-api.tgz dandiarchive/dandiarchive-api
- name: Upload Docker image tarball
uses: actions/upload-artifact@v4
with:
name: dandiarchive-api.tgz
path: dandiarchive-api.tgz
test:
runs-on: ubuntu-22.04
needs: build-image
strategy:
fail-fast: false
matrix:
python:
- "3.11"
dandi-version:
- release
- master
env:
DANDI_ALLOW_LOCALHOST_URLS: 1
DANDI_TESTS_PULL_DOCKER_COMPOSE: 0
steps:
- name: Download Docker image tarball
uses: actions/download-artifact@v4
with:
name: dandiarchive-api.tgz
- name: Import Docker image
run: docker image load -i dandiarchive-api.tgz
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Install released dandi
if: matrix.dandi-version == 'release'
run: pip install "dandi[test]"
- name: Install dev dandi
if: matrix.dandi-version == 'master'
run: pip install "dandi[test] @ git+https://github.com/dandi/dandi-cli"
- name: Run dandi-api tests in dandi-cli
run: |
python -m pytest --dandi-api \
"$pythonLocation/lib/python${{ matrix.python }}/site-packages/dandi"
env:
DANDI_TESTS_PERSIST_DOCKER_COMPOSE: "1"
- name: Dump Docker Compose logs
if: failure()
run: |
docker compose \
-f "$pythonLocation/lib/python${{ matrix.python }}/site-packages/dandi/tests/data/dandiarchive-docker/docker-compose.yml" \
logs --timestamps
- name: Shut down Docker Compose
run: |
docker compose \
-f "$pythonLocation/lib/python${{ matrix.python }}/site-packages/dandi/tests/data/dandiarchive-docker/docker-compose.yml" \
down -v