Skip to content

Commit f1988a6

Browse files
chore: add github actions
1 parent 9bc7fb6 commit f1988a6

7 files changed

Lines changed: 184 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- pyproject.toml
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
commit-lint:
15+
if: ${{ github.event_name == 'pull_request' }}
16+
uses: ./.github/workflows/commitlint.yml
17+
18+
lint:
19+
uses: ./.github/workflows/lint.yml
20+
21+
test:
22+
uses: ./.github/workflows/test.yml

.github/workflows/commitlint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Commit Lint
2+
3+
on:
4+
workflow_call
5+
6+
jobs:
7+
commitlint:
8+
name: Commit Lint
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 22
23+
24+
- name: Install Git
25+
run: |
26+
if ! command -v git &> /dev/null; then
27+
echo "Git is not installed. Installing..."
28+
sudo apt-get update
29+
sudo apt-get install -y git
30+
else
31+
echo "Git is already installed."
32+
fi
33+
34+
- name: Install commitlint
35+
run: |
36+
npm install conventional-changelog-conventionalcommits
37+
npm install commitlint@latest
38+
npm install @commitlint/config-conventional
39+
40+
- name: Configure
41+
run: |
42+
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
43+
44+
- name: Validate PR commits with commitlint
45+
run: |
46+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch
47+
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to pr_branch --verbose

.github/workflows/lint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lint
2+
3+
on:
4+
workflow_call
5+
6+
jobs:
7+
lint:
8+
name: Lint
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup uv
18+
uses: astral-sh/setup-uv@v5
19+
with:
20+
enable-cache: true
21+
22+
- name: Setup Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version-file: ".python-version"
26+
27+
- name: Install dependencies
28+
run: uv sync --all-extras
29+
30+
- name: Check static types
31+
run: uv run mypy --config-file pyproject.toml .
32+
33+
- name: Check linting
34+
run: uv run ruff check .
35+
36+
- name: Check formatting
37+
run: uv run ruff format --check .
38+

.github/workflows/publish-docs.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "docs/**"
9+
- "pyproject.toml"
10+
11+
jobs:
12+
publish-docs:
13+
runs-on: ubuntu-latest
14+
if: ${{ github.repository == 'UiPath/uipath-llamaindex-python' }}
15+
steps:
16+
- name: Trigger Publish Docs
17+
run: |
18+
repo_owner="uipath"
19+
repo_name="uipath-python"
20+
event_type="publish-docs"
21+
22+
curl -L \
23+
-X POST \
24+
-H "Accept: application/vnd.github+json" \
25+
-H "Authorization: Bearer ${{ secrets.REPO_ACCESS }}" \
26+
-H "X-GitHub-Api-Version: 2022-11-28" \
27+
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
28+
-d "{\"event_type\": \"$event_type\", \"client_payload\": {}}"

.github/workflows/publish.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@ on:
99
- pyproject.toml
1010

1111
jobs:
12+
lint:
13+
uses: ./.github/workflows/lint.yml
14+
15+
test:
16+
uses: ./.github/workflows/test.yml
17+
1218
build:
1319
name: Build
1420
runs-on: ubuntu-latest
1521

22+
needs:
23+
- lint
24+
- test
1625

1726
if: ${{ github.repository == 'UiPath/uipath-llamaindex-python' }}
1827
permissions:

.github/workflows/test.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
test:
8+
name: Test
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
python-version: ["3.10", "3.11", "3.12", "3.13"]
13+
os: [ubuntu-latest, windows-latest]
14+
15+
permissions:
16+
contents: read
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup uv
23+
uses: astral-sh/setup-uv@v5
24+
25+
- name: Setup Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version-file: ".python-version"
29+
30+
- name: Install dependencies
31+
run: uv sync --all-extras
32+
33+
- name: Run tests
34+
run: uv run pytest
35+
36+
continue-on-error: true
37+

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ line-ending = "auto"
6464
plugins = [
6565
"pydantic.mypy"
6666
]
67+
exclude = [
68+
"samples/.*"
69+
]
6770

6871
follow_imports = "silent"
6972
warn_redundant_casts = true

0 commit comments

Comments
 (0)