Skip to content

Commit

Permalink
Merge pull request princeton-nlp#152 from princeton-nlp/test-ci/add-s…
Browse files Browse the repository at this point in the history
…imple-tests

Add very simple CI
  • Loading branch information
john-b-yang committed Jul 2, 2024
2 parents ad61249 + 4ead1a5 commit 57d6f8d
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

name: Pytest

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

on:
push:
branches:
- main
- "test-ci/**"
paths-ignore:
- 'docs/**'
- 'README.md'
- 'mkdocs.yml'
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- 'README.md'
- 'mkdocs.yml'

# Not possible to test windows capability:
# https://github.com/orgs/community/discussions/25491
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: |
uv pip install --python ${Python_ROOT_DIR} '.'
- name: Install dev dependencies
run: |
uv pip install --python ${Python_ROOT_DIR} pytest pytest-cov
- name: Run pytest
uses: sjvrijn/pytest-last-failed@v2
with:
pytest-args: '--exitfirst --cov'
- name: Explicitly convert coverage to xml
run: coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: princeton-nlp/SWE-bench
16 changes: 16 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Configuration for codecov
coverage:
status:
project:
default:
# If we get < 45% coverage, codecov is gonna mark it a failure
target: 45%
threshold: null
patch:
default:
# Codecov won't mark it as a failure if a patch is not covered well
informational: true
github_checks:
# Don't mark lines that aren't covered
annotations: false

17 changes: 17 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import subprocess


def test_smoke_test():
cmd = ["python", "-m", "swebench.harness.run_evaluation", "--help"]
result = subprocess.run(cmd, capture_output=True)
print(result.stdout)
print(result.stderr)
assert result.returncode == 0


def test_one_instance():
cmd = ["python", "-m", "swebench.harness.run_evaluation", "--predictions_path", "gold", "--max_workers", "1", "--instance_ids", "sympy__sympy-20590", "--run_id", "validate-gold"]
result = subprocess.run(cmd, capture_output=True)
print(result.stdout)
print(result.stderr)
assert result.returncode == 0

0 comments on commit 57d6f8d

Please sign in to comment.