|
1 | | -name: Build and Deploy Code to Docker and Heroku |
| 1 | +# name: Build and Deploy Code to Docker and Heroku |
2 | 2 |
|
3 | | -on: |
4 | | - push: |
5 | | - branches: [ master ] |
6 | | - pull_request: |
7 | | - branches: [ master ] |
| 3 | +# on: |
| 4 | +# push: |
| 5 | +# branches: [ master ] |
| 6 | +# pull_request: |
| 7 | +# branches: [ master ] |
8 | 8 |
|
9 | | -jobs: |
10 | | - build: |
11 | | - environment: |
12 | | - name: testing |
13 | | - env: |
14 | | - DATABASE_HOSTNAME: ${{secrets.DATABASE_HOSTNAME}} |
15 | | - DATABASE_PORT: ${{secrets.DATABASE_PORT}} |
16 | | - DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}} |
17 | | - DATABASE_NAME: ${{secrets.DATABASE_NAME}} |
18 | | - DATABASE_USERNAME: ${{secrets.DATABASE_USERNAME}} |
19 | | - SECRET_KEY: ${{secrets.SECRET_KEY}} |
20 | | - ALGORITHM: ${{secrets.ALGORITHM}} |
21 | | - ACCESS_TOKEN_EXPIRE_MINUTES: ${{secrets.ACCESS_TOKEN_EXPIRE_MINUTES}} |
| 9 | +# jobs: |
| 10 | +# build: |
| 11 | +# environment: |
| 12 | +# name: testing |
| 13 | +# env: |
| 14 | +# DATABASE_HOSTNAME: ${{secrets.DATABASE_HOSTNAME}} |
| 15 | +# DATABASE_PORT: ${{secrets.DATABASE_PORT}} |
| 16 | +# DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}} |
| 17 | +# DATABASE_NAME: ${{secrets.DATABASE_NAME}} |
| 18 | +# DATABASE_USERNAME: ${{secrets.DATABASE_USERNAME}} |
| 19 | +# SECRET_KEY: ${{secrets.SECRET_KEY}} |
| 20 | +# ALGORITHM: ${{secrets.ALGORITHM}} |
| 21 | +# ACCESS_TOKEN_EXPIRE_MINUTES: ${{secrets.ACCESS_TOKEN_EXPIRE_MINUTES}} |
22 | 22 |
|
23 | | - services: |
24 | | - postgres: |
25 | | - image: postgres |
26 | | - env: |
27 | | - POSTGRES_PASSWORD: ${{secrets.DATABASE_PASSWORD}} |
28 | | - POSTGRES_DB: ${{secrets.DATABASE_NAME}}_test |
29 | | - ports: |
30 | | - - 5432:5432 |
31 | | - options: >- |
32 | | - --health-cmd pg_isready |
33 | | - --health-interval 10s |
34 | | - --health-timeout 5s |
35 | | - --health-retries 5 |
| 23 | +# services: |
| 24 | +# postgres: |
| 25 | +# image: postgres |
| 26 | +# env: |
| 27 | +# POSTGRES_PASSWORD: ${{secrets.DATABASE_PASSWORD}} |
| 28 | +# POSTGRES_DB: ${{secrets.DATABASE_NAME}}_test |
| 29 | +# ports: |
| 30 | +# - 5432:5432 |
| 31 | +# options: >- |
| 32 | +# --health-cmd pg_isready |
| 33 | +# --health-interval 10s |
| 34 | +# --health-timeout 5s |
| 35 | +# --health-retries 5 |
36 | 36 |
|
37 | | - runs-on: ubuntu-latest |
38 | | - steps: |
39 | | - - name: pulling git repo |
40 | | - uses: actions/checkout@v2 |
41 | | - - name: Install python version 3.9 |
42 | | - uses: actions/setup-python@v2 |
43 | | - with: |
44 | | - python-version: "3.9" |
45 | | - - name: update pip |
46 | | - run: python -m pip install --upgrade pip |
47 | | - - name: install all dependencies |
48 | | - run: pip install -r requirements.txt |
49 | | - - name: test with pytest |
50 | | - run: | |
51 | | - pip install pytest |
52 | | - pytest |
| 37 | +# runs-on: ubuntu-latest |
| 38 | +# steps: |
| 39 | +# - name: pulling git repo |
| 40 | +# uses: actions/checkout@v2 |
| 41 | +# - name: Install python version 3.9 |
| 42 | +# uses: actions/setup-python@v2 |
| 43 | +# with: |
| 44 | +# python-version: "3.9" |
| 45 | +# - name: update pip |
| 46 | +# run: python -m pip install --upgrade pip |
| 47 | +# - name: install all dependencies |
| 48 | +# run: pip install -r requirements.txt |
| 49 | +# - name: test with pytest |
| 50 | +# run: | |
| 51 | +# pip install pytest |
| 52 | +# pytest |
53 | 53 |
|
54 | | - # - name: Login to Docker Hub |
55 | | - # uses: docker/login-action@v1 |
56 | | - # with: |
57 | | - # username: ${{ secrets.DOCKER_HUB_USERNAME }} |
58 | | - # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
| 54 | +# # - name: Login to Docker Hub |
| 55 | +# # uses: docker/login-action@v1 |
| 56 | +# # with: |
| 57 | +# # username: ${{ secrets.DOCKER_HUB_USERNAME }} |
| 58 | +# # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
59 | 59 |
|
60 | | - # - name: Set up Docker Buildx |
61 | | - # id: buildx |
62 | | - # uses: docker/setup-buildx-action@v1 |
| 60 | +# # - name: Set up Docker Buildx |
| 61 | +# # id: buildx |
| 62 | +# # uses: docker/setup-buildx-action@v1 |
63 | 63 |
|
64 | | - # - name: Build and push |
65 | | - # id: docker_build |
66 | | - # uses: docker/build-push-action@v2 |
67 | | - # with: |
68 | | - # context: ./ |
69 | | - # file: ./Dockerfile |
70 | | - # builder: ${{ steps.buildx.outputs.name }} |
71 | | - # push: true |
72 | | - # tags: ${{ secrets.DOCKER_HUB_USERNAME }}/fastapi:latest |
73 | | - # cache-from: type=local,src=/tmp/.buildx-cache |
74 | | - # cache-to: type=local,dest=/tmp/.buildx-cache |
75 | | - # - name: Image digest |
76 | | - # run: echo ${{ steps.docker_build.outputs.digest }} |
| 64 | +# # - name: Build and push |
| 65 | +# # id: docker_build |
| 66 | +# # uses: docker/build-push-action@v2 |
| 67 | +# # with: |
| 68 | +# # context: ./ |
| 69 | +# # file: ./Dockerfile |
| 70 | +# # builder: ${{ steps.buildx.outputs.name }} |
| 71 | +# # push: true |
| 72 | +# # tags: ${{ secrets.DOCKER_HUB_USERNAME }}/fastapi:latest |
| 73 | +# # cache-from: type=local,src=/tmp/.buildx-cache |
| 74 | +# # cache-to: type=local,dest=/tmp/.buildx-cache |
| 75 | +# # - name: Image digest |
| 76 | +# # run: echo ${{ steps.docker_build.outputs.digest }} |
77 | 77 |
|
78 | | - deploy: |
79 | | - runs-on: ubuntu-latest |
80 | | - needs: [build] |
81 | | - environment: |
82 | | - name: production |
83 | | - steps: |
84 | | - - name: pulling git repo |
85 | | - uses: actions/checkout@v2 |
86 | | - - name: deploying to Heroku |
87 | | - uses: akhileshns/heroku-deploy@v3.12.12 # This is the action |
88 | | - with: |
89 | | - heroku_api_key: ${{secrets.HEROKU_API_KEY}} |
90 | | - heroku_app_name: ${{secrets.HEROKU_APP_NAME}} |
91 | | - heroku_email: ${{secrets.HEROKU_EMAIL}} |
| 78 | +# deploy: |
| 79 | +# runs-on: ubuntu-latest |
| 80 | +# needs: [build] |
| 81 | +# environment: |
| 82 | +# name: production |
| 83 | +# steps: |
| 84 | +# - name: pulling git repo |
| 85 | +# uses: actions/checkout@v2 |
| 86 | +# - name: deploying to Heroku |
| 87 | +# uses: akhileshns/heroku-deploy@v3.12.12 # This is the action |
| 88 | +# with: |
| 89 | +# heroku_api_key: ${{secrets.HEROKU_API_KEY}} |
| 90 | +# heroku_app_name: ${{secrets.HEROKU_APP_NAME}} |
| 91 | +# heroku_email: ${{secrets.HEROKU_EMAIL}} |
92 | 92 |
|
93 | | - - name: deploy to ubuntu server |
94 | | - uses: appleboy/ssh-action@master |
95 | | - with: |
96 | | - host: ${{secrets.PROD_HOST}} |
97 | | - username: ${{secrets.PROD_USERNAME}} |
98 | | - password: ${{secrets.PROD_PASSWORD}} |
99 | | - script: | |
100 | | - cd app/src |
101 | | - git pull |
102 | | - echo ${{secrets.PROD_PASSWORD}} | sudo -S systemctl restart api |
103 | | - # login to our ubuntu |
104 | | - # cd /app/src |
105 | | - # git pull |
106 | | - # systemctl restart api |
| 93 | +# - name: deploy to ubuntu server |
| 94 | +# uses: appleboy/ssh-action@master |
| 95 | +# with: |
| 96 | +# host: ${{secrets.PROD_HOST}} |
| 97 | +# username: ${{secrets.PROD_USERNAME}} |
| 98 | +# password: ${{secrets.PROD_PASSWORD}} |
| 99 | +# script: | |
| 100 | +# cd app/src |
| 101 | +# git pull |
| 102 | +# echo ${{secrets.PROD_PASSWORD}} | sudo -S systemctl restart api |
| 103 | +# # login to our ubuntu |
| 104 | +# # cd /app/src |
| 105 | +# # git pull |
| 106 | +# # systemctl restart api |
0 commit comments