diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 360c6c6..d8187f8 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -3,75 +3,74 @@ name: Build and Deploy Code on: [push, pull_request] jobs: - # test: - # environment: - # name: testing - # env: - # TF_MODEL_EPOCHS: ${{vars.TF_MODEL_EPOCHS}} - # IMAGE_SIZE_X: ${{vars.IMAGE_SIZE_X}} - # IMAGE_SIZE_Y: ${{vars.IMAGE_SIZE_Y}} - - # # services: - # # postgres: - # # image: postgres - # # env: - # # POSTGRES_PASSWORD: ${{secrets.DATABASE_PASSWORD}} - # # POSTGRES_DB: ${{secrets.DATABASE_NAME}}_test - # # ports: - # # - 5432:5432 - # # options: >- - # # --health-cmd pg_isready - # # --health-interval 10s - # # --health-timeout 5s - # # --health-retries 5 - - # runs-on: ubuntu-latest - # steps: - # - name: pulling git repo - # uses: actions/checkout@v2 - # - name: Install packages - # run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-glx - # - name: Install python version 3.12 - # uses: actions/setup-python@v2 - # with: - # python-version: "3.12" - # - name: update pip - # run: python -m pip install --upgrade pip - - # - name: install - # run: make install - # - name: test - # run: make test - - - # # - name: Login to Docker Hub - # # uses: docker/login-action@v1 - # # with: - # # username: ${{ secrets.DOCKER_HUB_USERNAME }} - # # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - # # - name: Set up Docker Buildx - # # id: buildx - # # uses: docker/setup-buildx-action@v1 - - # # - name: Build and push - # # id: docker_build - # # uses: docker/build-push-action@v2 - # # with: - # # context: ./ - # # file: ./Dockerfile - # # builder: ${{ steps.buildx.outputs.name }} - # # push: true - # # tags: ${{ secrets.DOCKER_HUB_USERNAME }}/fastapi:latest - # # cache-from: type=local,src=/tmp/.buildx-cache - # # cache-to: type=local,dest=/tmp/.buildx-cache - # # - name: Image digest - # # run: echo ${{ steps.docker_build.outputs.digest }} + test: + environment: + name: testing + env: + TF_MODEL_EPOCHS: ${{vars.TF_MODEL_EPOCHS}} + IMAGE_SIZE_X: ${{vars.IMAGE_SIZE_X}} + IMAGE_SIZE_Y: ${{vars.IMAGE_SIZE_Y}} + + # services: + # postgres: + # image: postgres + # env: + # POSTGRES_PASSWORD: ${{secrets.DATABASE_PASSWORD}} + # POSTGRES_DB: ${{secrets.DATABASE_NAME}}_test + # ports: + # - 5432:5432 + # options: >- + # --health-cmd pg_isready + # --health-interval 10s + # --health-timeout 5s + # --health-retries 5 + + runs-on: ubuntu-latest + steps: + - name: pulling git repo + uses: actions/checkout@v2 + - name: Install packages + run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-glx + - name: Install python version 3.12 + uses: actions/setup-python@v2 + with: + python-version: "3.12" + - name: update pip + run: python -m pip install --upgrade pip + - name: install + run: make install + - name: test + run: make test + + + # - name: Login to Docker Hub + # uses: docker/login-action@v1 + # with: + # username: ${{ secrets.DOCKER_HUB_USERNAME }} + # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + # - name: Set up Docker Buildx + # id: buildx + # uses: docker/setup-buildx-action@v1 + + # - name: Build and push + # id: docker_build + # uses: docker/build-push-action@v2 + # with: + # context: ./ + # file: ./Dockerfile + # builder: ${{ steps.buildx.outputs.name }} + # push: true + # tags: ${{ secrets.DOCKER_HUB_USERNAME }}/fastapi:latest + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache + # - name: Image digest + # run: echo ${{ steps.docker_build.outputs.digest }} deploy: - runs-on: tensorflow/tensorflow:latest - # needs: [test] + runs-on: ubuntu-latest + needs: [test] environment: name: production steps: @@ -88,13 +87,10 @@ jobs: file_name: .env fail_on_empty: false sort_keys: false - - name: install run: make install - - name: build run: make build - - name: SCP repo to production server uses: appleboy/scp-action@master with: diff --git a/makefile b/makefile index 445e0d1..5a68f3c 100644 --- a/makefile +++ b/makefile @@ -3,7 +3,8 @@ install: pip install -r requirements.txt - pip install tensorflow pytest + pip install tensorflow + pip install pytest npm install tailwindcss