Skip to content

Commit

Permalink
Update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed Jan 22, 2024
1 parent ee5828c commit 900d799
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 90 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: psf/black@stable

- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Dependencies
run: |
pip install black isort
run: make install

- name: black
run: |
black --check src
run: make black

- name: isort
run: |
isort --check src
run: make isort-check
45 changes: 25 additions & 20 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
name: Docs

on: [push, pull_request, workflow_dispatch]

jobs:
docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install -g @mermaid-js/mermaid-cli
- name: Install dependencies
run: |
make install
- name: Sphinx build
run: |
make docs
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/html/
force_orphan: true
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/setup-node@v3
with:
node-version: 16

- run: npm install -g @mermaid-js/mermaid-cli

- name: Install dependencies
run: make install

- name: Sphinx build
run: make docs

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/html/
force_orphan: true
11 changes: 6 additions & 5 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
name: Mypy type checking

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Dependencies
run: |
pip install mypy types-setuptools types-docutils
run: make install

- name: mypy
run: |
mypy src
run: make mypy
20 changes: 8 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Test mxmake

on:
push:
branches:
- master
workflow_dispatch:
branches:
- master
on: [push, pull_request]

jobs:
build:
Expand All @@ -20,12 +14,14 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Install project
run: make install
- name: Install project
run: make install

- name: Run tests
run: make test
- name: Run tests
run: make test
87 changes: 46 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#: core.mxfiles
#: core.packages
#: docs.sphinx
#: qa.black
#: qa.coverage
#: qa.isort
#: qa.mypy
#: qa.ruff
#: qa.test
#
# SETTINGS (ALL CHANGES MADE BELOW SETTINGS WILL BE LOST)
Expand Down Expand Up @@ -72,17 +72,17 @@ MXDEV?=https://github.com/mxstack/mxdev/archive/main.zip
# Default: mxmake
MXMAKE?=-e .

## qa.isort
## qa.ruff

# Source folder to scan for Python files to run isort on.
# Source folder to scan for Python files to run ruff on.
# Default: src
ISORT_SRC?=src
RUFF_SRC?=src

## qa.black
## qa.isort

# Source folder to scan for Python files to run black on.
# Source folder to scan for Python files to run isort on.
# Default: src
BLACK_SRC?=src
ISORT_SRC?=src

## docs.sphinx

Expand Down Expand Up @@ -198,8 +198,10 @@ endif
MXENV_TARGET:=$(SENTINEL_FOLDER)/mxenv.sentinel
$(MXENV_TARGET): $(SENTINEL)
ifeq ("$(VENV_ENABLED)", "true")
ifeq ("$(VENV_CREATE)", "true")
@echo "Setup Python Virtual Environment under '$(VENV_FOLDER)'"
@$(PYTHON_BIN) -m venv $(VENV_FOLDER)
endif
endif
@$(MXENV_PATH)pip install -U pip setuptools wheel
@$(MXENV_PATH)pip install -U $(MXDEV)
Expand All @@ -216,7 +218,9 @@ mxenv-dirty:
.PHONY: mxenv-clean
mxenv-clean: mxenv-dirty
ifeq ("$(VENV_ENABLED)", "true")
ifeq ("$(VENV_CREATE)", "true")
@rm -rf $(VENV_FOLDER)
endif
else
@$(MXENV_PATH)pip uninstall -y $(MXDEV)
@$(MXENV_PATH)pip uninstall -y $(MXMAKE)
Expand All @@ -226,6 +230,40 @@ INSTALL_TARGETS+=mxenv
DIRTY_TARGETS+=mxenv-dirty
CLEAN_TARGETS+=mxenv-clean

##############################################################################
# ruff
##############################################################################

RUFF_TARGET:=$(SENTINEL_FOLDER)/ruff.sentinel
$(RUFF_TARGET): $(MXENV_TARGET)
@echo "Install Ruff"
@$(MXENV_PATH)pip install ruff
@touch $(RUFF_TARGET)

.PHONY: ruff-check
ruff-check: $(RUFF_TARGET)
@echo "Run ruff check"
@$(MXENV_PATH)ruff check $(RUFF_SRC)

