-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (77 loc) · 2.56 KB
/
test-data-generation.yml
File metadata and controls
94 lines (77 loc) · 2.56 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
name: Test Data Generation
on:
schedule:
- cron: '0 0 * * 1' # 毎週月曜日 0時
workflow_dispatch: # マニュアル実行も可能
jobs:
generate:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install faker
- name: Generate test data
run: |
python -c """
from backend.tests.data.data_generator import DataGenerator
from backend.tests.data.extended_data import ExtendedData
# ユーザーデータの生成
generator = DataGenerator()
users = generator.generate_user_data(10, invalid=True)
# アイテムデータの生成
items = ExtendedData.generate_extended_item_data(20, with_history=True)
# 認証データの生成
auth_data = ExtendedData.generate_extended_auth_data(5, with_refresh=True)
# データをファイルに保存
import json
with open('test-data.json', 'w') as f:
json.dump({
'users': [user.dict() for user in users],
'items': items,
'auth_data': auth_data
}, f, indent=2)
"""
- name: Upload test data
uses: actions/upload-artifact@v3
with:
name: test-data
path: test-data.json
- name: Generate test data report
run: |
python -c """
import json
with open('test-data.json') as f:
data = json.load(f)
print(f"Generated {len(data['users'])} users")
print(f"Generated {len(data['items'])} items")
print(f"Generated {len(data['auth_data'])} auth entries")
"""
- name: Create test data summary
run: |
python -c """
import json
with open('test-data.json') as f:
data = json.load(f)
summary = {
'total_users': len(data['users']),
'total_items': len(data['items']),
'total_auth_entries': len(data['auth_data']),
'generation_date': datetime.utcnow().isoformat()
}
with open('test-data-summary.json', 'w') as f:
json.dump(summary, f, indent=2)
"""
- name: Upload test data summary
uses: actions/upload-artifact@v3
with:
name: test-data-summary
path: test-data-summary.json