Skip to content

Commit 8785696

Browse files
authored
Update project to PyAnsys guidelines (#37)
* Generic .gitignore for Python projects * Migrate to src/ layout and use pyproject.toml * Add labels workflows
1 parent ceabe0e commit 8785696

Some content is hidden

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

41 files changed

+554
-214
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
33
- package-ecosystem: "pip" # See documentation for possible values
4-
directory: "/" # Location of package manifests
4+
directory: "/requirements" # Location of package manifests
55
insecure-external-code-execution: allow
66
schedule:
77
interval: "daily"

.github/labeler.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
documentation:
2+
- doc/source/**/*
3+
maintenance:
4+
- .github/**/*
5+
- .flake8
6+
- pyproject.toml
7+
dependencies:
8+
- requirements/*

.github/labels.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
- name: bug
2+
description: Something isn't working
3+
color: d42a34
4+
5+
- name: dependencies
6+
description: Related with project dependencies
7+
color: ffc0cb
8+
9+
- name: documentation
10+
description: Improvements or additions to documentation
11+
color: 0677ba
12+
13+
- name: enhancement
14+
description: New features or code improvements
15+
color: FFD827
16+
17+
- name: good first issue
18+
description: Easy to solve for newcomers
19+
color: 62ca50
20+
21+
- name: maintenance
22+
description: Package and maintenance related
23+
color: f78c37
24+
25+
- name: release
26+
description: Anything related to an incoming release
27+
color: ffffff

.github/workflows/ci-build.yml

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

.github/workflows/ci_cd.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
tags:
7+
- "*"
8+
branches:
9+
- main
10+
11+
jobs:
12+
13+
style:
14+
name: Code style
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: 3.9
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip tox
25+
- name: Test with tox
26+
run: tox -e style
27+
28+
docs:
29+
name: Documentation
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v2
36+
with:
37+
python-version: 3.9
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip tox
42+
- name: Build documentation
43+
run: tox -e doc
44+
45+
- name: Upload Documentation
46+
uses: actions/[email protected]
47+
with:
48+
name: Documentation
49+
path: .tox/doc_out/
50+
retention-days: 7
51+
52+
- name: Deploy to gh-pages
53+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
54+
uses: JamesIves/[email protected]
55+
with:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
BRANCH: gh-pages
58+
FOLDER: .tox/doc_out/
59+
CLEAN: true
60+
SINGLE_COMMIT: true
61+
62+
- name: Deploy to gh-pages
63+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
64+
uses: JamesIves/[email protected]
65+
with:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
BRANCH: gh-pages
68+
FOLDER: doc/build/html
69+
CLEAN: true
70+
SINGLE-COMMIT: true
71+
72+
73+
build:
74+
name: Build
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v2
78+
- name: Set up Python
79+
uses: actions/setup-python@v2
80+
with:
81+
python-version: 3.9
82+
- name: Install dependencies
83+
run: |
84+
python -m pip install --upgrade pip pipx
85+
python -m pip install -r requirements/requirements_build.txt
86+
- name: Build wheel and sdist
87+
run: |
88+
python -m build && python -m twine check dist/*
89+
- name: Upload wheel and sdist to artifacts
90+
uses: actions/upload-artifact@v2
91+
with:
92+
name: pyasys-templates-packages
93+
path: dist/
94+
retention-days: 7
95+
96+
release:
97+
name: Release
98+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
99+
needs: [style, docs, build]
100+
runs-on: ubuntu-latest
101+
102+
steps:
103+
- uses: actions/download-artifact@v2
104+
- name: Set up Python
105+
uses: actions/setup-python@v2
106+
with:
107+
python-version: 3.9
108+
- name: Display structure of downloaded files
109+
run: ls -R
110+
- name: Install dependencies
111+
run: |
112+
python -m pip install --upgrade pip twine
113+
- name: Publish to PyPI
114+
env:
115+
TWINE_USERNAME: __token__
116+
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
117+
run: |
118+
python -m twine upload --skip-existing ./**/*.whl
119+
python -m twine upload --skip-existing ./**/*.tar.gz
120+
- name: Publish to GitHub
121+
uses: softprops/action-gh-release@v1
122+
with:
123+
files: |
124+
./**/*.whl
125+
./**/*.tar.gz
126+
- name: Release
127+
uses: softprops/action-gh-release@v1
128+
with:
129+
generate_release_notes: true

.github/workflows/label.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Labeler
2+
on:
3+
pull_request:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- '../labels.yml'
8+
9+
10+
jobs:
11+
12+
label-syncer:
13+
name: Syncer
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: micnncim/action-label-syncer@v1
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
21+
labeler:
22+
name: Set labels
23+
needs: [label-syncer]
24+
permissions:
25+
contents: read
26+
pull-requests: write
27+
runs-on: ubuntu-latest
28+
steps:
29+
30+
# Label based on modified files
31+
- name: Label based on changed files
32+
uses: actions/labeler@v4
33+
with:
34+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
35+
sync-labels: ''
36+
37+
# Label based on branch name
38+
- uses: actions-ecosystem/action-add-labels@v1
39+
if: |
40+
startsWith(github.event.pull_request.head.ref, 'doc') ||
41+
startsWith(github.event.pull_request.head.ref, 'docs')
42+
with:
43+
labels: documentation
44+
45+
- uses: actions-ecosystem/action-add-labels@v1
46+
if: |
47+
startsWith(github.event.pull_request.head.ref, 'maint') ||
48+
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
49+
startsWith(github.event.pull_request.head.ref, 'ci')
50+
with:
51+
labels: maintenance
52+
53+
- uses: actions-ecosystem/action-add-labels@v1
54+
if: startsWith(github.event.pull_request.head.ref, 'feat')
55+
with:
56+
labels: |
57+
enhancement
58+
59+
- uses: actions-ecosystem/action-add-labels@v1
60+
if: |
61+
startsWith(github.event.pull_request.head.ref, 'fix') ||
62+
startsWith(github.event.pull_request.head.ref, 'patch')
63+
with:
64+
labels: bug
65+
66+
commenter:
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Suggest to add labels
70+
uses: peter-evans/create-or-update-comment@v2
71+
# Execute only when no labels have been applied to the pull request
72+
if: toJSON(github.event.pull_request.labels.*.name) == '{}'
73+
with:
74+
issue-number: ${{ github.event.pull_request.number }}
75+
body: |
76+
Please add one of the following labels to add this contribution to the Release Notes :point_down:
77+
- [bug](https://github.com/pyansys/pyansys-sphinx-theme/pulls?q=label%3Abug+)
78+
- [documentation](https://github.com/pyansys/pyansys-sphinx-theme/pulls?q=label%3Adocumentation+)
79+
- [enhancement](https://github.com/pyansys/pyansys-sphinx-theme/pulls?q=label%3Aenhancement+)
80+
- [good first issue](https://github.com/pyansys/pyansys-sphinx-theme/pulls?q=label%3Agood+first+issue)
81+
- [maintenance](https://github.com/pyansys/pyansys-sphinx-theme/pulls?q=label%3Amaintenance+)
82+
- [release](https://github.com/pyansys/pyansys-sphinx-theme/pulls?q=label%3Arelease+)

0 commit comments

Comments
 (0)