.PHONY: ruff-format
ruff-format: $(RUFF_TARGET)
@echo "Run ruff format"
@$(MXENV_PATH)ruff format $(RUFF_SRC)

.PHONY: ruff-dirty
ruff-dirty:
@rm -f $(RUFF_TARGET)

.PHONY: ruff-clean
ruff-clean: ruff-dirty
@test -e $(MXENV_PATH)pip && $(MXENV_PATH)pip uninstall -y ruff || :

INSTALL_TARGETS+=$(RUFF_TARGET)
CHECK_TARGETS+=ruff-check
FORMAT_TARGETS+=ruff-format
DIRTY_TARGETS+=ruff-dirty
CLEAN_TARGETS+=ruff-clean

##############################################################################
# isort
##############################################################################
Expand Down Expand Up @@ -260,40 +298,6 @@ FORMAT_TARGETS+=isort-format
DIRTY_TARGETS+=isort-dirty
CLEAN_TARGETS+=isort-clean

##############################################################################
# black
##############################################################################

BLACK_TARGET:=$(SENTINEL_FOLDER)/black.sentinel
$(BLACK_TARGET): $(MXENV_TARGET)
@echo "Install Black"
@$(MXENV_PATH)pip install black
@touch $(BLACK_TARGET)

.PHONY: black-check
black-check: $(BLACK_TARGET)
@echo "Run black checks"
@$(MXENV_PATH)black --check $(BLACK_SRC)

.PHONY: black-format
black-format: $(BLACK_TARGET)
@echo "Run black format"
@$(MXENV_PATH)black $(BLACK_SRC)

.PHONY: black-dirty
black-dirty:
@rm -f $(BLACK_TARGET)

.PHONY: black-clean
black-clean: black-dirty
@test -e $(MXENV_PATH)pip && $(MXENV_PATH)pip uninstall -y black || :

INSTALL_TARGETS+=$(BLACK_TARGET)
CHECK_TARGETS+=black-check
FORMAT_TARGETS+=black-format
DIRTY_TARGETS+=black-dirty
CLEAN_TARGETS+=black-clean

##############################################################################
# sphinx
##############################################################################
Expand Down Expand Up @@ -370,6 +374,7 @@ $(FILES_TARGET): $(PROJECT_CONFIG) $(MXENV_TARGET) $(SOURCES_TARGET) $(LOCAL_PAC
$(call set_mxfiles_env,$(MXENV_PATH),$(MXMAKE_FILES))
@$(MXENV_PATH)mxdev -n -c $(PROJECT_CONFIG)
$(call unset_mxfiles_env,$(MXENV_PATH),$(MXMAKE_FILES))
@test -e $(MXMAKE_FILES)/pip.conf && cp $(MXMAKE_FILES)/pip.conf $(VENV_FOLDER)/pip.conf || :
@touch $(FILES_TARGET)

.PHONY: mxfiles
Expand Down
12 changes: 6 additions & 6 deletions src/mxmake/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ def list_command(args: argparse.Namespace):
sys.stdout.write(f"Domain {topic.name}.{domain.name}:\n")
depends = ", ".join(domain.depends) if domain.depends else "No dependencies"
sys.stdout.write(f" Depends: {depends}\n")
sys.stdout.write(f" Targets:")
sys.stdout.write(" Targets:")
targets = domain.targets
if not targets:
sys.stdout.write(f" No targets provided\n")
sys.stdout.write(" No targets provided\n")
else:
sys.stdout.write(f"\n")
sys.stdout.write("\n")
for target in targets:
description = indent(target.description, 6 * " ").strip()
sys.stdout.write(f" {target.name}: {description}\n")
sys.stdout.write(f" Settings:")
sys.stdout.write(" Settings:")
settings = domain.settings
if not settings:
sys.stdout.write(f" No settings provided\n")
sys.stdout.write(" No settings provided\n")
else:
sys.stdout.write(f"\n")
sys.stdout.write("\n")
for setting in settings:
description = indent(setting.description, 8 * " ").strip()
sys.stdout.write(
Expand Down

0 comments on commit 900d799

Please sign in to comment.