-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (116 loc) · 4.18 KB
/
tests.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
name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
inputs:
update_channel:
type: choice
description: 'Update channel'
options:
- latest
- stable
default: stable
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
UPDATE_CHANNEL: ${{ inputs.update_channel || 'stable' }}
jobs:
notify-build-start:
# Secrets are not available for forks for security reasons, so pull
# request checks will fail when trying to send the Slack notification.
# Unfortunately, there's no way to explicitly check that a secret is
# available, so we check for event_name instead:
# https://github.com/actions/runner/issues/520
if: ${{ github.event_name != 'pull_request' && inputs.update_channel != 'latest' }}
runs-on: ubuntu-latest
steps:
- uses: ivelum/[email protected]
id: slack
with:
channel_id: C0PT3267R
status: STARTED
color: '#ee9b00'
outputs:
status_message_id: ${{ steps.slack.outputs.message_id }}
lint-and-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- run: pip install -r requirements-tests.txt
- run: pip install --editable .
- run: flake8 --isort-show-traceback && pytest -m "not selenium"
setup-test:
name: Set up an on-premise instance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: 'pip'
- name: Install Teamplify
run: pip3 install --editable .
- name: Configure
run: teamplify configure
- name: Create backup directory
run: mkdir ${{ runner.temp }}/backup
- name: Set backup_mount
run: sed -i -e '/backup_mount =/ s|= .*|= ${{ runner.temp }}/backup|' ~/.teamplify.ini
- name: Set product key
run: sed -i -e '/product_key =/ s|= .*|= ${{ secrets.ONPREMISE_PRODUCT_KEY }}|' ~/.teamplify.ini
- name: Set update channel
run: sed -i -e '/update_channel =/ s|= .*|= ${{ env.UPDATE_CHANNEL }}|' ~/.teamplify.ini
- name: Disable crash reports
run: sed -i -e '/send_crash_reports =/ s|= .*|= no|' ~/.teamplify.ini
- name: Install stable Chrome
id: install-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
- name: Setup ChromeDriver
uses: nanasess/setup-chromedriver@v2
- name: Login to public ECR
run: docker login -u AWS -p $(aws --region us-east-1 ecr-public get-login-password) public.ecr.aws
- name: Wait for Teamplify to start
run: teamplify start
- run: pip install -r requirements-tests.txt
- name: Check that the login page is available
run: pytest -m "selenium"
- name: Test Teamplify backup command
run: teamplify backup ${{ runner.temp }}/backup/test-backup.sql.gz
notify-build-failure:
if: ${{ failure() && github.event_name != 'pull_request' }}
needs: [lint-and-tests, setup-test, notify-build-start]
runs-on: ubuntu-latest
steps:
- name: Notify slack fail
uses: ivelum/[email protected]
with:
channel_id: C0PT3267R
status: FAILED
color: '#d7263d'
notify-build-success:
if: ${{ github.event_name != 'pull_request' && inputs.update_channel != 'latest' }}
needs: [lint-and-tests, setup-test, notify-build-start]
runs-on: ubuntu-latest
steps:
- name: Notify slack success
uses: ivelum/[email protected]
with:
message_id: ${{ needs.notify-build-start.outputs.status_message_id }}
channel_id: C0PT3267R
status: SUCCESS
color: '#16db65'