-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Linting: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip | ||
|
||
- name: Install Dependencies | ||
run: | | ||
pip install -r requirements-dev.txt | ||
- name: Lint with ruff | ||
run: | | ||
make lint | ||
Build: | ||
runs-on: ubuntu-latest | ||
# There is an issue with infinitely running tests when something fails due to failure to close the WebSocket, so we set a timeout. | ||
timeout-minutes: 5 | ||
strategy: | ||
matrix: | ||
# If we test it against too many versions, we are making unnecessary | ||
# requests to the production server. | ||
python-version: ["3.8", "3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
# See https://adamj.eu/tech/2023/11/02/github-actions-faster-python-virtual-environments/ | ||
- name: Cache virtualenv | ||
uses: actions/cache@v3 | ||
with: | ||
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }} | ||
path: packages/cartesia-python/.venv | ||
|
||
- name: Activate virtualenv | ||
run: | | ||
cd packages/cartesia-python | ||
python -m venv .venv | ||
source .venv/bin/activate | ||
make install-dev | ||
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH | ||
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV | ||
- name: Test with pytest | ||
env: # Or as an environment variable | ||
CARTESIA_API_KEY: ${{ secrets.TESTING_CARTESIA_API_KEY }} | ||
CARTESIA_TEST_DEPRECATED: "true" | ||
run: | | ||
cd packages/cartesia-python | ||
make test |