Skip to content

Commit 58235bc

Browse files
committed
Switch to github actions for CI/CD
1 parent 42cefab commit 58235bc

File tree

4 files changed

+283
-57
lines changed

4 files changed

+283
-57
lines changed

.github/worfklows/CI.yml

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
2+
3+
name: CI
4+
on:
5+
push:
6+
branches:
7+
- staging
8+
- testing
9+
- '1.5'
10+
- '1.6'
11+
- '1.7'
12+
- '1.8'
13+
- master
14+
# version tags, e.g. 1.7.1
15+
- '[1-9].[0-9].[0-9]'
16+
# pre-releases, e.g. 1.8-pre1
17+
- 1.8-pre[0-9]
18+
# test branches, e.g. test-debian
19+
- test-*
20+
21+
###############################################
22+
# REQUIRED secrets
23+
# DOCKER_UN: ${{ secrets.Docker_Login }}
24+
# Username of docker login for pushing the images to repo $DOCKER_ORG
25+
# DOCKER_PW: ${{ secrets.Docker_Password }}
26+
# Password of docker login for pushing the images to repo $DOCKER_ORG
27+
# DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
28+
# The docker repository where the images are pushed to.
29+
#
30+
# Add the above secrets to your github repo to determine where the images will be pushed.
31+
################################################
32+
33+
jobs:
34+
build:
35+
name: build
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- uses: actions/checkout@v2
40+
- name: Extract branch name
41+
shell: bash
42+
run: |
43+
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
44+
- name: install python packages
45+
run: python3 -m pip install -r tests/requirements.txt
46+
- name: check docker-compose version
47+
run: docker-compose -v
48+
- name: login docker
49+
env:
50+
DOCKER_UN: ${{ secrets.Docker_Login }}
51+
DOCKER_PW: ${{ secrets.Docker_Password }}
52+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
53+
run: echo "$DOCKER_PW" | docker login --username $DOCKER_UN --password-stdin
54+
# In this step, this action saves a list of existing images,
55+
# the cache is created without them in the post run.
56+
# It also restores the cache if it exists.
57+
- uses: satackey/[email protected]
58+
# Ignore the failure of a step and avoid terminating the job.
59+
continue-on-error: true
60+
- name: build all docker images
61+
env:
62+
MAILU_VERSION: ${{ env.BRANCH }}
63+
TRAVIS_BRANCH: ${{ env.BRANCH }}
64+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
65+
run: docker-compose -f tests/build.yml build
66+
67+
#NOTE: It appears the filter test depends on the core test. The filter test requires an email user
68+
#that is created by the core test.
69+
core-test:
70+
name: core test
71+
runs-on: ubuntu-latest
72+
needs:
73+
- build
74+
steps:
75+
- uses: actions/checkout@v2
76+
- name: Extract branch name
77+
shell: bash
78+
run: |
79+
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
80+
- name: install python packages
81+
run: python3 -m pip install -r tests/requirements.txt
82+
- uses: satackey/[email protected]
83+
# Ignore the failure of a step and avoid terminating the job.
84+
continue-on-error: true
85+
- name: copy all certs
86+
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
87+
- name: test core suite
88+
run: python tests/compose/test.py core 1
89+
env:
90+
MAILU_VERSION: ${{ env.BRANCH }}
91+
TRAVIS_BRANCH: ${{ env.BRANCH }}
92+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
93+
94+
filter-test:
95+
name: filter test
96+
runs-on: ubuntu-latest
97+
needs:
98+
- build
99+
steps:
100+
- uses: actions/checkout@v2
101+
- name: Extract branch name
102+
shell: bash
103+
run: |
104+
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
105+
- name: install python packages
106+
run: python3 -m pip install -r tests/requirements.txt
107+
- uses: satackey/[email protected]
108+
# Ignore the failure of a step and avoid terminating the job.
109+
continue-on-error: true
110+
- name: copy all certs
111+
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
112+
- name: 'test clamvav'
113+
run: python tests/compose/test.py filters 2
114+
env:
115+
MAILU_VERSION: ${{ env.BRANCH }}
116+
TRAVIS_BRANCH: ${{ env.BRANCH }}
117+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
118+
119+
fetch-test:
120+
name: fetch test
121+
runs-on: ubuntu-latest
122+
needs:
123+
- build
124+
steps:
125+
- uses: actions/checkout@v2
126+
- name: Extract branch name
127+
shell: bash
128+
run: |
129+
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
130+
- name: install python packages
131+
run: python3 -m pip install -r tests/requirements.txt
132+
- uses: satackey/[email protected]
133+
# Ignore the failure of a step and avoid terminating the job.
134+
continue-on-error: true
135+
- name: copy all certs
136+
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
137+
- name: test fetch
138+
run: python tests/compose/test.py fetchmail 1
139+
env:
140+
MAILU_VERSION: ${{ env.BRANCH }}
141+
TRAVIS_BRANCH: ${{ env.BRANCH }}
142+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
143+
144+
rainloop-test:
145+
name: rainloop test
146+
runs-on: ubuntu-latest
147+
needs:
148+
- build
149+
steps:
150+
- uses: actions/checkout@v2
151+
- name: Extract branch name
152+
shell: bash
153+
run: |
154+
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
155+
- name: install python packages
156+
run: python3 -m pip install -r tests/requirements.txt
157+
- uses: satackey/[email protected]
158+
# Ignore the failure of a step and avoid terminating the job.
159+
continue-on-error: true
160+
- name: copy all certs
161+
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
162+
- name: test rainloop
163+
run: python tests/compose/test.py rainloop 1
164+
env:
165+
MAILU_VERSION: ${{ env.BRANCH }}
166+
TRAVIS_BRANCH: ${{ env.BRANCH }}
167+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
168+
169+
roundcube-test:
170+
name: roundcube test
171+
runs-on: ubuntu-latest
172+
needs:
173+
- build
174+
steps:
175+
- uses: actions/checkout@v2
176+
- name: Extract branch name
177+
shell: bash
178+
run: |
179+
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
180+
- name: install python packages
181+
run: python3 -m pip install -r tests/requirements.txt
182+
- uses: satackey/[email protected]
183+
# Ignore the failure of a step and avoid terminating the job.
184+
continue-on-error: true
185+
- name: copy all certs
186+
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
187+
- name: test roundcube
188+
run: python tests/compose/test.py roundcube 1
189+
env:
190+
MAILU_VERSION: ${{ env.BRANCH }}
191+
TRAVIS_BRANCH: ${{ env.BRANCH }}
192+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
193+
194+
webdav-test:
195+
name: webdav test
196+
runs-on: ubuntu-latest
197+
needs:
198+
- build
199+
steps:
200+
- uses: actions/checkout@v2
201+
- name: Extract branch name
202+
shell: bash
203+
run: |
204+
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
205+
- name: install python packages
206+
run: python3 -m pip install -r tests/requirements.txt
207+
- uses: satackey/[email protected]
208+
# Ignore the failure of a step and avoid terminating the job.
209+
continue-on-error: true
210+
- name: copy all certs
211+
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
212+
- name: test webdav
213+
run: python tests/compose/test.py webdav 1
214+
env:
215+
MAILU_VERSION: ${{ env.BRANCH }}
216+
TRAVIS_BRANCH: ${{ env.BRANCH }}
217+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
218+
219+
deploy:
220+
name: deploy step
221+
runs-on: ubuntu-latest
222+
needs:
223+
- build
224+
- core-test
225+
- filter-test
226+
- fetch-test
227+
- rainloop-test
228+
- roundcube-test
229+
- webdav-test
230+
steps:
231+
- uses: actions/checkout@v2
232+
- name: Extract branch name
233+
shell: bash
234+
run: |
235+
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
236+
- name: install python packages
237+
run: python3 -m pip install -r tests/requirements.txt
238+
- uses: satackey/[email protected]
239+
# Ignore the failure of a step and avoid terminating the job.
240+
continue-on-error: true
241+
- name: copy all certs
242+
run: sudo -- sh -c 'mkdir -p /mailu && cp -r tests/certs /mailu && chmod 600 /mailu/certs/*'
243+
- name: login docker
244+
env:
245+
DOCKER_UN: ${{ secrets.Docker_Login }}
246+
DOCKER_PW: ${{ secrets.Docker_Password }}
247+
run: echo "$DOCKER_PW" | docker login --username $DOCKER_UN --password-stdin
248+
- name: build all docker images
249+
run: docker-compose -f tests/build.yml build
250+
env:
251+
MAILU_VERSION: ${{ env.BRANCH }}
252+
TRAVIS_BRANCH: ${{ env.BRANCH }}
253+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
254+
- name: deploy built docker images
255+
env:
256+
DOCKER_UN: ${{ secrets.Docker_Login }}
257+
DOCKER_PW: ${{ secrets.Docker_Password }}
258+
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
259+
MAILU_VERSION: ${{ env.BRANCH }}
260+
TRAVIS_BRANCH: ${{ env.BRANCH }}
261+
TRAVIS_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
262+
run: bash tests/deploy.sh
263+
264+
# This job is watched by bors. It only complets if building,testing and deploy worked.
265+
ci-success:
266+
name: CI-Done
267+
#Returns true when none of the **previous** steps have failed or been canceled.
268+
if: ${{ success() }}
269+
needs:
270+
- deploy
271+
runs-on: ubuntu-latest
272+
steps:
273+
- name: CI/CD succeeded.
274+
run: exit 0
275+
276+

.travis.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

bors.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
status = [
2-
"continuous-integration/travis-ci/push"
2+
"CI-Done"
33
]
4+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
echo "Creating user required for next test ..."
2+
# Should not fail and update the password; update mode
3+
docker-compose -f tests/compose/filters/docker-compose.yml exec -T admin flask mailu admin admin mailu.io 'password' --mode=update || exit 1
4+
docker-compose -f tests/compose/filters/docker-compose.yml exec -T admin flask mailu user user mailu.io 'password' || exit 1
5+
echo "User created successfully"

0 commit comments

Comments
 (0)