Skip to content

Commit b967326

Browse files
authored
ci: optimize runs (#448)
1 parent c495a47 commit b967326

File tree

3 files changed

+52
-18
lines changed

3 files changed

+52
-18
lines changed

.github/changes-filter.yaml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
e2e_tests:
33
- "libs/e2e-tests/**"
44
- "pyproject.toml"
5-
- "**/pyproject.toml"
5+
- "libs/llamaindex/pyproject.toml"
6+
- "libs/langchain/pyproject.toml"
7+
- "libs/tests-utils/pyproject.toml"
68
- "./.github/actions/**"
79
- "./.github/workflows/ci-e2e-tests.yml"
810
- "./.github/workflows/_run_e2e_tests.yml"
@@ -15,8 +17,23 @@ notebooks:
1517
- "./.github/workflows/_run_e2e_tests.yml"
1618
integration_tests:
1719
- "libs/colbert/**"
18-
- "libs/**"
19-
- "pyproject.toml"
20-
- "**/pyproject.toml"
20+
- "libs/llamaindex/**"
21+
- "libs/langchain/**"
22+
- "./.github/actions/**"
23+
- "./.github/workflows/ci-unit-tests.yml"
24+
docker_examples:
25+
- "docker/examples/**"
2126
- "./.github/actions/**"
2227
- "./.github/workflows/ci-unit-tests.yml"
28+
libs_colbert:
29+
- "libs/colbert/**"
30+
libs_langchain:
31+
- "libs/langchain/**"
32+
- "libs/colbert/**"
33+
libs_llamaindex:
34+
- "libs/llamaindex/**"
35+
- "libs/colbert/**"
36+
libs_knowledge_graph:
37+
- "libs/knowledge-graph/**"
38+
libs_knowledge_store:
39+
- "libs/knowledge-graph/**"

.github/workflows/ci-security-scans.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ on:
99
- ".github/workflows/ci-security-scans.yml"
1010
- "scripts/**"
1111
- "docker/**"
12-
- "pyproject.toml"
13-
- "poetry.lock"
12+
- "**/pyproject.toml"
1413
branches:
1514
- main
1615

@@ -38,6 +37,11 @@ jobs:
3837
- name: Move snyk vulnerabilities file
3938
if: ${{ always() }}
4039
run: |
40+
# cleanup snyk scan docker resources
41+
sudo docker volume prune -f
42+
sudo docker system prune -f
43+
du -sh *
44+
4145
python -m pip install poetry>=1.7.1
4246
mkdir -p snyk_reports
4347
mv snyk-vuln.json snyk_reports/snyk-vuln.json

.github/workflows/ci-unit-tests.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,25 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
12+
preconditions:
13+
name: Preconditions
14+
runs-on: ubuntu-latest
15+
outputs:
16+
notebooks: ${{ steps.filter.outputs.notebooks }}
17+
e2e_tests: ${{ steps.filter.outputs.e2e_tests }}
18+
docker_examples: ${{ steps.filter.outputs.docker_examples }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: dorny/paths-filter@v2
22+
id: filter
23+
with:
24+
filters: ./.github/changes-filter.yaml
25+
1226
build-docker:
1327
name: Docker
1428
runs-on: ubuntu-latest
29+
needs: ["preconditions"]
30+
if: ${{ needs.preconditions.outputs.docker_examples == 'true' }}
1531
steps:
1632
- name: Check out the repo
1733
uses: actions/checkout@v4
@@ -33,6 +49,7 @@ jobs:
3349
3450
unit-tests:
3551
name: Unit Tests (Python ${{ matrix.python-version }})
52+
needs: ["preconditions"]
3653
runs-on: ubuntu-latest
3754
strategy:
3855
matrix:
@@ -55,50 +72,47 @@ jobs:
5572
uses: ./.github/actions/lint
5673

5774
- name: "Unit tests (root)"
58-
if: ${{ matrix.python-version != '3.12' }}
5975
run: tox -e unit-tests && rm -rf .tox
6076

6177
- name: "Unit tests (colbert)"
78+
if: ${{ needs.preconditions.outputs.libs_colbert == 'true'}}
6279
run: tox -e unit-tests -c libs/colbert && rm -rf libs/colbert/.tox
6380

6481
- name: "Unit tests (langchain)"
82+
if: ${{ needs.preconditions.outputs.libs_langchain == 'true'}}
6583
run: tox -e unit-tests -c libs/langchain && rm -rf libs/langchain/.tox
6684

6785
- name: "Unit tests (llamaindex)"
86+
if: ${{ needs.preconditions.outputs.libs_llamaindex == 'true'}}
6887
run: tox -e unit-tests -c libs/llamaindex && rm -rf libs/llamaindex/.tox
6988

7089
- name: "Unit tests (knowledge-store)"
71-
if: ${{ matrix.python-version != '3.9' }}
90+
if: ${{ needs.preconditions.outputs.libs_knowledge_store == 'true' && matrix.python-version != '3.9' }}
7291
env:
7392
OPENAI_API_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
7493
run: tox -e unit-tests -c libs/knowledge-store && rm -rf libs/knowledge-store/.tox
7594

7695
- name: "Unit tests (knowledge-graph)"
77-
if: ${{ matrix.python-version != '3.9' && matrix.python-version != '3.10' }}
96+
if: ${{ needs.preconditions.outputs.libs_knowledge_graph == 'true' && matrix.python-version != '3.9' && matrix.python-version != '3.10' }}
7897
env:
7998
OPENAI_API_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
8099
run: tox -e unit-tests -c libs/knowledge-graph && rm -rf libs/knowledge-graph/.tox
81100

82101
integration-tests:
83102
name: Integration Tests
84103
runs-on: ubuntu-latest
104+
if: ${{ needs.preconditions.outputs.integration_tests == 'true' }}
105+
needs: ["preconditions"]
85106
timeout-minutes: 30
86107
steps:
87108
- name: Check out the repo
88109
uses: actions/checkout@v4
89110

90-
- uses: dorny/paths-filter@v2
91-
id: filter
92-
with:
93-
filters: ./.github/changes-filter.yaml
94-
95111
- name: "Setup: Python 3.11"
96-
if: ${{ steps.filter.outputs.integration_tests == 'true' }}
97112
uses: ./.github/actions/setup-python
98113

99114
- name: Setup AstraDB
100115
uses: nicoloboschi/setup-astradb@v1
101-
if: ${{ steps.filter.outputs.integration_tests == 'true' }}
102116
id: astra-db
103117
with:
104118
token: ${{ secrets.E2E_TESTS_ASTRA_DEV_DB_TOKEN }}
@@ -107,7 +121,6 @@ jobs:
107121
cloud: "gcp"
108122

109123
- name: "Integration tests"
110-
if: ${{ steps.filter.outputs.integration_tests == 'true' }}
111124
env:
112125
ASTRA_DB_TOKEN: "${{ secrets.E2E_TESTS_ASTRA_DEV_DB_TOKEN }}"
113126
ASTRA_DB_ID: "${{ steps.astra-db.outputs.id }}"
@@ -126,7 +139,7 @@ jobs:
126139
127140
- name: Cleanup AstraDB
128141
uses: nicoloboschi/cleanup-astradb@v1
129-
if: ${{ always() && steps.filter.outputs.integration_tests == 'true' }}
142+
if: ${{ always() && steps.astra-db.outputs.name != '' }}
130143
with:
131144
token: ${{ secrets.E2E_TESTS_ASTRA_DEV_DB_TOKEN }}
132145
name: ${{ steps.astra-db.outputs.name }}

0 commit comments

Comments
 (0)