Skip to content

Commit 5a6294b

Browse files
committed
adding CI workflow file
1 parent 87fea2f commit 5a6294b

2 files changed

Lines changed: 141 additions & 1 deletion

File tree

.github/workflows/oracle.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# This workflow comes from https://github.com/ofek/hatch-mypyc
2+
# https://github.com/ofek/hatch-mypyc/blob/5a198c0ba8660494d02716cfc9d79ce4adfb1442/.github/workflows/test.yml
3+
name: Test / oracle
4+
5+
on:
6+
schedule:
7+
- cron: "0 0 * * *"
8+
pull_request:
9+
paths:
10+
- "integrations/oracle/**"
11+
- "!integrations/oracle/*.md"
12+
- ".github/workflows/oracle.yml"
13+
push:
14+
branches:
15+
- main
16+
paths:
17+
- "integrations/oracle/**"
18+
- "!integrations/oracle/*.md"
19+
- ".github/workflows/oracle.yml"
20+
21+
defaults:
22+
run:
23+
working-directory: integrations/oracle
24+
25+
concurrency:
26+
group: oracle-${{ github.head_ref || github.sha }}
27+
cancel-in-progress: true
28+
29+
env:
30+
PYTHONUNBUFFERED: "1"
31+
FORCE_COLOR: "1"
32+
TEST_MATRIX_OS: '["ubuntu-latest"]'
33+
TEST_MATRIX_PYTHON: '["3.10", "3.14"]'
34+
35+
jobs:
36+
compute-test-matrix:
37+
runs-on: ubuntu-slim
38+
defaults:
39+
run:
40+
working-directory: .
41+
outputs:
42+
os: ${{ steps.set.outputs.os }}
43+
python-version: ${{ steps.set.outputs.python-version }}
44+
steps:
45+
- id: set
46+
run: |
47+
echo 'os=${{ github.event_name == 'push' && '["ubuntu-latest"]' || env.TEST_MATRIX_OS }}' >> "$GITHUB_OUTPUT"
48+
echo 'python-version=${{ github.event_name == 'push' && '["3.10"]' || env.TEST_MATRIX_PYTHON }}' >> "$GITHUB_OUTPUT"
49+
50+
run:
51+
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
52+
needs: compute-test-matrix
53+
permissions:
54+
contents: write
55+
pull-requests: write
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
os: ${{ fromJSON(needs.compute-test-matrix.outputs.os) }}
61+
python-version: ${{ fromJSON(needs.compute-test-matrix.outputs.python-version) }}
62+
63+
steps:
64+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
65+
66+
- name: Set up Python ${{ matrix.python-version }}
67+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
68+
with:
69+
python-version: ${{ matrix.python-version }}
70+
71+
- name: Install Hatch
72+
run: pip install hatch
73+
74+
- name: Lint
75+
if: matrix.python-version == '3.10' && runner.os == 'Linux'
76+
run: hatch run fmt-check && hatch run test:types
77+
78+
- name: Start Oracle container
79+
# Oracle Free takes longer to initialise than most containers.
80+
# --wait blocks until the healthcheck passes (up to ~4 min per the
81+
# retries/interval values in docker-compose.yml) before proceeding.
82+
run: docker compose up -d --wait
83+
84+
- name: Run unit tests
85+
run: hatch run test:unit-cov-retry
86+
87+
# On PR: posts coverage comment (directly on same-repo PRs; via artifact for fork PRs). On push to main: stores coverage baseline on data branch.
88+
- name: Store unit tests coverage
89+
id: coverage_comment
90+
if: matrix.python-version == '3.10' && runner.os == 'Linux' && github.event_name != 'schedule'
91+
uses: py-cov-action/python-coverage-comment-action@7188638f871f721a365d644f505d1ff3df20d683 # v3.40
92+
with:
93+
GITHUB_TOKEN: ${{ github.token }}
94+
COVERAGE_PATH: integrations/oracle
95+
SUBPROJECT_ID: oracle
96+
MINIMUM_GREEN: 90
97+
MINIMUM_ORANGE: 60
98+
99+
- name: Upload coverage comment to be posted
100+
if: matrix.python-version == '3.10' && runner.os == 'Linux' && github.event_name == 'pull_request' && steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
101+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
102+
with:
103+
name: coverage-comment-oracle
104+
path: python-coverage-comment-action-oracle.txt
105+
106+
- name: Run integration tests
107+
run: hatch run test:integration-cov-append-retry
108+
109+
- name: Store combined coverage
110+
if: github.event_name == 'push'
111+
uses: py-cov-action/python-coverage-comment-action@7188638f871f721a365d644f505d1ff3df20d683 # v3.40
112+
with:
113+
GITHUB_TOKEN: ${{ github.token }}
114+
COVERAGE_PATH: integrations/oracle
115+
SUBPROJECT_ID: oracle-combined
116+
MINIMUM_GREEN: 90
117+
MINIMUM_ORANGE: 60
118+
119+
- name: Run unit tests with lowest direct dependencies
120+
if: github.event_name != 'push'
121+
run: |
122+
hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt
123+
hatch -e test env run -- uv pip install -r requirements_lowest_direct.txt
124+
hatch run test:unit
125+
126+
- name: Nightly - run unit tests with Haystack main branch
127+
if: github.event_name == 'schedule'
128+
run: |
129+
hatch env prune
130+
hatch -e test env run -- uv pip install git+https://github.com/deepset-ai/haystack.git@main
131+
hatch run test:unit
132+
133+
notify-slack-on-failure:
134+
needs: run
135+
if: failure() && github.event_name == 'schedule'
136+
runs-on: ubuntu-slim
137+
steps:
138+
- uses: deepset-ai/notify-slack-action@3cda73b77a148f16f703274198e7771340cf862b # v1
139+
with:
140+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFICATIONS }}

integrations/oracle/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ classifiers = [
2222
"Programming Language :: Python :: Implementation :: CPython",
2323
]
2424
dependencies = [
25-
"haystack-ai>=2.0.0",
25+
"haystack-ai>=2.26.1",
2626
"oracledb>=2.1.0,<3.0.0",
2727
]
2828

0 commit comments

Comments
 (0)