-
Notifications
You must be signed in to change notification settings - Fork 25
169 lines (135 loc) · 4.79 KB
/
ci.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
run-tests:
name: Setup and Run Tests
runs-on: ubuntu-latest
env:
RETRY_COUNT: 12 # number of retries for health checks
SLEEP_INTERVAL: 5 # Sleep duration in seconds between retries
MINIO_HEALTH_URL: http://localhost:9000/minio/health/live
DREMIO_HEALTH_URL: http://localhost:9047
MINIO_ROOT_USER: admin
MINIO_ROOT_PASSWORD: password
DREMIO_SOFTWARE_USERNAME: dremio
DREMIO_SOFTWARE_PASSWORD: dremio123
DREMIO_SOFTWARE_HOST: localhost
DREMIO_DATALAKE: dbt_test_source
DREMIO_DATABASE: dbt_test
DBT_TEST_USER_1: dbt_test_user_1
DBT_TEST_USER_2: dbt_test_user_2
DBT_TEST_USER_3: dbt_test_user_3
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Create Docker Network
run: |
docker network create ci-network || echo "Network already exists"
- name: Start MinIO Service
run: bash .github/scripts/start_minio.sh
- name: Start Dremio Service
run: bash .github/scripts/start_dremio.sh
- name: Install MinIO Client (mc)
run: bash .github/scripts/install_minio_client.sh
- name: Create MinIO bucket
run: bash .github/scripts/create_minio_bucket.sh
- name: Create Dremio S3 Source
run: bash .github/scripts/create_dremio_s3_source.sh
- name: Install Dependencies
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Python Dependencies
run: |
pip install --upgrade pip
pip install -r dev_requirements.txt
pip install .
- name: Create dbt test users
run: bash .github/scripts/create_dbt_test_users.sh
- name: Create dbt projects
run: bash .github/scripts/create_dbt_projects.sh
- name: Clean up __pycache__ directories
run: |
find . -type d -name "__pycache__" -exec rm -r {} +
- name: Create .env file for tests
run: bash .github/scripts/create_env_file.sh
- name: Run tests
run: bash .github/scripts/run_tests.sh
- name: Upload tests report as artifact
uses: actions/upload-artifact@v3
with:
name: all-tests-reports
path: reports/
upload-individual-test-reports:
name: Upload Tests Artifacts
runs-on: ubuntu-latest
needs: run-tests
steps:
- name: Download test reports
uses: actions/download-artifact@v3
with:
name: all-tests-reports
path: reports/
- name: Upload individual test reports
uses: actions/upload-artifact@v3
with:
name: individual-test-reports
path: reports/*.txt
verify-failures:
name: Verify Expected Test Failures
runs-on: ubuntu-latest
needs: [run-tests, upload-individual-test-reports]
steps:
- name: Check out repository
uses: actions/[email protected]
- name: Download All Test Reports
uses: actions/download-artifact@v3
with:
name: all-tests-reports
path: reports/
- name: Set Up Python Environment
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Extract Actual Failed Tests
run: |
shopt -s globstar
grep "FAILED" reports/**/*.txt | awk '{print $2}' | sort > actual_failures_sorted.txt
- name: Sort Expected Failures
run: sort .github/expected_failures.txt > expected_failures_sorted.txt
- name: Compare Actual Failures with Expected Failures
run: |
echo "Expected Failures:"
cat expected_failures_sorted.txt
echo ""
echo "Actual Failures:"
cat actual_failures_sorted.txt
echo ""
# Identify unexpected failures
unexpected_failures=$(comm -13 expected_failures_sorted.txt actual_failures_sorted.txt)
# Identify missing expected failures
missing_failures=$(comm -23 expected_failures_sorted.txt actual_failures_sorted.txt)
# Initialize exit code
exit_code=0
if [ -n "$unexpected_failures" ]; then
echo "Unexpected test failures detected:"
echo "$unexpected_failures"
exit_code=1
fi
if [ -n "$missing_failures" ]; then
echo "Expected test failures that did not occur (they passed):"
echo "$missing_failures"
exit_code=1
fi
if [ $exit_code -eq 0 ]; then
echo "All failed tests are expected, and all expected failures have occurred."
else
echo "Verification failed: There are unexpected or missing test failures."
fi
exit $exit_code