macrdel commited on
Commit
6e86cbf
1 Parent(s): 2f0f16c

update workflow

Browse files
Files changed (1) hide show
  1. .github/workflows/main.yml +28 -38
.github/workflows/main.yml CHANGED
@@ -21,32 +21,27 @@ jobs:
21
  username: ${{ secrets.DOCKER_USERNAME }}
22
  password: ${{ secrets.DOCKER_PASSWORD }}
23
 
24
- - name: Build Docker image for app
25
- run: docker build -t macrdel/app:latest .
 
 
 
26
 
27
  test:
28
  runs-on: ubuntu-latest
29
  needs: build
30
- services:
31
- docker:
32
- image: docker:19.03.12
33
- options: --privileged
34
- ports:
35
- - 8000:8000
36
- - 9090:9090
37
- - 3000:3000
38
  steps:
39
  - name: Checkout code
40
  uses: actions/checkout@v2
41
 
42
- - name: Set up Docker Compose
43
- run: |
44
- docker-compose -f docker-compose.yml up -d
45
  - name: Run tests
46
  run: |
47
- docker-compose -f docker-compose.yml run tests
 
 
48
 
49
- push:
50
  runs-on: ubuntu-latest
51
  needs: test
52
 
@@ -54,33 +49,28 @@ jobs:
54
  - name: Checkout code
55
  uses: actions/checkout@v2
56
 
 
 
 
57
  - name: Login to Docker Hub
58
  uses: docker/login-action@v1
59
  with:
60
  username: ${{ secrets.DOCKER_USERNAME }}
61
  password: ${{ secrets.DOCKER_PASSWORD }}
62
 
63
- - name: Push application
64
- run: |
65
- docker run -d --name app --network example-network --ip 172.16.238.10 -p 8000:8000 macrdel/app:latest uvicorn app.api:app --host 0.0.0.0 --port 8000
66
-
67
- - name: Push Prometheus
68
- run: |
69
- docker run -d --name prometheus --network example-network --ip 172.16.238.11 -p 9090:9090 -v $(pwd)/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus:latest
70
-
71
- - name: Push Grafana
72
  run: |
73
- docker run -d --name grafana --network example-network --ip 172.16.238.12 -p 3000:3000 -v $(pwd)/grafana/provisioning:/etc/grafana/provisioning --env-file $(pwd)/grafana/provisioning/config.monitoring grafana/grafana
74
-
75
-
76
- deploy:
77
- runs-on: ubuntu-latest
78
- needs: push
79
- steps:
80
- - uses: actions/checkout@v2
81
- with:
82
- fetch-depth: 0
83
- - name: Deploy to Hugging Face Spaces
84
- env:
85
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
86
- run: git push --force https://macrdel:$HF_TOKEN@huggingface.co/spaces/macrdel/sentiment-summarize-youtube-comms master:main
 
21
  username: ${{ secrets.DOCKER_USERNAME }}
22
  password: ${{ secrets.DOCKER_PASSWORD }}
23
 
24
+ - name: Build Docker images
25
+ run: docker-compose build
26
+
27
+ - name: Push Docker images
28
+ run: docker-compose push
29
 
30
  test:
31
  runs-on: ubuntu-latest
32
  needs: build
33
+
 
 
 
 
 
 
 
34
  steps:
35
  - name: Checkout code
36
  uses: actions/checkout@v2
37
 
 
 
 
38
  - name: Run tests
39
  run: |
40
+ docker-compose up -d app prometheus grafana
41
+ docker-compose run --rm tests
42
+ docker-compose down
43
 
44
+ deploy:
45
  runs-on: ubuntu-latest
46
  needs: test
47
 
 
49
  - name: Checkout code
50
  uses: actions/checkout@v2
51
 
52
+ - name: Set up Docker Buildx
53
+ uses: docker/setup-buildx-action@v1
54
+
55
  - name: Login to Docker Hub
56
  uses: docker/login-action@v1
57
  with:
58
  username: ${{ secrets.DOCKER_USERNAME }}
59
  password: ${{ secrets.DOCKER_PASSWORD }}
60
 
61
+ - name: Deploy services locally
 
 
 
 
 
 
 
 
62
  run: |
63
+ docker-compose up -d app prometheus grafana
64
+ docker-compose up -d
65
+
66
+ # deploy:
67
+ # runs-on: ubuntu-latest
68
+ # needs: push
69
+ # steps:
70
+ # - uses: actions/checkout@v2
71
+ # with:
72
+ # fetch-depth: 0
73
+ # - name: Deploy to Hugging Face Spaces
74
+ # env:
75
+ # HF_TOKEN: ${{ secrets.HF_TOKEN }}
76
+ # run: git push --force https://macrdel:$HF_TOKEN@huggingface.co/spaces/macrdel/sentiment-summarize-youtube-comms master:main