Skip to content

Commit

Permalink
Configure CI and do some general cleanup (#20)
Browse files Browse the repository at this point in the history
Add CI workflows and improve testing

- Implement CI workflows for linting, testing, and deployment
  - lint-and-test.yml: Runs on dispatch or pull request
  - build-and-push.yml: Runs on dispatch or push to main
- Add unit tests for predictor.setup and predictor.predict
- Create requirements-dev.txt for development dependencies
- Fix lint and unit test failures
- Add global pylint settings
- Implement build-and-push job using Cog to build and push to r8.im/replicate/vllm
  • Loading branch information
joehoover authored Jul 30, 2024
1 parent 8d04b76 commit ecedce3
Show file tree
Hide file tree
Showing 10 changed files with 386 additions and 99 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI


on:
push:
branches:
- main
workflow_dispatch:

# Ensure only one workflow instance runs at a time. For branches other than the
# default branch, cancel the pending jobs in the group. For the default branch,
# queue them up. This avoids cancelling jobs that are in the middle of deploying
# to production.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Run pylint
run: |
pylint --recursive y tests/**/*.py
pylint --recursive y ./*.py
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Run unit tests
run: pytest tests/unit

build-and-push:
name: Build and push
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Cog
run: |
sudo curl -o /usr/local/bin/cog -L "https://github.com/replicate/cog/releases/latest/download/cog_$(uname -s)_$(uname -m)"
sudo chmod +x /usr/local/bin/cog
- name: Build and push
env:
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
run: |
cog build
cog push r8.im/replicate/vllm
37 changes: 37 additions & 0 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI


on:
pull_request:
workflow_dispatch:

# Ensure only one workflow instance runs at a time. For branches other than the
# default branch, cancel the pending jobs in the group. For the default branch,
# queue them up. This avoids cancelling jobs that are in the middle of deploying
# to production.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Run pylint
run: |
pylint --recursive y tests/**/*.py
pylint --recursive y ./*.py
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Run unit tests
run: pytest tests/unit
14 changes: 14 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[MESSAGES CONTROL]
disable=C0114, # Missing module docstring
E0611, # No name in module
W0201, # Attribute defined outside init
C0116, # Missing function docstring
W0621, # Redefined outer name
E0401, # Import error
R0903, # Too few public methods
R0913, # Too many arguments
R0914, # Too many local variables
C0115, # Missing class docstring

[REPORTS]
output-format=colorized
Loading

0 comments on commit ecedce3

Please sign in to comment.