-
Notifications
You must be signed in to change notification settings - Fork 6
89 lines (75 loc) · 2.47 KB
/
Copy pathe2e.yml
File metadata and controls
89 lines (75 loc) · 2.47 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
# .github/workflows/e2e.yml
name: E2E
on:
schedule:
- cron: '0 5 * * 1-5' # weekday nights to catch API drift
workflow_dispatch:
jobs:
e2e-linux:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install pytest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build E2E image (cached)
uses: docker/build-push-action@v5
with:
context: .
file: tests/e2e/Dockerfile
tags: codeplain-e2e:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run E2E tests
env:
CODEPLAIN_API_KEY: ${{ secrets.CODEPLAIN_API_KEY }}
run: pytest tests/e2e/ -v --tb=short
- name: Upload generated outputs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: e2e-outputs-linux
path: /tmp/pytest-of-runner/**/container_work*/**
e2e-windows:
runs-on: windows-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install pytest
- name: Run E2E tests
env:
CODEPLAIN_API_KEY: ${{ secrets.CODEPLAIN_API_KEY }}
run: pytest tests/e2e/ -v --tb=short
notify-on-failure:
name: Notify Slack on failure
needs: [e2e-linux, e2e-windows]
if: failure()
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_E2E_WEBHOOK_URL }}
steps:
- name: Determine failed platforms
id: platforms
run: |
failed=""
[ "${{ needs.e2e-linux.result }}" = "failure" ] && failed="Linux"
if [ "${{ needs.e2e-windows.result }}" = "failure" ]; then
[ -n "$failed" ] && failed="$failed and Windows" || failed="Windows"
fi
echo "failed=$failed" >> "$GITHUB_OUTPUT"
- name: Send failure notification to Slack
if: ${{ env.SLACK_WEBHOOK_URL != '' }}
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"text": ${{ toJSON(format('[Codeplain Client] E2E tests FAILED on {0}. See <{1}/{2}/actions/runs/{3}|the run log>.', steps.platforms.outputs.failed, github.server_url, github.repository, github.run_id)) }}
}