-
Notifications
You must be signed in to change notification settings - Fork 5
122 lines (115 loc) · 3.42 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Platform
on:
push:
branches:
- main
- master
- release
- develop
env:
app: platform
GITHUB_TOKEN: ${{ secrets.REPOS_TOKEN }}
jobs:
build-and-push:
runs-on: [self-hosted, common]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Login to BIMData Docker Registry
uses: docker/login-action@v3
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@v6
with:
context: .
file: etc/withprevious.Dockerfile
push: true
pull: true
build-args: |
PREVIOUS_TAG=${{ env.tag }}
tags: |
docker-registry.bimdata.io/bimdata/${{ env.app }}:${{ github.sha }}
docker-registry.bimdata.io/bimdata/${{ env.app }}:${{ env.tag }}
unit-tests:
runs-on: [self-hosted, common]
needs: build-and-push
if: ${{ !contains(github.event.head_commit.message, '[skip unit]') }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Run unit tests
run: npm install && npm run test:unit
e2e-tests:
runs-on: [self-hosted, testendtoend]
needs: build-and-push
if: ${{ !contains(github.event.head_commit.message, '[skip e2e]') &&
github.ref != 'refs/heads/main' &&
github.ref != 'refs/heads/master' &&
github.ref != 'refs/heads/release' }}
steps:
- uses: actions/checkout@v4
with:
repository: bimdata/bimdata-test
ref: master
token: ${{ secrets.REPOS_TOKEN }}
- id: tag
name: Get docker tag
uses: bimdata/actions/get-docker-tag@v2
with:
branch: ${{ github.ref }}
- name: Run e2e tests
uses: ./end-to-end/
with:
ref: ${{ github.ref }}
docker_tag: ${{ env.tag }}
github_token: ${{ secrets.REPOS_TOKEN }}
vault_passwd: ${{ secrets.VAULT_PASSWD }}
cypress_version: 13.16.0
deploy:
runs-on: [self-hosted, common]
needs: build-and-push
steps:
- name: Login to BIMData Docker Registry
uses: docker/login-action@v3
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: ${{ env.app }}
vault-pass: ${{ secrets.ANSIBLE_VAULT_PASSWD }}
release:
runs-on: [self-hosted, common]
needs: build-and-push
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
check-latest: true
- run: npm install -g npm@latest
- run: npm ci
- name: Release
run: npm run release