Skip to content

Commit 33a0991

Browse files
committed
update ci
1 parent 8648c94 commit 33a0991

File tree

10 files changed

+160
-30
lines changed

10 files changed

+160
-30
lines changed

.github/workflows/license-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
distribution: 'temurin'
1717
java-version: '11'
1818
- name: Check License Header
19-
run: bash ./scripts/check_license.sh
19+
run: "scripts/check-license.sh"

.github/workflows/python-lint.yaml

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

.github/workflows/test-suite.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check and test
2+
on: [push, pull_request]
3+
4+
5+
jobs:
6+
tests:
7+
name: "Python ${{ matrix.python-version }}"
8+
runs-on: "ubuntu-latest"
9+
10+
strategy:
11+
matrix:
12+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
13+
14+
steps:
15+
- uses: "actions/checkout@v4"
16+
- uses: "actions/setup-python@v5"
17+
with:
18+
python-version: "${{ matrix.python-version }}"
19+
20+
- name: "Install dependencies"
21+
run: "scripts/install-dev.sh"
22+
23+
- name: "Check Code Style"
24+
run: "scripts/check.sh"
25+
26+
- name: "Build package"
27+
run: "scripts/build.sh"
28+
29+
- name: "Run tests and report coverage"
30+
run: "scripts/test.sh"

pyproject.toml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@ zookeeper = [
6969
"kazoo>=2.10.0",
7070
]
7171

72-
dev=[
73-
"hatch>=1.14.0",
74-
"ruff>=0.9.1",
75-
"mypy>=1.14.1",
76-
"pytest>=8.3.4",
77-
"coverage[toml]>=7.6.10",
78-
]
79-
80-
8172
### Hatch settings ###
8273
[tool.hatch.version]
8374
path = "src/dubbo/__about__.py"

requirements-dev.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Here, we do not specify the dependencies required by the project in the requirements.txt file,
2+
# as they have all been moved to the pyproject.toml file.
3+
# In this file, we only specify the dependencies needed for the development environment,
4+
# such as testing, packaging, linting, etc.
5+
6+
-e .[zoopkeeper]
7+
8+
9+
# Packaging
10+
hatch>=1.14.0
11+
12+
13+
# Formatting & Linting
14+
ruff>=0.9.1
15+
mypy>=1.14.1
16+
17+
# Testing
18+
pytest>=8.3.4
19+
coverage[toml]>=7.6.10

scripts/build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership.
7+
# The ASF licenses this file to You under the Apache License, Version 2.0
8+
# (the "License"); you may not use this file except in compliance with
9+
# the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
20+
echo "Building the project..."
21+
22+
hatch build
23+
24+
echo "Finished building the project."

scripts/check.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership.
7+
# The ASF licenses this file to You under the Apache License, Version 2.0
8+
# (the "License"); you may not use this file except in compliance with
9+
# the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
export SOURCE_FILES="src/dubbo tests"
20+
21+
# check code style
22+
echo "Checking code style..."
23+
ruff format $SOURCE_FILES --diff
24+
ruff check --output-format=github $SOURCE_FILES --config=pyproject.toml
25+
26+
# TODO:Temporarily disable mypy check, because it's too strict for now
27+
# mypy $SOURCE_FILES
28+
29+
30+
echo "Finished code style check."

scripts/install-dev.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership.
7+
# The ASF licenses this file to You under the Apache License, Version 2.0
8+
# (the "License"); you may not use this file except in compliance with
9+
# the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
# Install dependencies for development
20+
REQUIREMENTS_DEV="requirements-dev.txt"
21+
22+
# Upgrade pip
23+
pip install -U pip
24+
25+
# Install dependencies
26+
pip install -r $REQUIREMENTS_DEV
27+
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
#
44
# Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,7 +16,10 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19-
set -e # Exit on error
19+
### Apache RAT license check script ###
20+
# This script downloads Apache RAT and runs it to check the license headers of the source files.
21+
22+
set -e # Exit immediately if a command exits with a non-zero status.
2023

2124
# Some variables
2225
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"

scripts/test.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership.
7+
# The ASF licenses this file to You under the Apache License, Version 2.0
8+
# (the "License"); you may not use this file except in compliance with
9+
# the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
20+
# Run tests
21+
coverage run -m pytest
22+
23+
# Generate coverage report
24+
coverage report --show-missing --skip-covered --fail-under=100

0 commit comments

Comments
 (0)