-
-
Notifications
You must be signed in to change notification settings - Fork 534
147 lines (127 loc) · 4.71 KB
/
e2e_tests.yml
File metadata and controls
147 lines (127 loc) · 4.71 KB
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
name: e2e tests
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
concurrency:
group: e2e-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
e2e-tests:
name: e2e tests
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
ruby_version: ["3.4.5"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/.buildx-cache
key: ${{ runner.os }}-test-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-test-buildx-
- name: Set up `.env` file
run: |
cd .devcontainer
cp .env.example .env
- name: Build rails mini image
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .devcontainer
file: .devcontainer/Dockerfile
target: rails-mini
tags: sentry-ruby/rails-mini:latest
build-args: |
IMAGE=ruby
VERSION=${{ matrix.ruby_version }}
push: false
load: true
cache-from: type=local,src=${{ runner.temp }}/.buildx-cache
cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max
- name: Build svelte mini image
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .devcontainer
file: .devcontainer/Dockerfile
target: svelte-mini
tags: sentry-ruby/svelte-mini:latest
build-args: |
IMAGE=ruby
VERSION=${{ matrix.ruby_version }}
push: false
load: true
cache-from: type=local,src=${{ runner.temp }}/.buildx-cache
cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max
- name: Build sentry-test image
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .devcontainer
file: .devcontainer/Dockerfile
target: test
tags: sentry-ruby/sentry-test:latest
build-args: |
IMAGE=ruby
VERSION=${{ matrix.ruby_version }}
push: false
load: true
cache-from: type=local,src=${{ runner.temp }}/.buildx-cache
cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max
- name: Start mini rails app
run: |
cd .devcontainer
source .env
docker compose --profile e2e up -d sentry-rails-mini
- name: Start mini svelte app
run: |
cd .devcontainer
source .env
docker compose --profile e2e up -d sentry-svelte-mini
- name: Wait for services to be fully ready
run: |
cd .devcontainer
source .env
echo "⏳ Waiting for services to be fully ready..."
# Wait for Rails app to respond with 200
timeout 90 bash -c 'until docker compose --profile e2e run --rm sentry-test curl -s -o /dev/null -w "%{http_code}" http://sentry-rails-mini:4000/health | grep -q "200"; do echo "Waiting for Rails app..."; sleep 2; done' || (echo "❌ Rails app failed to become ready" && exit 1)
echo "✅ Rails app is ready"
# Wait for Svelte app to respond with 200
timeout 90 bash -c 'until docker compose --profile e2e run --rm sentry-test curl -s -o /dev/null -w "%{http_code}" http://sentry-svelte-mini:4001/health | grep -q "200"; do echo "Waiting for Svelte app..."; sleep 2; done' || (echo "❌ Svelte app failed to become ready" && exit 1)
echo "✅ Svelte app is ready"
- name: Run e2e tests
run: |
cd .devcontainer
source .env
docker compose --profile e2e run --rm sentry-test bundle exec rake
- name: Stop e2e services
if: always()
run: |
cd .devcontainer
source .env
docker compose --profile e2e down
- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: e2e-test-logs-ruby-${{ matrix.ruby_version }}
path: |
log/sentry_debug_events.log
retention-days: 7
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf ${{ runner.temp }}/.buildx-cache
mv ${{ runner.temp }}/.buildx-cache-new ${{ runner.temp }}/.buildx-cache