Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Playwright Tests
on: [push, pull_request]
env:
PIP_EXTRA_INDEX_URL: ${{vars.PIP_EXTRA_INDEX_URL}}
UV_PROJECT_ENVIRONMENT: venv
jobs:
playwright:
timeout-minutes: 60
Expand All @@ -10,22 +11,24 @@ jobs:
matrix:
project: ["chromium", "firefox", "webkit"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: |
requirements.txt
'requirements/requirements*.txt'
enable-cache: true
- name: Install backend dependencies
run: python3 -m pip install -r requirements.txt
- uses: actions/setup-node@v3
run: uv sync --group=deploy
- uses: actions/setup-node@v6
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps ${{matrix.project}}
run: |
npm install -D @playwright/test@latest
npx playwright install --with-deps ${{matrix.project}}
- name: Run Playwright tests
run: npx playwright test --project=${{matrix.project}} --reporter github
run: |
source venv/bin/activate
npx playwright test --project=${{matrix.project}} --reporter github
63 changes: 18 additions & 45 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ pipeline {
mineRepository()
sh(
label: 'Create virtual environment',
script: '''uv venv venv
. ./venv/bin/activate
uv pip install -r requirements-dev.txt
uv pip install -e .
'''
script: 'uv sync --frozen --group=ci'
)
cache(maxCacheSize: 1000, caches: [
arbitraryFileCache(
Expand All @@ -96,9 +92,7 @@ pipeline {
steps{
catchError(buildResult: 'UNSTABLE', message: 'Did not pass all pytest tests', stageResult: "UNSTABLE") {
sh(
script: '''. ./venv/bin/activate
coverage run --parallel-mode -m pytest --junitxml=./reports/tests/pytest/pytest-junit.xml
'''
script: 'uv run coverage run --parallel-mode -m pytest --junitxml=./reports/tests/pytest/pytest-junit.xml'
)
}
}
Expand All @@ -110,18 +104,16 @@ pipeline {
}
stage('Audit Requirement Freeze File'){
steps{
catchError(buildResult: 'UNSTABLE', message: 'pip-audit found issues', stageResult: 'UNSTABLE') {
sh 'uvx --python-preference=only-managed --with-requirements requirements.txt pip-audit --cache-dir=/tmp/pip-audit-cache --local'
catchError(buildResult: 'SUCCESS', message: 'uv-secure found issues', stageResult: 'UNSTABLE') {
sh 'uv run --only-group=audit-dependencies --frozen --isolated uv-secure --disable-cache uv.lock'
}
}
}
stage('Flake8') {
steps{
catchError(buildResult: 'SUCCESS', message: 'Flake8 found issues', stageResult: "UNSTABLE") {
sh(label: 'Run Flake8',
script: '''. ./venv/bin/activate
flake8 src/backend/speedcloud --tee --output-file=logs/flake8.log
''')
script: 'uv run flake8 src/backend/speedcloud --tee --output-file=logs/flake8.log')
}
}
post {
Expand All @@ -136,13 +128,12 @@ pipeline {
tee('logs/mypy.log') {
catchError(buildResult: 'SUCCESS', message: 'MyPy found issues', stageResult: 'UNSTABLE') {
sh(
label: "Running MyPy",
script: '''. ./venv/bin/activate
mypy --version
label: 'Running MyPy',
script: '''uv run mypy --version
mkdir -p reports/mypy/html
mkdir -p logs
mypy -p speedcloud --html-report reports/mypy/html --linecoverage-report reports/mypy/linecoverage
'''
uv run mypy -p speedcloud --html-report reports/mypy/html --linecoverage-report reports/mypy/linecoverage
'''
)
}
}
Expand All @@ -164,9 +155,7 @@ pipeline {
tee('reports/pydocstyle-report.txt'){
sh(
label: 'Run pydocstyle',
script: '''. ./venv/bin/activate
pydocstyle src/backend/speedcloud
'''
script: 'uv run pydocstyle src/backend/speedcloud'
)
}
}
Expand All @@ -184,17 +173,13 @@ pipeline {
tee('reports/pylint_issues.txt'){
sh(
label: 'Running pylint',
script: '''. ./venv/bin/activate
pylint src/backend/speedcloud -r n --msg-template="{path}:{module}:{line}: [{msg_id}({symbol}), {obj}] {msg}"
''',
script: 'uv run pylint src/backend/speedcloud -r n --msg-template="{path}:{module}:{line}: [{msg_id}({symbol}), {obj}] {msg}"',
)
}
}
sh(
label: 'Running pylint for sonarqube',
script: '''. ./venv/bin/activate
pylint src/backend/speedcloud -d duplicate-code --output-format=parseable | tee reports/pylint.txt
''',
script: 'uv run pylint src/backend/speedcloud -d duplicate-code --output-format=parseable | tee reports/pylint.txt',
returnStatus: true
)
}
Expand Down Expand Up @@ -263,16 +248,10 @@ pipeline {
}
}
post{
unsuccessful{
sh '''. ./venv/bin/activate
uv pip list
'''
}
always{
sh(label: 'combining coverage data',
script: '''. ./venv/bin/activate
coverage combine
coverage xml -o ./reports/python-coverage.xml
script: '''uv run coverage combine
uv run coverage xml -o ./reports/python-coverage.xml
'''
)
recordCoverage(tools: [[parser: 'COBERTURA', pattern: 'reports/coverage.xml']])
Expand Down Expand Up @@ -310,7 +289,7 @@ pipeline {
withCredentials([string(credentialsId: params.SONARCLOUD_TOKEN, variable: 'token')]) {
sh(
label: 'Running Sonar Scanner',
script: "uvx pysonar -t \$token -Dsonar.projectVersion=$PACKAGE_VERSION -Dsonar.buildString=\"$BUILD_TAG\" ${env.CHANGE_ID? '-Dsonar.pullrequest.key=$CHANGE_ID -Dsonar.pullrequest.base=$BRANCH_NAME': '-Dsonar.branch.name=$BRANCH_NAME'}"
script: "uv run pysonar -t \$token -Dsonar.projectVersion=$PACKAGE_VERSION -Dsonar.buildString=\"$BUILD_TAG\" ${env.CHANGE_ID? '-Dsonar.pullrequest.key=$CHANGE_ID -Dsonar.pullrequest.base=$BRANCH_NAME': '-Dsonar.branch.name=$BRANCH_NAME'}"
)
}
}
Expand Down Expand Up @@ -364,7 +343,7 @@ pipeline {
checkout scm
envs = sh(
label: 'Get tox environments',
script: 'uvx --quiet --with tox-uv tox list -d --no-desc',
script: 'uv run --quiet --only-group=tox --frozen tox list -d --no-desc',
returnStdout: true,
).trim().split('\n')
} finally{
Expand All @@ -385,20 +364,14 @@ pipeline {
"Tox Environment: ${toxEnv}",
{
node('docker && linux'){
checkout scm
docker.image('ghcr.io/astral-sh/uv:debian').inside('--mount source=python-tmp-cloudwagon,target=/tmp --tmpfs /.local/bin:exec'){
checkout scm
try{
sh( label: 'Running Tox',
script: """uv python install cpython-${version}
uvx -p ${version} --with tox-uv tox run -e ${toxEnv}
uv run -p ${version} --only-group=tox-uv --frozen tox run -e ${toxEnv}
"""
)
} catch(e) {
sh(script: '''. ./venv/bin/activate
uv python list
'''
)
throw e
} finally{
cleanWs(
patterns: [
Expand Down
58 changes: 57 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,50 @@ dependencies =[
"speedwagon>=0.4.0b6",
"httpx"
]
[dependency-groups]
audit-dependencies = ['uv-secure']
test = [
"pytest<9",
"pytest-asyncio",
"pytest-timeout"
]
type-check = [
"mypy",
"types-setuptools",
"types-aiofiles"
]
code-style = ["flake8", "pydocstyle"]
deploy = ["uvicorn"]
lint = [
"pylint",
"ruff"
]
tox = [
"tox"
]
tox-uv = [
{include-group = "tox"},
"tox-uv-bare"
]

dev = [
"coverage",
{include-group = "security"},
{include-group = "lint"},
{include-group = "code-style"},
{include-group = "test"},
{include-group = "type-check"},
{include-group = "tox"},
]

ci = [
"pysonar",
{include-group = "dev"}
]

security = [
"bandit",
]

[tool.pytest.ini_options]
testpaths = ["tests"]
Expand Down Expand Up @@ -77,4 +121,16 @@ extend-immutable-calls = ["fastapi.Depends", "fastapi.params.Depends", "fastapi.
convention = "google"

[tool.black]
line-length = 79
line-length = 79

[tool.uv.sources]
speedwagon = {index = "uiuc_prescon_python"}

[[tool.uv.index]]
url = "https://pypi.org/simple"
default = true

[[tool.uv.index]]
name = "uiuc_prescon_python"
url = "https://nexus.library.illinois.edu/repository/uiuc_prescon_python/simple"
explicit = true
Loading
Loading