Refactor the ModerationAnalyzer class and update comments. #25
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: Run Tests | |
on: | |
push: | |
branches: [ "main", "ci-testing" ] | |
permissions: | |
contents: read | |
jobs: | |
test-all-extras: | |
name: Test with all extra dependencies | |
# (expected to include all tests) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install the latest version of rye | |
uses: eifinger/setup-rye@v3 | |
- name: Install dependencies | |
run: | | |
cd analyzer | |
rye sync | |
- name: Run tests | |
env: | |
OPENAI_API_KEY: ${{ secrets.CI_OPENAI_API_KEY }} | |
run: | | |
cd analyzer | |
rye test | |
test-examples: | |
name: Test invariant.examples | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install the latest version of rye | |
uses: eifinger/setup-rye@v3 | |
- name: Install dependencies | |
run: | | |
cd analyzer | |
rye sync # requires all extras | |
- name: Run invariant.examples | |
env: | |
OPENAI_API_KEY: ${{ secrets.CI_OPENAI_API_KEY }} | |
run: | | |
cd analyzer | |
rye run python -m unittest discover -s invariant/examples -p "*_example.py" | |
test-no-extras: | |
name: Test without extra dependencies | |
# (some tests will be skipped, but this is the default setup when users install the package) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install the latest version of rye | |
uses: eifinger/setup-rye@v3 | |
- name: Install dependencies | |
run: | | |
cd analyzer | |
rye sync --no-dev | |
- name: Run tests | |
# use 'unittest' explicitly, to prevent rye from install dev dependencies (no extras run) | |
run: | | |
cd analyzer | |
rye run python -m unittest discover tests |