-
Notifications
You must be signed in to change notification settings - Fork 50
149 lines (147 loc) · 6.16 KB
/
main.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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Main
on:
push:
paths-ignore:
- 'docs/**'
- README.md
jobs:
build-images:
runs-on: ubuntu-latest
strategy:
matrix:
image: ["authoring", "gateway", "publishing", "api", "editor"]
steps:
- uses: actions/checkout@v2
- name: Login Docker DH
if: ${{ github.repository == 'soluto/tweek' }}
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKER_USER }}
run: echo $DOCKERHUB_TOKEN | docker login --username $DOCKERHUB_USER --password-stdin
- name: build
run: |
echo $GITHUB_REPOSITORY
yarn docker-compose build ${{ matrix.image }} && \
docker save -o ${{ matrix.image }}-${{ github.sha }}.tar soluto/tweek-${{ matrix.image }} && \
echo cp -a ${{ matrix.image }}-${{ github.sha }}.tar .github/workflows/
cp -a ${{ matrix.image }}-${{ github.sha }}.tar .github/workflows/
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: build-images
path: |
.github/workflows/${{ matrix.image }}-${{ github.sha }}.tar
run-e2e-ui:
needs: ["build-images"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download build images
uses: actions/download-artifact@v2
with:
name: build-images
- name: load images into docker
run: echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker load -i {}-$GITHUB_SHA.tar
- name: run tests
run: yarn && yarn test:docker:ui
run-e2e-integration:
needs: ["build-images"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download build images
uses: actions/download-artifact@v2
with:
name: build-images
- name: load images into docker
run: echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker load -i {}-$GITHUB_SHA.tar
- name: run integration tests
working-directory: e2e/integration
run: |
yarn && yarn start gateway && yarn test:docker
run-net-tests:
needs: ["build-images"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download build images
uses: actions/download-artifact@v2
with:
name: build-images
- name: load images into docker
run: echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker load -i {}-$GITHUB_SHA.tar
- name: run smoke tests
run: yarn && yarn test:docker:smoke
push-images:
needs: ["run-net-tests", "run-e2e-integration", "run-e2e-ui"]
runs-on: ubuntu-latest
if: ${{ github.repository == 'soluto/tweek' && !startsWith(github.ref, 'refs/heads/dependabot') }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Login Docker DH
if: ${{ github.repository == 'soluto/tweek' }}
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKER_USER }}
run: echo $DOCKERHUB_TOKEN | docker login --username $DOCKERHUB_USER --password-stdin
- name: Download build images
uses: actions/download-artifact@v2
with:
name: build-images
- name: load images into docker
run: echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker load -i {}-$GITHUB_SHA.tar
- name: push branch
if: ${{ github.ref != 'refs/heads/master' }}
run: |
export GITHUB_BRANCH=$(echo $GITHUB_REF | sed -e "s/refs\/heads\///" -e "s/\//-/")
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker tag soluto/tweek-{} soluto/tweek-{}:$GITHUB_BRANCH
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker push soluto/tweek-{}:$GITHUB_BRANCH
- name: push master
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker tag soluto/tweek-{} soluto/tweek-{}:latest
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker push soluto/tweek-{}:latest
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker tag soluto/tweek-{} soluto/tweek-{}:$GITHUB_SHA
echo api publishing editor gateway authoring | xargs -n 1 | xargs -I {} docker push soluto/tweek-{}:$GITHUB_SHA
- name: check versions
if: ${{ github.ref == 'refs/heads/master' }}
working-directory: ".github/workflows"
run: |
./versions_to_deploy.sh
- name: Push new api version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_API_VERSION != '' }}
working-directory: ".github/workflows"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./push-tag.sh api $TWEEK_API_VERSION
- name: Push new editor version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_EDITOR_VERSION != '' }}
working-directory: ".github/workflows"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./push-tag.sh editor $TWEEK_EDITOR_VERSION
- name: Push new authoring version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_AUTHORING_VERSION != '' }}
working-directory: ".github/workflows"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./push-tag.sh authoring $TWEEK_AUTHORING_VERSION
- name: Push new publishing version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_PUBLISHING_VERSION != '' }}
working-directory: ".github/workflows"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./push-tag.sh publishing $TWEEK_PUBLISHING_VERSION
- name: Push new gateway version
if: ${{ github.ref == 'refs/heads/master' && env.TWEEK_GATEWAY_VERSION != '' }}
working-directory: ".github/workflows"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./push-tag.sh gateway $TWEEK_GATEWAY_VERSION