Skip to content

Commit

Permalink
feat: Update structure (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab authored Jan 17, 2024
1 parent 89a4fc6 commit 907cd02
Show file tree
Hide file tree
Showing 55 changed files with 4,785 additions and 1,031 deletions.
12 changes: 5 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.bat]
indent_style = tab
end_of_line = crlf
[*.py]
indent_style = space
indent_size = 4

[LICENSE]
insert_final_newline = false
insert_final_newline = true

[Makefile]
indent_style = tab
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
* PyUML version:
* Python version:
* Operating System:
- PyUML version:
- Python version:
- Operating System:

### Description

Expand Down
135 changes: 135 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: build

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
check-branch:
runs-on: ubuntu-latest

timeout-minutes: 2
concurrency:
group: ci-check-branch-${{ github.ref }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request' }}
with:
fetch-depth: 0

- name: Check if the PR's branch is updated
if: ${{ github.event_name == 'pull_request' }}
uses: osl-incubator/gh-check-pr-is-updated@1.0.0
with:
remote_branch: origin/main
pr_sha: ${{ github.event.pull_request.head.sha }}

build:
needs: check-branch
strategy:
matrix:
python_version:
- "3.8.1"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

os:
- "ubuntu"
# - "macos"
# - 'windows' # note: makim doesn't have support for windows yet

runs-on: ${{ matrix.os }}-latest

timeout-minutes: 10
concurrency:
group: ci-tests-${{ matrix.os }}-${{ matrix.python_version }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3

- name: Install MacOS extra tools and add extra setup
if: ${{ matrix.os == 'macos' }}
run: |
sudo mkdir -p /tmp
sudo chmod 777 /tmp
brew install gnu-sed
echo 'export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.bash_profile
- name: Prepare conda environment (windows)
if: ${{ matrix.os == 'windows' }}
run: |
$env:Path += ";C:\Program Files\Git\usr\bin"
sed -i s/python\ 3\.8/python\ ${{ matrix.python_version }}/ conda/dev.yaml
cat conda/dev.yaml
- name: Prepare conda environment
if: ${{ matrix.os != 'windows' }}
run: |
sed -i s/python\ 3\.8\.1/python\ ${{ matrix.python_version }}/ conda/dev.yaml
cat conda/dev.yaml
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
channel-priority: true
activate-environment: pyuml
auto-update-conda: true
conda-solver: libmamba

- name: Install dependencies
run: poetry install

- name: Run tests
run: makim tests.unit

linter-and-docs:
needs: check-branch
runs-on: ubuntu-latest
timeout-minutes: 10

defaults:
run:
shell: bash -l {0}

concurrency:
group: ci-linter-docs-${{ github.ref }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: pyuml
auto-update-conda: true
conda-solver: libmamba

- name: Install dependencies
run: |
poetry config virtualenvs.create false
poetry install
- name: Test documentation generation
run: makim docs.build

- name: Run style checks
if: success() || failure()
run: makim tests.linter
69 changes: 69 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: write
issues: write
pull-requests: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
timeout-minutes: 10

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
channel-priority: true
activate-environment: pyuml
auto-update-conda: true
conda-solver: libmamba

- name: Install deps
run: |
poetry install
- name: Run semantic release (for tests)
if: ${{ github.event_name != 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
makim release.dry
- name: Release command
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi ${PYPI_TOKEN}
makim release.ci
- name: Generate documentation with changes from semantic-release
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
makim docs.build
- name: GitHub Pages action
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: peaceiris/actions-gh-pages@v3.5.9
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: >-
build/
95 changes: 95 additions & 0 deletions .makim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
version: 1.0
groups:
clean:
targets:
all:
help: Clean unnecessary temporary files
shell: bash
run: |
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
find . -name '*~' -exec rm -f {} +
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
rm -fr .mypy_cache
rm -fr .ruff_cache
docs:
targets:
build:
help: Build documentation
run: |
mkdocs build --config-file docs/mkdocs.yaml
preview:
help: Preview documentation page locally
dependencies:
- target: docs.build
run: |
mkdocs build --config-file docs/mkdocs.yaml
tests:
targets:
linter:
help: Run linter tools
run: |
pre-commit install
pre-commit run --all-files --verbose
unit:
help: run tests
args:
path:
help: Specify the location of the tests
type: string
default: ""
params:
help: Specify parameters to be used for tests
type: string
default: "-vv"
run: |
pytest {{ args.path }} {{ args.params }}
ci:
help: run the sames tests executed on CI
dependencies:
- target: tests.unit
- target: tests.linter

package:
targets:
build:
help: "Build the package"
run: |
poetry build
release:
vars:
app: |
npx --yes \
-p semantic-release \
-p conventional-changelog-conventionalcommits \
-p "@semantic-release/commit-analyzer" \
-p "@semantic-release/release-notes-generator" \
-p "@semantic-release/changelog" \
-p "@semantic-release/exec" \
-p "@semantic-release/github" \
-p "@semantic-release/git" \
-p "semantic-release-replace-plugin" \
semantic-release
targets:
ci:
help: run semantic release on CI
run: {{ vars.app }} --ci

dry:
help: run semantic release in dry-run mode
run: {{ vars.app }} --dry-run
Loading

0 comments on commit 907cd02

Please sign in to comment.