-
-
Notifications
You must be signed in to change notification settings - Fork 14
71 lines (59 loc) · 1.79 KB
/
main.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
name: CI
on:
push:
branches:
- "**"
pull_request:
branches: ["main"]
schedule:
- cron: "0 0 * * *"
jobs:
tests:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
steps:
- name: Login to Docker hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v3
- name: Set Python version
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "{{ cookiecutter.project_name }}/requirements/*.txt"
- name: Install Cookiecutter
run: pip install cookiecutter
- name: Create a project from cookiecutter
run: cookiecutter . --no-input
- name: Install Docker Compose
run: |
curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
- name: Start Docker Compose
run: |
cd myproject
docker-compose -f unittest.yml up -d
- name: Run tests
run: |
sudo apt install -y libmemcached-dev
cd myproject
python3 -m venv venv
source ./venv/bin/activate
pip3 install -r requirements/test.txt
make test
- name: Building docker image
run: |
cd myproject
docker build -t tarsil/django:latest .
- name: Pushing docker image
run: |
docker push tarsil/django:latest