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 efc2b7d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,39 @@ 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 }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
steps:
- run: pwd
- run: ls
- run: cd /app
- run: ls

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 efc2b7d

Please sign in to comment.