Skip to content

Commit 1029bd0

Browse files
Merge pull request #177 from jf---/jf/code-quality
jf/opzomeren
2 parents 9ce291c + d004139 commit 1029bd0

File tree

178 files changed

+10231
-5648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+10231
-5648
lines changed

.bumpversion.cfg

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
[bumpversion]
2-
current_version = 0.7.0
2+
current_version = 0.8.0
33
message = Bump version to {new_version}
44
commit = True
55
tag = True
66

7-
[bumpversion:file:setup.py]
8-
search = version="{current_version}"
9-
replace = version="{new_version}"
7+
[bumpversion:file:pyproject.toml]
8+
search = version = "{current_version}"
9+
replace = version = "{new_version}"
1010

1111
[bumpversion:file:docs/conf.py]
12-
search = version = release = '{current_version}'
13-
replace = version = release = '{new_version}'
12+
search = version = release = "{current_version}"
13+
replace = version = release = "{new_version}"
1414

1515
[bumpversion:file:docs/doc_versions.txt]
1616
search = {current_version}
1717
replace = {new_version}
1818
{current_version}
1919

2020
[bumpversion:file:src/compas_slicer/__init__.py]
21-
search = __version__ = '{current_version}'
22-
replace = __version__ = '{new_version}'
21+
search = __version__ = "{current_version}"
22+
replace = __version__ = "{new_version}"
2323

2424
[bumpversion:file:CHANGELOG.rst]
2525
search = Unreleased

.github/workflows/build.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: build
22

33
on:
4-
# [push]
54
push:
65
branches:
76
- master
@@ -10,33 +9,39 @@ on:
109
- master
1110

1211
jobs:
13-
build-packages:
12+
build:
1413
runs-on: ${{ matrix.os }}
1514
strategy:
15+
fail-fast: false
1616
matrix:
17-
os: [windows-latest]
17+
os: [ubuntu-latest, windows-latest, macos-latest]
18+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1819

1920
steps:
20-
- uses: actions/checkout@v2
21-
- name: Setup miniconda with python ${{ matrix.python-version }}
22-
uses: conda-incubator/setup-miniconda@v2
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v5
2325
with:
24-
activate-environment: compas_slicer
25-
environment-file: environment.yml
26-
python-version: 3.8
27-
auto-activate-base: false
28-
auto-update-conda: true
29-
- name: Conda info
30-
run: conda info
31-
- name: Install project
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install dependencies
3229
run: |
33-
python -m pip install --no-cache-dir -r requirements-dev.txt
30+
python -m pip install --upgrade pip
31+
pip install -e ".[dev]"
32+
3433
- name: Test import
3534
run: |
36-
python -c "import compas_slicer; print('COMPAS Slicer version: ' + compas_slicer.__version__)"
37-
- name: Lint with flake8
35+
python -c "import compas_slicer; print('COMPAS Slicer version: ' + compas_slicer.__version__)"
36+
37+
- name: Lint with ruff
3838
run: |
39-
invoke lint
39+
ruff check src/
40+
41+
- name: Type check with mypy
42+
run: |
43+
mypy src/compas_slicer --ignore-missing-imports
44+
4045
- name: Test with pytest
4146
run: |
42-
invoke test
47+
pytest tests/ -v

.github/workflows/deploy-n-publish.yml

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

.github/workflows/docs.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- 'docs/**'
8+
- 'mkdocs.yml'
9+
- '.github/workflows/docs.yml'
10+
pull_request:
11+
branches: [master]
12+
paths:
13+
- 'docs/**'
14+
- 'mkdocs.yml'
15+
- '.github/workflows/docs.yml'
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: write
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.11"
31+
32+
- name: Install dependencies
33+
run: |
34+
pip install -e ".[docs]"
35+
36+
- name: Build docs
37+
run: mkdocs build --strict
38+
39+
- name: Configure git for mike
40+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
41+
run: |
42+
git config user.name github-actions
43+
git config user.email [email protected]
44+
45+
- name: Deploy docs with mike
46+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
47+
run: |
48+
git fetch origin gh-pages --depth=1
49+
mike deploy --push --update-aliases latest stable
50+
mike set-default --push latest

.github/workflows/pr-checks.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
name: verify-pr-checklist
1+
name: pr-checks
2+
23
on:
34
pull_request:
4-
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
5-
branches:
6-
- main
7-
- master
5+
branches: [master]
86

97
jobs:
10-
build:
11-
name: Check Actions
8+
lint:
129
runs-on: ubuntu-latest
1310
steps:
14-
- uses: actions/checkout@v1
15-
- name: Changelog check
16-
uses: Zomzog/[email protected]
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
1715
with:
18-
fileName: CHANGELOG.rst
19-
env:
20-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
python-version: "3.12"
17+
18+
- name: Install ruff
19+
run: pip install ruff
20+
21+
- name: Check formatting
22+
run: ruff format --check src/ tests/
23+
24+
- name: Check linting
25+
run: ruff check src/ tests/

.github/workflows/publish_yak.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: publish_yak
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: "Choose deployment environment"
8+
required: true
9+
type: choice
10+
options:
11+
- test
12+
- prod
13+
14+
jobs:
15+
publish_yak:
16+
runs-on: windows-latest
17+
18+
steps:
19+
- name: Set test flag based on input
20+
shell: pwsh
21+
run: |
22+
if ("${{ github.event.inputs.environment }}" -eq "test") {
23+
echo "TEST_FLAG=--test-server" | Out-File -FilePath $env:GITHUB_ENV -Append
24+
} else {
25+
echo "TEST_FLAG=" | Out-File -FilePath $env:GITHUB_ENV -Append
26+
}
27+
28+
- name: Checkout repo
29+
uses: actions/checkout@v4
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install .[dev]
35+
36+
- name: Create Rhino 8 Yak package
37+
shell: pwsh
38+
run: |
39+
invoke yakerize -m $Env:YAK_TEMPLATE\manifest.yml -l $Env:YAK_TEMPLATE\icon.png -g $Env:USER_OBJECTS -t rh8
40+
env:
41+
USER_OBJECTS: src\compas_slicer_ghpython\gh_components
42+
YAK_TEMPLATE: src\compas_slicer_ghpython\yak_template
43+
44+
- name: Publish to Yak server (Rhino 8)
45+
shell: pwsh
46+
run: |
47+
$test_flag = if ($Env:TEST_FLAG) { $Env:TEST_FLAG } else { "" }
48+
$file = Get-ChildItem -Path dist\yak_package\*rh8*.yak -File | Select-Object -ExpandProperty Name
49+
$command = "invoke publish-yak -y dist\yak_package\$file $test_flag".Trim()
50+
Invoke-Expression $command
51+
env:
52+
YAK_TOKEN: ${{ secrets.YAK_TOKEN }}

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
id-token: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
22+
- name: Install build tools
23+
run: pip install build
24+
25+
- name: Build package
26+
run: python -m build
27+
28+
- name: Publish to PyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)