-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (62 loc) · 1.98 KB
/
trademan_ci_cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Trademan CI/CD
on: [push]
env:
BOT_TAG: holohup/trademan_bot:latest
BASE_TAG: holohup/trademan_base:latest
jobs:
code_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: 'pip'
cache-dependency-path: '**/*requirements*.txt'
- name: Installing dependencies and testing scripts
run: |
python -m pip install --upgrade pip
pip install -r requirements-tests.txt
- name: Flake8 tests
run: python -m flake8
- name: Unit tests
run: pytest
build_image_and_push_to_docker_hub:
name: Build and Push Docker image to Docker Hub
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
runs-on: self-hosted
needs: code_tests
steps:
- name: check out repo
uses: actions/checkout@v2
- name: log in to docker
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: build and push bot to DockerHub
uses: docker/build-push-action@v4
with:
context: bot
push: true
tags: ${{ env.BOT_TAG }}
- name: build and push base to DockerHub
uses: docker/build-push-action@v4
with:
context: trademan
push: true
tags: ${{ env.BASE_TAG }}
send_message:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
needs: build_image_and_push_to_docker_hub
steps:
- name: send message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: ${{ github.workflow }} успешно выполнен!