From 3aa00683acf60d4da7f0baf92ab434ad06ebb8ef Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Mon, 23 Sep 2024 13:15:24 -0700 Subject: [PATCH] Tailor CI to our purposes --- .github/workflows/build-docs.yaml | 43 ----------------- .github/workflows/check-links.yaml | 15 ------ .github/workflows/pyright.yaml | 48 +++++++++++++++++++ .github/workflows/pytest.yaml | 22 +++------ .../workflows/release-dockerhub-nightly.yaml | 24 ---------- .../workflows/release-dockerhub-release.yaml | 22 --------- pyproject.toml | 3 +- 7 files changed, 57 insertions(+), 120 deletions(-) delete mode 100644 .github/workflows/build-docs.yaml delete mode 100644 .github/workflows/check-links.yaml create mode 100644 .github/workflows/pyright.yaml delete mode 100644 .github/workflows/release-dockerhub-nightly.yaml delete mode 100644 .github/workflows/release-dockerhub-release.yaml diff --git a/.github/workflows/build-docs.yaml b/.github/workflows/build-docs.yaml deleted file mode 100644 index 5a05349de..000000000 --- a/.github/workflows/build-docs.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: build-docs - -on: - push: - branches: - - main - - "build-docs-*" - pull_request: - branches: - - main -permissions: - contents: write -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Configure Git Credentials - run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - uses: actions/cache@v4 - with: - key: mkdocs-material-${{ env.cache_id }} - path: .cache - restore-keys: | - mkdocs-material- - - name: Install uv - run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - - run: uv pip install --python ${Python_ROOT_DIR} '.[dev]' - - name: Build Documentation - if: github.ref != 'refs/heads/main' - run: mkdocs build - - name: Build + Deploy Documentation - if: github.ref == 'refs/heads/main' - run: mkdocs gh-deploy --force diff --git a/.github/workflows/check-links.yaml b/.github/workflows/check-links.yaml deleted file mode 100644 index 9588b7090..000000000 --- a/.github/workflows/check-links.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: Check Markdown links - -on: - workflow_dispatch: - push: - pull_request: - schedule: - - cron: "0 0 1 * *" - -jobs: - markdown-link-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: gaurav-nelson/github-action-markdown-link-check@v1 diff --git a/.github/workflows/pyright.yaml b/.github/workflows/pyright.yaml new file mode 100644 index 000000000..2d48bc4cd --- /dev/null +++ b/.github/workflows/pyright.yaml @@ -0,0 +1,48 @@ + +name: Pyright + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +on: + push: + branches: + - main + 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.10' + - name: Create keys.cfg + run: | + touch keys.cfg + - name: Install rye + run: | + curl -LsSf https://astral.sh/rye/install.sh | sh + - name: Install dependencies + run: | + rye sync + - name: Typecheck replayio code + run: | + rye run replayio-typecheck diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 5593d54fc..5ba3276b3 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -33,27 +33,19 @@ jobs: uses: actions/checkout@v2 - uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.10' - name: Pull swe-agent docker container run: | docker pull sweagent/swe-agent:latest - name: Create keys.cfg run: | touch keys.cfg - - name: Install uv + - name: Install rye run: | - curl -LsSf https://astral.sh/uv/install.sh | sh + curl -LsSf https://astral.sh/rye/install.sh | sh - name: Install dependencies run: | - uv pip install --python ${Python_ROOT_DIR} '.[dev]' - - 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-agent \ No newline at end of file + rye sync + - name: Run replayio tests + run: | + rye run replayio-tests diff --git a/.github/workflows/release-dockerhub-nightly.yaml b/.github/workflows/release-dockerhub-nightly.yaml deleted file mode 100644 index 90f90d621..000000000 --- a/.github/workflows/release-dockerhub-nightly.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Release to dockerhub (nightly) - -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * *' - push: - tags: - - 'v*.*.*' - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: sweagent - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Checkout code - uses: actions/checkout@v2 - - name: Run release script - if: (github.ref == 'refs/heads/main') && (github.repository == 'princeton-nlp/SWE-agent') - run: ./release_dockerhub.sh sweagent latest \ No newline at end of file diff --git a/.github/workflows/release-dockerhub-release.yaml b/.github/workflows/release-dockerhub-release.yaml deleted file mode 100644 index 40e95e2d2..000000000 --- a/.github/workflows/release-dockerhub-release.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: Release to dockerhub (release) - -on: - push: - tags: - - 'v*.*.*' - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: sweagent - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Checkout code - uses: actions/checkout@v2 - - name: Get release name - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV - - name: Run release script - run: ./release_dockerhub.sh sweagent ${{ env.RELEASE_VERSION }} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 418111033..5c17236fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -224,4 +224,5 @@ aci = "aci" required-imports = ["from __future__ import annotations"] [tool.rye.scripts] -replayio-tests = "pytest -m replayio" \ No newline at end of file +replayio-tests = "pytest -m replayio" +replayio-typecheck = "pyright tdd/**/*.py sweagent/investigations/**/*.py"