-
Notifications
You must be signed in to change notification settings - Fork 5
87 lines (84 loc) · 2.49 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# This file is generated by ansible
name: Test, build and deploy
on:
push:
jobs:
test:
runs-on: [self-hosted, common]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: psycopg2 prerequisites
run: |
sudo apt-get update
sudo apt-get install libpq-dev -y
- name: Install poetry
uses: snok/install-poetry@v1
- name: Install library
run: poetry install --no-interaction
env:
C_INCLUDE_PATH: "/usr/include/python3.10"
- name: Run tests
run: >
poetry run pytest
env:
TEST_DB_HOST: postgres
TEST_DB_PORT: 5432
TEST_DB_NAME: platform-back-${{ github.run_id }}
TEST_DB_USER: bimdata
TEST_DB_PASSWORD: bimdata
build-and-push:
runs-on: [self-hosted, common]
needs: [test]
if: contains('
refs/heads/develop
refs/heads/release
refs/heads/master
refs/heads/main'
, github.ref)
steps:
- uses: actions/checkout@v3
- name: Login to BIMData Docker Registry
uses: docker/login-action@v2
with:
registry: docker-registry.bimdata.io
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- id: tag
name: Get docker tag
uses: bimdata/actions/get-docker-tag@v2
with:
branch: ${{ github.ref }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
pull: true
tags: |
docker-registry.bimdata.io/bimdata/platform_back:${{ github.sha }}
docker-registry.bimdata.io/bimdata/platform_back:${{ env.tag }}
deploy:
runs-on: [self-hosted, common]
needs: build-and-push
steps:
- name: Login to BIMData Docker Registry
uses: docker/login-action@v2
with:
registry: docker-registry.bimdata.io
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- id: tag
name: Get docker tag
uses: bimdata/actions/get-docker-tag@v2
with:
branch: ${{ github.ref }}
- name: Deploy on ${{ env.tag }}
uses: bimdata/actions/deployment@v2
with:
inventory: ${{ env.tag }}
app: platform-back
vault-pass: ${{ secrets.ANSIBLE_VAULT_PASSWD }}