forked from mage-ai/mage-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (138 loc) · 4.72 KB
/
build_and_test.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
name: Build and test
on:
push:
paths:
- "mage_ai/**"
- "mage_integrations/**"
- "pyproject.toml"
- "requirements.txt"
- "setup.py"
pull_request:
paths:
- "mage_ai/**"
- "mage_integrations/**"
- "pyproject.toml"
- "requirements.txt"
- "setup.py"
jobs:
check-code-quality:
runs-on: ubuntu-latest
name: Check Code Quality
steps:
- name: Check out source repository
uses: actions/checkout@v3
with:
fetch-depth: 0
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
- name: Install Poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'poetry'
- name: Install Python dev dependencies
run: |
poetry install --no-interaction --only dev
poetry run pre-commit install
- id: changed-files
uses: tj-actions/changed-files@v36
with:
files_ignore: |
requirements.txt
- name: Run pre-commit hooks
run: poetry run pre-commit run --show-diff-on-failure --files ${{ steps.changed-files.outputs.all_changed_files }}
test_backend:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
needs: check-code-quality
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install freetds-dev
python -m pip install --upgrade pip
pip install "git+https://github.com/mage-ai/sqlglot#egg=sqlglot"
pip install -r requirements.txt
pip install mage_integrations/
pip install "git+https://github.com/mage-ai/singer-python.git#egg=singer-python"
- name: Run unit tests
run: |
python3 -m unittest discover -s mage_ai --failfast
env:
OPENAI_API_KEY: abcdefg
- name: Run mage integrations unit tests
run: |
cd mage_integrations && python3 -m unittest discover mage_integrations.tests
# Run Playwright web UI tests only run once per workflow (Python 3.10).
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "18.18.0"
if: matrix.python-version == '3.10'
- name: Create Mage test project
run: |
python mage_ai/cli/main.py init test_project
env:
PYTHONPATH: ${{ env.pythonLocation }}:.
if: matrix.python-version == '3.10'
- name: Build frontend, start server, and run Playwright tests
run: |
yarn install &&
yarn export_prod &&
yarn playwright install chromium &&
yarn playwright test -c playwright.config.ci.ts
working-directory: mage_ai/frontend/
env:
PYTHONPATH: ${{ env.pythonLocation }}:. # Playwright tests on CI depend on the Python web server
if: matrix.python-version == '3.10'
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: mage_ai/frontend/playwright-report/
retention-days: 3
test_web_server_windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.10"]
needs: check-code-quality
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
# Run Playwright web UI tests only run once per workflow (Python 3.10).
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "20.15.1"
- name: Create Mage test project
run: |
Start-Process -Wait -FilePath "C:\Program Files\Git\unins000.exe" -ArgumentList "/SILENT"
python -m venv venv3
venv3/Scripts/Activate.ps1
$env:PYTHONPATH = "${env:PYTHONPATH};${pwd}"
python -m pip install -r requirements.txt
python mage_ai/cli/main.py init test_project
- name: Build frontend, start server, and run Playwright tests
run: |
yarn install &&
yarn export_prod &&
yarn playwright install chromium &&
yarn playwright test -c playwright-windows.config.ci.ts
working-directory: mage_ai/frontend/
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: mage_ai/frontend/playwright-report/
retention-days: 3