Skip to content

Commit 0ff4c33

Browse files
Merge pull request #23 from quantumlib/ci_gha
turn cloudbuild into GH action
2 parents 6793bc8 + 82a0a7c commit 0ff4c33

File tree

5 files changed

+71
-101
lines changed

5 files changed

+71
-101
lines changed

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Copyright 2024 The TUnits Authors
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+
16+
name: Build and Test
17+
18+
on: [push]
19+
20+
jobs:
21+
buid-and-test:
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
fail-fast: false
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Set up Python 3.10
31+
uses: actions/setup-python@v3
32+
with:
33+
python-version: '3.10'
34+
35+
- name: Install Dependencies
36+
run: |
37+
pip install -r dev_tools/dev.env.txt
38+
39+
- name: Typecheck
40+
run: ci/mypy.sh
41+
42+
- name: shellcheck
43+
run: ci/shellcheck.sh
44+
45+
- name: format
46+
run: |
47+
black --exclude tunits/proto/.* --check .
48+
49+
- name: lint
50+
run: ci/pylint_all.sh
51+
52+
- name: Check modified protos
53+
run: ci/build_changed_protos.sh origin/main
54+
55+
#
56+
# Install
57+
#
58+
59+
- name: install
60+
run: |
61+
pip install . --user
62+
63+
64+
- name: pytest
65+
run: ci/pytest_unit.sh
66+
67+
- name: perf
68+
run: ci/pytest_perf.sh

ci/Dockerfile.builder

Lines changed: 0 additions & 10 deletions
This file was deleted.

ci/shellcheck.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ echo "${shell_files[@]}" | tr ' ' '\n' | sed 's/^/ /'
2424

2525
echo
2626

27-
/usr/local/bin/shellcheck --external-sources "${shell_files[@]}"
27+
shellcheck --external-sources "${shell_files[@]}"

cloudbuild.yaml

Lines changed: 0 additions & 90 deletions
This file was deleted.

tunits/core/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ class Value(WithUnit):
299299
def __ge__(self, other: _NUMERICAL_TYPE_OR_ARRAY_OR_GENERIC_UNIT) -> bool: ...
300300
def __eq__(self, other: Any) -> bool: ...
301301
def __neq__(self, other: Any) -> bool: ...
302+
def __getitem__(self, key: Any) -> float: ...
302303

303304
class ValueArray(WithUnit):
304305
@classmethod
@@ -344,6 +345,7 @@ class ValueArray(WithUnit):
344345
def __ge__(self, other: _NUMERICAL_TYPE_OR_ARRAY_OR_GENERIC_UNIT) -> NDArray[Any]: ...
345346
def __eq__(self, other: Any) -> NDArray[Any]: ... # type: ignore[override]
346347
def __neq__(self, other: Any) -> NDArray[Any]: ...
348+
def __getitem__(self, key: Any) -> NDArray[Any]: ...
347349

348350
def init_base_unit_functions(
349351
try_interpret_as_with_unit: Callable[[Any, bool], WithUnit | None],

0 commit comments

Comments
 (0)