Skip to content

Commit

Permalink
Add test and build jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd committed Oct 9, 2023
1 parent 4e000cf commit 7f1668f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,38 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./backend
push: true
tags: ghcr.io/datalab-mi/basegun/basegun-backend:${{ github.head_ref }}
target: dev

test:
needs: build
runs-on: ubuntu-latest
container:
image: ghcr.io/datalab-mi/basegun/basegun-backend:${{ github.head_ref }}
env:
WORKSPACE: dev
AWS_REGION: gra
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- run: cd /app && python -m unittest

build-and-test:
uses: ./.github/workflows/test-on-kube.yml
needs: tag-pr
Expand Down
7 changes: 1 addition & 6 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@ RUN mkdir -p src/weights \
&& mv model.pth src/weights/model.pth \
&& echo '{"app": "'${VERSION}'", "model": "'${MODEL}'"}' > versions.json

# launch website
FROM base as dev
CMD ["uvicorn", "src.main:app", "--reload", "--host", "0.0.0.0", "--port", "5000"]

FROM base as test
RUN pip install requests && rm -r /root/.cache
COPY tests/ tests/
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "5000"]
CMD ["uvicorn", "src.main:app", "--reload", "--host", "0.0.0.0", "--port", "5000"]

FROM base as prod
RUN pip install --extra-index-url https://download.pytorch.org/whl/cpu \
Expand Down

0 comments on commit 7f1668f

Please sign in to comment.