Replace usage of Enum plus str mixin with StrEnum #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", "3.11"] | |
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 -r requirements.txt | |
pip install mage_integrations/ | |
pip install "git+https://github.com/mage-ai/singer-python.git#egg=singer-python" | |
pip install "git+https://github.com/mage-ai/sqlglot#egg=sqlglot" | |
- 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: "18.18.0" | |
- 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 |