forked from ubicloud/ubicloud
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (89 loc) · 3.42 KB
/
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
name: E2E CI
on:
workflow_dispatch:
# schedule:
# - cron: '0 */1 * * *'
jobs:
run-ci:
runs-on: ubicloud
environment: E2E-CI
timeout-minutes: 45
concurrency: e2e_environment
env:
DB_USER: clover
DB_PASSWORD: nonempty
DB_NAME: clover_test
services:
postgres:
image: postgres:15.4
env:
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_DB: ${{ env.DB_NAME }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Perform superuser-only actions, then remove superuser
run: |
psql "postgres://${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@localhost:5432/${{ env.DB_NAME }}" \
-c "CREATE EXTENSION citext; CREATE EXTENSION btree_gist; CREATE ROLE clover_password PASSWORD '${{ env.DB_PASSWORD }}' LOGIN; ALTER ROLE ${{ env.DB_USER }} NOSUPERUSER"
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .tool-versions
bundler-cache: true
- name: Apply migrations
env:
CLOVER_DATABASE_URL: postgres://${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@localhost:5432/${{ env.DB_NAME }}
run: bundle exec rake test_up
- name: Install foreman
run: gem install foreman
- name: Add e2e script to Procfile
run: |
echo "e2e: bin/ci" >> Procfile
- name: Run services
env:
RACK_ENV: development
CLOVER_DATABASE_URL: postgres://${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@localhost:5432/${{ env.DB_NAME }}
CLOVER_SESSION_SECRET: kbaf1V3biZ+R2QqFahgDLB5/lSomwxQusA4PwROUkFS1srn0xM/I47IdLW7HjbQoxWri6/aVgtkqTLFiP65h9g==
CLOVER_COLUMN_ENCRYPTION_KEY: TtlY0+hd4lvedPkNbu5qsj5H7giPKJSRX9KDBrvid7c=
CI_HETZNER_SACRIFICIAL_SERVER_ID: ${{ secrets.CI_HETZNER_SACRIFICIAL_SERVER_ID }}
HETZNER_USER: ${{ secrets.HETZNER_USER }}
HETZNER_PASSWORD: ${{ secrets.HETZNER_PASSWORD }}
run: foreman start
- name: Send notification if failed
if: ${{ failure() && github.ref_name == 'main' }}
uses: slackapi/slack-github-action@v1.25.0
with:
payload: |
{
"text": "*E2E Tests Failed* :this-is-fine-fire:",
"attachments": [
{
"color": "E33122",
"fields": [
{
"title": "Event",
"short": true,
"value": "${{ github.event_name }}"
},
{
"title": "Reference",
"short": true,
"value": "<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.ref_name }}>"
},
{
"title": "Action",
"short": false,
"value": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_PAGER_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK