Skip to content

Commit 4f8dea8

Browse files
authored
feat: fix CI failing issues (#267)
fix issues on main CI: * test_contract (3.9) stuck 6hrs... should really be just 30s * test_integration (3.9) failling but not on other version hopefully can speed up CI a bit with `pytest -n auto` (Automatically run your tests in parallel across all available CPU cores) -> ubuntu-latest has 2 core CPU so should be able to speed up in half? note: * maybe could be faster if we switch to our own github runner? (if it has more core)
1 parent 51e5e61 commit 4f8dea8

File tree

4 files changed

+1117
-36
lines changed

4 files changed

+1117
-36
lines changed

.github/workflows/ci.yaml

+8-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
test_unit:
2121
strategy:
2222
matrix:
23-
python-version: ["3.9","3.10","3.11"]
23+
python-version: [ "3.9","3.10","3.11", "3.12" ]
2424
runs-on: ubuntu-latest
2525
steps:
2626
- uses: actions/checkout@v4
@@ -32,7 +32,7 @@ jobs:
3232
run: make install
3333
- name: Run unit tests
3434
run: |
35-
poetry run make test-unit
35+
make test-unit
3636
3737
lint:
3838
runs-on: ubuntu-latest
@@ -42,12 +42,12 @@ jobs:
4242
run: make install
4343
- name: Lint
4444
run: |
45-
poetry run make lint
45+
make lint
4646
4747
test_integration:
4848
strategy:
4949
matrix:
50-
python-version: ["3.9","3.10","3.11"]
50+
python-version: [ "3.9","3.10","3.11", "3.12" ]
5151
runs-on: ubuntu-latest
5252
steps:
5353
- uses: actions/checkout@v4
@@ -57,9 +57,9 @@ jobs:
5757
python-version: ${{ matrix.python-version }}
5858
- name: Install dependencies
5959
run: make install
60-
- name: Run all tests
60+
- name: Run integration tests
6161
run: |
62-
poetry run make test
62+
make test-integration-docker
6363
env:
6464
UNSTRUCTURED_API_KEY: ${{ secrets.UNSTRUCTURED_API_KEY }}
6565

@@ -79,8 +79,7 @@ jobs:
7979
- name: Install dependencies
8080
run: |
8181
make install
82-
source .venv/bin/activate && make install-test-contract
83-
- name: Run unit tests
82+
- name: Run contract tests
8483
run: |
85-
poetry run make test-contract
84+
make test-contract
8685

Makefile

+6-11
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ install:
1919
install-speakeasy-cli:
2020
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh
2121

22-
## install-test: install test requirements as they cannot be put into pyproject.toml due to python version requirements mismatch
23-
.PHONY: install-test-contract
24-
install-test-contract:
25-
pip install unstructured pytest-httpx
26-
2722
#################
2823
# Test and Lint #
2924
#################
@@ -33,30 +28,30 @@ test: test-unit test-integration-docker
3328

3429
.PHONY: test-unit
3530
test-unit:
36-
PYTHONPATH=. pytest _test_unstructured_client -v -k "unit"
31+
PYTHONPATH=. poetry run pytest -n auto _test_unstructured_client -v -k "unit"
3732

3833
.PHONY: test-contract
3934
test-contract:
40-
PYTHONPATH=. pytest _test_contract -v
35+
PYTHONPATH=. poetry run pytest -n auto _test_contract -v
4136

4237
# Assumes you have unstructured-api running on localhost:8000
4338
.PHONY: test-integration
4439
test-integration:
45-
PYTHONPATH=. pytest _test_unstructured_client -v -k "integration"
40+
PYTHONPATH=. poetry run pytest -n auto _test_unstructured_client -v -k "integration"
4641

4742
# Runs the unstructured-api in docker for tests
4843
.PHONY: test-integration-docker
4944
test-integration-docker:
5045
-docker stop unstructured-api && docker kill unstructured-api
5146
docker run --name unstructured-api -p 8000:8000 -d --rm ${DOCKER_IMAGE} --host 0.0.0.0 && \
5247
curl -s -o /dev/null --retry 10 --retry-delay 5 --retry-all-errors http://localhost:8000/general/docs && \
53-
PYTHONPATH=. pytest _test_unstructured_client -v -k "integration" && \
48+
PYTHONPATH=. poetry run pytest -n auto _test_unstructured_client -v -k "integration" && \
5449
docker kill unstructured-api
5550

5651
.PHONY: lint
5752
lint:
58-
pylint --rcfile=pylintrc src
59-
mypy src
53+
poetry run pylint --rcfile=pylintrc src
54+
poetry run mypy src
6055

6156
#############
6257
# Speakeasy #

0 commit comments

Comments
 (0)