Skip to content

Commit

Permalink
fix: Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
huyenngn committed Mar 7, 2024
1 parent 26093fd commit 65e6a6a
Show file tree
Hide file tree
Showing 66 changed files with 1,646 additions and 14,313 deletions.
21 changes: 7 additions & 14 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and the capellambse contributors
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: CC0-1.0
rules:
body-leading-blank: [2, always]
Expand All @@ -9,16 +9,9 @@ rules:
subject-full-stop: [2, never, .]
subject-max-length: [2, always, 72]
type-empty: [2, never]
type-enum: [2, always, [
build,
chore,
ci,
docs,
feat,
fix,
merge,
perf,
refactor,
revert,
test,
]]
type-enum:
[
2,
always,
[build, chore, ci, docs, feat, fix, merge, perf, refactor, revert, test],
]
136 changes: 68 additions & 68 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,74 @@
name: Build

on:
push:
branches: ["*"]
pull_request: [master]
tags: ["v*.*.*"]
push:
branches: ["*"]
pull_request: [master]
tags: ["v*.*.*"]

jobs:
test:
name: Test with Python ${{matrix.python_version}} on ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python_version:
- "3.10"
- "3.11"
- "3.12"
include:
- os: windows-latest
python_version: "3.10"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{matrix.python_version}}
uses: actions/setup-python@v2
with:
python-version: ${{matrix.python_version}}
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{runner.os}}-pip-${{hashFiles('pyproject.toml')}}
restore-keys: |
${{runner.os}}-pip-
${{runner.os}}-
- name: Upgrade Pip
run: |-
python -m pip install -U pip
- name: Install test dependencies
run: |-
python -m pip install '.[test]'
- name: Run unit tests
run: |-
python -m pytest --cov-report=term --cov=capella_ros_tools --rootdir=.
test:
name: Test with Python ${{matrix.python_version}} on ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python_version:
- "3.10"
- "3.11"
- "3.12"
include:
- os: windows-latest
python_version: "3.10"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{matrix.python_version}}
uses: actions/setup-python@v2
with:
python-version: ${{matrix.python_version}}
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{runner.os}}-pip-${{hashFiles('pyproject.toml')}}
restore-keys: |
${{runner.os}}-pip-
${{runner.os}}-
- name: Upgrade Pip
run: |-
python -m pip install -U pip
- name: Install test dependencies
run: |-
python -m pip install '.[test]'
- name: Run unit tests
run: |-
python -m pytest --cov-report=term --cov=capella_ros_tools --rootdir=.
publish:
name: Publish artifacts
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependencies
run: |-
python -m pip install -U pip
python -m pip install build twine
- name: Build packages
run: |-
python -m build
- name: Verify packages
run: |-
python -m twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: "dist/*"
- name: Publish to PyPI (release only)
if: startsWith(github.ref, 'refs/tags/v')
run: python -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --non-interactive dist/*
publish:
name: Publish artifacts
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependencies
run: |-
python -m pip install -U pip
python -m pip install build twine
- name: Build packages
run: |-
python -m build
- name: Verify packages
run: |-
python -m twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: 'dist/*'
- name: Publish to PyPI (release only)
if: startsWith(github.ref, 'refs/tags/v')
run: python -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --non-interactive dist/*
57 changes: 57 additions & 0 deletions .github/workflows/commit-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: CC0-1.0

name: Conventional Commits

on:
pull_request:
branches: [master]

jobs:
conventional-commits:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install commitlint
run: npm install -g @commitlint/cli
- name: Validate commit messages
id: conventional-commits
env:
SHA_FROM: ${{ github.event.pull_request.base.sha }}
SHA_TO: ${{ github.event.pull_request.head.sha }}
run: |
delim="_EOF_$(uuidgen)"
echo "validation-result<<$delim" >> "$GITHUB_OUTPUT"
r=0
commitlint --from "$SHA_FROM" --to "$SHA_TO" >> "$GITHUB_OUTPUT" 2>&1 || r=$?
echo "$delim" >> "$GITHUB_OUTPUT"
exit $r
- name: Post comment if validation failed
if: always() && steps.conventional-commits.outcome == 'failure'
uses: actions/github-script@v6
env:
TEXT: |-
The pull request does not conform to the conventional commit specification. Please ensure that your commit messages follow the spec: <https://www.conventionalcommits.org/>.
We also strongly recommend that you set up your development environment with pre-commit, as described in our [CONTRIBUTING guidelines](https://github.com/DSD-DBS/capella-ros-tools/blob/master/CONTRIBUTING.md). This will run all the important checks right before you commit your changes, and avoids lengthy CI wait time and round trips.
This is the commit validation log:
```
${{ steps.conventional-commits.outputs.validation-result }}
```
Here are some examples of valid commit messages:
```
build: Bump dependency versions
docs(user): Add model creation workflow
feat: Add a monitoring dashboard
```
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.TEXT
})
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright DB InfraGO AG
# Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: CC0-1.0

name: Docs
Expand Down
68 changes: 34 additions & 34 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@
name: Lint

on:
push:
branches: ["*"]
push:
branches: ["*"]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Upgrade pip
run: |-
python -m pip install -U pip
- name: Install pre-commit
run: |-
python -m pip install pre-commit types-docutils
- name: Run Pre-Commit
run: |-
pre-commit run --all-files
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Upgrade pip
run: |-
python -m pip install -U pip
- name: Install pylint
run: |-
python -m pip install pylint
- name: Run pylint
run: |-
pylint -dfixme capella_ros_tools || exit $(($? & ~24))
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Upgrade pip
run: |-
python -m pip install -U pip
- name: Install pre-commit
run: |-
python -m pip install pre-commit types-docutils
- name: Run Pre-Commit
run: |-
pre-commit run --all-files
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Upgrade pip
run: |-
python -m pip install -U pip
- name: Install pylint
run: |-
python -m pip install pylint
- name: Run pylint
run: |-
pylint -dfixme capella_ros_tools || exit $(($? & ~24))
81 changes: 0 additions & 81 deletions .github/workflows/pr-target.yml

This file was deleted.

Loading

0 comments on commit 65e6a6a

Please sign in to comment.