Spaces:
Runtime error
Runtime error
macrdel
commited on
Commit
·
4a3c84b
1
Parent(s):
2c8418e
update workflow
Browse files- .github/workflows/main.yml +46 -14
.github/workflows/main.yml
CHANGED
|
@@ -1,15 +1,12 @@
|
|
| 1 |
-
name:
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
branches: [master]
|
| 6 |
|
| 7 |
-
workflow_dispatch:
|
| 8 |
-
|
| 9 |
jobs:
|
| 10 |
-
|
| 11 |
runs-on: ubuntu-latest
|
| 12 |
-
|
| 13 |
steps:
|
| 14 |
- name: Checkout code
|
| 15 |
uses: actions/checkout@v2
|
|
@@ -17,24 +14,59 @@ jobs:
|
|
| 17 |
- name: Set up Docker Buildx
|
| 18 |
uses: docker/setup-buildx-action@v1
|
| 19 |
|
| 20 |
-
- name: Login to
|
| 21 |
uses: docker/login-action@v1
|
| 22 |
with:
|
| 23 |
username: ${{ secrets.DOCKER_USERNAME }}
|
| 24 |
password: ${{ secrets.DOCKER_PASSWORD }}
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
- name: Run tests
|
| 27 |
-
run:
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
- name: Push Docker
|
| 34 |
-
|
| 35 |
-
|
| 36 |
|
| 37 |
-
|
| 38 |
runs-on: ubuntu-latest
|
| 39 |
needs: test-and-build
|
| 40 |
steps:
|
|
|
|
| 1 |
+
name: CI/CD Pipeline
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
branches: [master]
|
| 6 |
|
|
|
|
|
|
|
| 7 |
jobs:
|
| 8 |
+
build:
|
| 9 |
runs-on: ubuntu-latest
|
|
|
|
| 10 |
steps:
|
| 11 |
- name: Checkout code
|
| 12 |
uses: actions/checkout@v2
|
|
|
|
| 14 |
- name: Set up Docker Buildx
|
| 15 |
uses: docker/setup-buildx-action@v1
|
| 16 |
|
| 17 |
+
- name: Login to Docker Hub
|
| 18 |
uses: docker/login-action@v1
|
| 19 |
with:
|
| 20 |
username: ${{ secrets.DOCKER_USERNAME }}
|
| 21 |
password: ${{ secrets.DOCKER_PASSWORD }}
|
| 22 |
|
| 23 |
+
- name: Build Docker images
|
| 24 |
+
run: |
|
| 25 |
+
docker-compose -f docker-compose.yml build
|
| 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 |
+
- 8001:8000
|
| 36 |
+
- 8002:8000
|
| 37 |
+
- 9090:9090
|
| 38 |
+
- 3000:3000
|
| 39 |
+
- 8000:80
|
| 40 |
+
steps:
|
| 41 |
+
- name: Checkout code
|
| 42 |
+
uses: actions/checkout@v2
|
| 43 |
+
|
| 44 |
+
- name: Set up Docker Compose
|
| 45 |
+
run: |
|
| 46 |
+
docker-compose -f docker-compose.yml up -d
|
| 47 |
+
|
| 48 |
- name: Run tests
|
| 49 |
+
run: |
|
| 50 |
+
docker-compose -f docker-compose.yml run tests
|
| 51 |
|
| 52 |
+
push:
|
| 53 |
+
runs-on: ubuntu-latest
|
| 54 |
+
needs: test
|
| 55 |
+
steps:
|
| 56 |
+
- name: Checkout code
|
| 57 |
+
uses: actions/checkout@v2
|
| 58 |
+
|
| 59 |
+
- name: Login to Docker Hub
|
| 60 |
+
uses: docker/login-action@v1
|
| 61 |
+
with:
|
| 62 |
+
username: ${{ secrets.DOCKER_USERNAME }}
|
| 63 |
+
password: ${{ secrets.DOCKER_PASSWORD }}
|
| 64 |
|
| 65 |
+
- name: Push Docker images
|
| 66 |
+
run: |
|
| 67 |
+
docker-compose -f docker-compose.yml push
|
| 68 |
|
| 69 |
+
deploy:
|
| 70 |
runs-on: ubuntu-latest
|
| 71 |
needs: test-and-build
|
| 72 |
steps:
|