1
+ # Copyright 2025 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ name : llamaindex
16
+ on :
17
+ pull_request :
18
+ paths :
19
+ - ' packages/toolbox-llamaindex/**'
20
+ - ' !packages/toolbox-llamaindex/**/*.md'
21
+ pull_request_target :
22
+ types : [labeled]
23
+
24
+ # Declare default permissions as read only.
25
+ permissions : read-all
26
+
27
+ jobs :
28
+ lint :
29
+ if : " ${{ github.event.action != 'labeled' || github.event.label.name == 'tests: run' }}"
30
+ name : lint
31
+ runs-on : ubuntu-latest
32
+ concurrency :
33
+ group : ${{ github.workflow }}-${{ github.ref }}
34
+ cancel-in-progress : true
35
+ defaults :
36
+ run :
37
+ working-directory : ./packages/toolbox-llamaindex
38
+ permissions :
39
+ contents : ' read'
40
+ issues : ' write'
41
+ pull-requests : ' write'
42
+ steps :
43
+ - name : Remove PR Label
44
+ if : " ${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}"
45
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
46
+ with :
47
+ github-token : ${{ secrets.GITHUB_TOKEN }}
48
+ script : |
49
+ try {
50
+ await github.rest.issues.removeLabel({
51
+ name: 'tests: run',
52
+ owner: context.repo.owner,
53
+ repo: context.repo.repo,
54
+ issue_number: context.payload.pull_request.number
55
+ });
56
+ } catch (e) {
57
+ console.log('Failed to remove label. Another job may have already removed it!');
58
+ }
59
+ - name : Checkout code
60
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
61
+ with :
62
+ ref : ${{ github.event.pull_request.head.sha }}
63
+ repository : ${{ github.event.pull_request.head.repo.full_name }}
64
+ token : ${{ secrets.GITHUB_TOKEN }}
65
+ - name : Setup Python
66
+ uses : actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
67
+ with :
68
+ python-version : " 3.13"
69
+
70
+ - name : Install library requirements
71
+ run : pip install -r requirements.txt
72
+
73
+ - name : Install test requirements
74
+ run : pip install .[test]
75
+
76
+ - name : Run linters
77
+ run : |
78
+ black --check .
79
+ isort --check .
80
+
81
+ - name : Run type-check
82
+ env :
83
+ MYPYPATH : ' ./src'
84
+ run : mypy --install-types --non-interactive --cache-dir=.mypy_cache/ -p toolbox_llamaindex
0 commit comments