Skip to content

Commit 5a128fc

Browse files
committed
Initial commit
0 parents  commit 5a128fc

32 files changed

+1157
-0
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: "Bug report \U0001F41E"
3+
about: Create a bug report
4+
labels: bug
5+
6+
---
7+
8+
## Describe the bug
9+
A clear and concise description of what the bug is.
10+
11+
### Steps to reproduce
12+
Steps to reproduce the behavior.
13+
14+
### Expected behavior
15+
A clear and concise description of what you expected to happen.
16+
17+
### Environment
18+
- OS: [e.g. Arch Linux]
19+
- Other details that you think may affect.
20+
21+
### Additional context
22+
Add any other context about the problem here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: "Feature request \U0001F680"
3+
about: Suggest an idea
4+
labels: enhancement
5+
6+
---
7+
8+
## Summary
9+
Brief explanation of the feature.
10+
11+
### Basic example
12+
Include a basic example or links here.
13+
14+
### Motivation
15+
Why are we doing this? What use cases does it support? What is the expected outcome?

.github/workflows/ci-main.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
10+
jobs:
11+
12+
static-analysis:
13+
if: github.repository != 'mattdeform/MayaPythonProjectTemplate'
14+
uses: ./.github/workflows/reusable-static-analysis.yml
15+
16+
tests:
17+
if: github.repository != 'mattdeform/MayaPythonProjectTemplate'
18+
uses: ./.github/workflows/reusable-maya-tests.yml

.github/workflows/ci-release.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
8+
static-analysis:
9+
if: github.repository != 'mattdeform/MayaPythonProjectTemplate'
10+
uses: ./.github/workflows/reusable-static-analysis.yml
11+
12+
tests:
13+
needs: static-analysis
14+
if: github.repository != 'mattdeform/MayaPythonProjectTemplate'
15+
uses: ./.github/workflows/reusable-maya-tests.yml
16+
17+
do_release:
18+
if: github.repository != 'mattdeform/MayaPythonProjectTemplate'
19+
needs: [static-analysis, tests]
20+
uses: ./.github/workflows/reusable-semantic-release.yml
21+
permissions:
22+
contents: write
23+
id-token: write
24+
25+
docs:
26+
if: github.repository != 'mattdeform/MayaPythonProjectTemplate'
27+
needs: [static-analysis, tests, do_release] # only build docs when release is successful
28+
uses: ./.github/workflows/reusable-build-and-deploy-docs.yml
29+
permissions:
30+
contents: write

.github/workflows/initial-setup.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: initial repository setup
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
USER_NAME: ${{ github.repository_owner }}
10+
PROJECT_NAME: ${{ github.event.repository.name }}
11+
PROJECT_DESC: ${{ github.event.repository.description }}
12+
13+
jobs:
14+
setup:
15+
if: github.repository != 'mattdeform/MayaPythonProjectTemplate'
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Rename README.md and delete setup workflow
26+
run: |
27+
# Delete template LICENSE
28+
rm -f LICENSE
29+
30+
# Delete existing README.md
31+
rm -f README.md
32+
33+
# Rename _README.md to README.md
34+
mv _README.md README.md
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: '3.x'
40+
41+
- name: Run initial setup script
42+
run: |
43+
python initial_setup.py
44+
45+
- name: Remove setup files
46+
run: |
47+
rm -f initial_setup.py
48+
rm -f .github/workflows/initial-setup.yml
49+
50+
- name: Commit and push changes
51+
run: |
52+
git config user.name 'github-actions[bot]'
53+
git config user.email 'github-actions[bot]@users.noreply.github.com'
54+
git add -A
55+
git commit -m "Initial repository setup completed by GitHub Actions"
56+
git push
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: build and deploy docs
2+
3+
on:
4+
workflow_dispatch: # Manual trigger
5+
workflow_call:
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
build-and-deploy-docs:
11+
# only build docs when publishing a release
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: 3.x
21+
22+
- uses: actions/cache@v4
23+
with:
24+
key: ${{ github.ref }}
25+
path: .cache
26+
27+
- run: |
28+
pip install mkdocs-material mkdocstrings[python]
29+
mkdocs gh-deploy --force
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: maya tests
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch: # Manual trigger
6+
7+
jobs:
8+
collect_tests:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
tests_collected: ${{ steps.check_tests.outputs.tests_collected }}
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.x'
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install pytest
23+
24+
- name: Check for tests
25+
id: check_tests
26+
run: |
27+
#!/bin/bash
28+
set +e # Disable exit on error
29+
pytest --collect-only
30+
exit_code=$?
31+
set -e # Re-enable exit on error
32+
33+
if [ $exit_code -eq 5 ]; then
34+
echo "tests_collected=0" >> $GITHUB_OUTPUT
35+
echo "No tests were collected."
36+
else
37+
collected=$(pytest --collect-only | grep -oP 'collected \K\d+')
38+
echo "tests_collected=$collected" >> $GITHUB_OUTPUT
39+
echo "Collected $collected tests."
40+
fi
41+
42+
no_tests_found:
43+
needs: collect_tests
44+
if: needs.collect_tests.outputs.tests_collected == '0'
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: No tests found
48+
run: echo "No tests were collected. Skipping test execution."
49+
50+
51+
maya:
52+
needs: collect_tests
53+
if: needs.collect_tests.outputs.tests_collected != '0'
54+
runs-on: ubuntu-latest
55+
56+
strategy:
57+
58+
fail-fast: false
59+
60+
matrix:
61+
# add or remove versions as needed, a job per version will be created
62+
# supported tags here: https://github.com/mottosso/docker-maya/
63+
maya_version: ["2024",]
64+
65+
container: mottosso/maya:${{ matrix.maya_version }} # ty mottosso!
66+
67+
steps:
68+
- name: Checkout code
69+
uses: actions/checkout@v4
70+
71+
- name: Install dependencies
72+
run: |
73+
mayapy -m pip install --upgrade pip
74+
mayapy -m pip install pip-tools
75+
pip-compile requirements.in
76+
pip-compile requirements-test.in
77+
mayapy -m pip install --user -r requirements-test.txt
78+
79+
- name: Set Maya environment variables
80+
run: |
81+
export XDG_RUNTIME_DIR=/var/tmp/runtime-root
82+
export MAYA_DISABLE_ADP=1
83+
84+
- name: Run tests
85+
run: mayapy -m pytest tests
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: semantic release
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
concurrency: release
10+
permissions:
11+
id-token: write
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Python Semantic Release
20+
uses: python-semantic-release/python-semantic-release@v9.8.6
21+
with:
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: static analysis
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch: # Manual trigger
6+
7+
jobs:
8+
9+
code-analysis:
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
fail-fast: false
14+
15+
matrix:
16+
python-version: ["3.10",] # maya 2024
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install pylint black mypy
30+
31+
- name: Analysing the code with pylint
32+
run: |
33+
pylint src
34+
35+
- name: Analysing the code with black
36+
uses: psf/black@stable
37+
with:
38+
src: "src"
39+
options: "--check"
40+
41+
- name: Analysing the code with mypy
42+
run: mypy src

0 commit comments

Comments
 (0)