-
Notifications
You must be signed in to change notification settings - Fork 22
129 lines (109 loc) · 3.67 KB
/
test-e2e.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
123
124
125
126
127
128
129
name: 'Test: End-to-end'
on: pull_request
env:
HAB_LICENSE: accept-no-persist
HOLO_CACHE_TO: origin
HOLO_CACHE_FROM: origin
jobs:
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# TODO: wrap the next three steps an an emergence-studio action
- name: 'Stop default mysql service'
run: sudo service mysql stop
- name: 'Match system timezone to application default'
run: sudo timedatectl set-timezone America/New_York
- name: 'Initialize Chef Habitat environment'
uses: JarvusInnovations/habitat-action@action/v1
timeout-minutes: 5
env:
HAB_NGINX: |
[http.listen]
port = 5580
HAB_MYSQL: |
app_username = 'appadmin'
app_password = 'appadmin'
bind = '0.0.0.0'
HAB_PHP_RUNTIME: |
[sites.default.holo]
gitDir = '${{ github.workspace }}/.git'
with:
deps: |
jarvus/hologit
supervisor: |
core/mysql
emergence/php-runtime --bind="database:mysql.default"
emergence/nginx --bind="backend:php-runtime.default"
- name: Waiting for MySQL
run: |
until nc -z localhost 3306; do
sleep 0.5
echo -n "."
done
- name: Waiting for Emergence runtime
run: |
until nc -z localhost 9123; do
sleep 0.5
echo -n "."
done
- name: Configure command-line client access
run: |
sudo chmod ugo+xr \
/hab/svc/mysql/config \
/hab/svc/mysql/config/client.cnf \
/hab/svc/php-runtime/config \
/hab/svc/php-runtime/config/fpm-exec
ln -sf /hab/svc/mysql/config/client.cnf ~/.my.cnf
- name: Load site projection into emergence runtime
env:
HOLO_CACHE_FROM: origin
HOLO_CACHE_TO: origin
run: |
SITE_TREE="$(hab pkg exec jarvus/hologit git-holo project emergence-site)"
[ -n "${SITE_TREE}" ] || exit 1
hab pkg exec emergence/php-runtime emergence-php-load "${SITE_TREE}"
- name: Set up Cypress workspace
run: |
CYPRESS_TREE="$(hab pkg exec jarvus/hologit git-holo project cypress-workspace)"
[ -n "${CYPRESS_TREE}" ] || exit 1
mkdir "${GITHUB_WORKSPACE}.cypress-workspace"
git archive --format=tar "${CYPRESS_TREE}" | (cd "${GITHUB_WORKSPACE}.cypress-workspace" && tar xf -)
- name: Run Cypress tests
uses: cypress-io/github-action@v2
env:
GIT_DIR: ${{ github.workspace }}/.git
GIT_WORK_TREE: ${{ github.workspace }}
with:
browser: chrome
env: STUDIO_CONTAINER=,STUDIO_SSH=
working-directory: ${{ github.workspace }}.cypress-workspace
- name: Open access to crash log
if: always()
run: |
sudo chmod ugo+rX /hab/svc/php-runtime/{var,var/logs} || true
sudo chmod ugo+r /hab/svc/php-runtime/var/logs/crash.log || true
- name: Upload crash log
uses: actions/upload-artifact@v2
if: always()
with:
name: crash-log
path: /hab/svc/php-runtime/var/logs/crash.log
- name: Upload supervisor log
uses: actions/upload-artifact@v2
if: always()
with:
name: supervisor-log
path: /hab/sup/default/sup.log
- name: Upload Cypress screenshots
uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-screenshots
path: ${{ github.workspace }}.cypress-workspace/cypress/screenshots
- name: Upload Cypress videos
uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-videos
path: ${{ github.workspace }}.cypress-workspace/cypress/videos