-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (50 loc) · 1.75 KB
/
ci.yaml
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
name: CI
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install test dependencies
run: pip install flake8
- name: Lint code
run: flake8 --extend-ignore=E501
- name: Install app dependencies
run: pip install -r app/requirements.txt
- name: Run tests
run: python manage.py test
working-directory: app
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker images
run: |
IMAGE=filipmania/urlshortener
docker build -t ${IMAGE}:${GITHUB_RUN_ID} -t ${IMAGE}:latest .
docker push ${IMAGE}:${GITHUB_RUN_ID}
docker push ${IMAGE}:latest
docker build --build-arg BUILD=mssql -t ${IMAGE}:${GITHUB_RUN_ID}-mssql -t ${IMAGE}:latest-mssql .
docker push ${IMAGE}:${GITHUB_RUN_ID}-mssql
docker push ${IMAGE}:latest-mssql
docker build --build-arg BUILD=nginx -t ${IMAGE}:${GITHUB_RUN_ID}-nginx -t ${IMAGE}:latest-nginx .
docker push ${IMAGE}:${GITHUB_RUN_ID}-nginx
docker push ${IMAGE}:latest-nginx
docker build -t ${IMAGE}:nginx -f compose/Dockerfile compose
docker push ${IMAGE}:nginx
- name: Save the IMAGE_TAG
run: echo "IMAGE_TAG=${GITHUB_RUN_ID}"