Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
cnzakii committed Jan 19, 2025
1 parent 8648c94 commit 33a0991
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/license-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
distribution: 'temurin'
java-version: '11'
- name: Check License Header
run: bash ./scripts/check_license.sh
run: "scripts/check-license.sh"
18 changes: 0 additions & 18 deletions .github/workflows/python-lint.yaml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check and test
on: [push, pull_request]


jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"

- name: "Install dependencies"
run: "scripts/install-dev.sh"

- name: "Check Code Style"
run: "scripts/check.sh"

- name: "Build package"
run: "scripts/build.sh"

- name: "Run tests and report coverage"
run: "scripts/test.sh"
9 changes: 0 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@ zookeeper = [
"kazoo>=2.10.0",
]

dev=[
"hatch>=1.14.0",
"ruff>=0.9.1",
"mypy>=1.14.1",
"pytest>=8.3.4",
"coverage[toml]>=7.6.10",
]


### Hatch settings ###
[tool.hatch.version]
path = "src/dubbo/__about__.py"
Expand Down
19 changes: 19 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Here, we do not specify the dependencies required by the project in the requirements.txt file,
# as they have all been moved to the pyproject.toml file.
# In this file, we only specify the dependencies needed for the development environment,
# such as testing, packaging, linting, etc.

-e .[zoopkeeper]


# Packaging
hatch>=1.14.0


# Formatting & Linting
ruff>=0.9.1
mypy>=1.14.1

# Testing
pytest>=8.3.4
coverage[toml]>=7.6.10
24 changes: 24 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


echo "Building the project..."

hatch build

echo "Finished building the project."
30 changes: 30 additions & 0 deletions scripts/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

export SOURCE_FILES="src/dubbo tests"

# check code style
echo "Checking code style..."
ruff format $SOURCE_FILES --diff
ruff check --output-format=github $SOURCE_FILES --config=pyproject.toml

# TODO:Temporarily disable mypy check, because it's too strict for now
# mypy $SOURCE_FILES


echo "Finished code style check."
27 changes: 27 additions & 0 deletions scripts/install-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Install dependencies for development
REQUIREMENTS_DEV="requirements-dev.txt"

# Upgrade pip
pip install -U pip

# Install dependencies
pip install -r $REQUIREMENTS_DEV

7 changes: 5 additions & 2 deletions scripts/check_license.sh → scripts/rat.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

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

set -e # Exit on error
### Apache RAT license check script ###
# This script downloads Apache RAT and runs it to check the license headers of the source files.

set -e # Exit immediately if a command exits with a non-zero status.

# Some variables
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
Expand Down
24 changes: 24 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Run tests
coverage run -m pytest

# Generate coverage report
coverage report --show-missing --skip-covered --fail-under=100

0 comments on commit 33a0991

Please sign in to comment.