Skip to content

Commit

Permalink
Merge branch 'master' into templates-update
Browse files Browse the repository at this point in the history
  • Loading branch information
vik378 committed Oct 25, 2024
2 parents 052e03e + 8eb0c21 commit aa75d86
Show file tree
Hide file tree
Showing 57 changed files with 882 additions and 840 deletions.
2 changes: 2 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ rules:
always,
[build, chore, ci, docs, feat, fix, merge, perf, refactor, revert, test],
]
extends:
- '@commitlint/config-conventional'
68 changes: 47 additions & 21 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
name: Build

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

jobs:
test:
Expand All @@ -24,18 +25,13 @@ jobs:
- os: windows-latest
python_version: "3.11"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{matrix.python_version}}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
cache: pip
cache-dependency-path: pyproject.toml
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
Expand All @@ -46,14 +42,29 @@ jobs:
run: |-
python -m pytest --cov-report=term --cov=capella_model_explorer --rootdir=.
publish:
name: Publish artifacts
pre-commit:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
cache: pip
cache-dependency-path: pyproject.toml
python-version: "3.11"
- name: Upgrade pip
run: python -m pip install -U pip
- name: Install pre-commit
run: python -m pip install 'pre-commit>=3,<4'
- name: Run Pre-Commit
run: pre-commit run --all-files

build:
name: Build wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
Expand All @@ -67,10 +78,25 @@ jobs:
run: |-
python -m twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: 'dist/*'
pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build, test]
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/project/capella-model-explorer
permissions:
id-token: write
steps:
- name: Download built wheel
uses: actions/download-artifact@v4
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/*
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
34 changes: 20 additions & 14 deletions .github/workflows/commit-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ on:
jobs:
conventional-commits:
runs-on: ubuntu-latest
concurrency:
group: commit-check-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install commitlint
run: npm install -g @commitlint/cli
run: npm install @commitlint/cli @commitlint/config-conventional
- name: Validate commit messages
id: conventional-commits
env:
Expand All @@ -25,14 +28,24 @@ jobs:
delim="_EOF_$(uuidgen)"
echo "validation-result<<$delim" >> "$GITHUB_OUTPUT"
r=0
commitlint --from "$SHA_FROM" --to "$SHA_TO" >> "$GITHUB_OUTPUT" 2>&1 || r=$?
npx commitlint --from "$SHA_FROM" --to "$SHA_TO" >> "$GITHUB_OUTPUT" 2>&1 || r=$?
echo "$delim" >> "$GITHUB_OUTPUT"
exit $r
- name: Find conventional commit comment on PR
uses: peter-evans/find-comment@v3
if: always() && steps.conventional-commits.outcome == 'failure'
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: conventional commit
- name: Post comment if validation failed
uses: peter-evans/create-or-update-comment@v4
if: always() && steps.conventional-commits.outcome == 'failure'
uses: actions/github-script@v6
env:
TEXT: |-
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
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-model-explorer/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.
Expand All @@ -47,11 +60,4 @@ jobs:
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
})
edit-mode: replace
26 changes: 0 additions & 26 deletions .github/workflows/lint.yml

This file was deleted.

75 changes: 39 additions & 36 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

default_install_hook_types: [commit-msg, pre-commit]
default_stages: [commit, merge-commit]
minimum_pre_commit_version: 3.2.0
repos:
- repo: https://github.com/gitleaks/gitleaks.git
rev: v8.19.3
hooks:
- id: gitleaks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
Expand All @@ -25,40 +30,6 @@ repos:
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: trailing-whitespace
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies:
- docformatter[tomli]
- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
exclude: '^tests/'
additional_dependencies:
- pydocstyle[toml]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
additional_dependencies:
- capellambse==0.6.6
- types-pyyaml==6.0.11
- repo: https://github.com/pylint-dev/pylint
rev: v3.2.7
hooks:
- id: pylint
require_serial: false
args: [-rn, -sn, -dfixme, -dduplicate-code]
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
Expand Down Expand Up @@ -112,12 +83,39 @@ repos:
- LICENSES/.license_header.txt
- --comment-style
- '//'
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies:
- docformatter[tomli]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
hooks:
- id: ruff-format
- id: ruff
args: [--extend-ignore=FIX]
- repo: https://github.com/rhysd/actionlint
rev: v1.7.3
hooks:
- id: actionlint-docker
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
additional_dependencies:
- capellambse==0.6.6
- types-pyyaml==6.0.11
- repo: https://github.com/fsfe/reuse-tool
rev: v4.0.3
hooks:
- id: reuse
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.17.0
rev: v9.18.0
hooks:
- id: commitlint
stages: [commit-msg]
Expand All @@ -127,10 +125,12 @@ repos:
name: prettier
entry: prettier --write
language: node
types_or: [ts, css, html, markdown]
types_or: [javascript, jsx, ts, css, html, markdown]
additional_dependencies:
- 'prettier@^3.3.3'
- 'prettier-plugin-tailwindcss@^0.6.6'
- 'prettier-plugin-classnames@^0.7.2'
- 'prettier-plugin-merge@^0.7.1'
- 'tailwind-scrollbar@^3.1.0'
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.10.0
Expand All @@ -147,3 +147,6 @@ repos:
- 'eslint-plugin-react@^7.34.1'
- 'eslint-plugin-react-hooks@^4.6.2'
- 'eslint-plugin-react-refresh@^0.4.5'
args: ['--fix']
types: []
files: '^frontend/.*\.(js|jsx)$'
Loading

0 comments on commit aa75d86

Please sign in to comment.