Skip to content

Commit 9528000

Browse files
committed
workflows-std
1 parent 183717a commit 9528000

File tree

5 files changed

+355
-0
lines changed

5 files changed

+355
-0
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
[email protected] (Christopher J Mungall).
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series of
86+
actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or permanent
93+
ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within the
113+
community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.1, available at
119+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120+
121+
Community Impact Guidelines were inspired by
122+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123+
124+
For answers to common questions about this code of conduct, see the FAQ at
125+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126+
[https://www.contributor-covenant.org/translations][translations].
127+
128+
[homepage]: https://www.contributor-covenant.org
129+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130+
[Mozilla CoC]: https://github.com/mozilla/diversity
131+
[FAQ]: https://www.contributor-covenant.org/faq
132+
[translations]: https://www.contributor-covenant.org/translations

.github/CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Contributing
2+
3+
### Code Style
4+
5+
This project uses [`black`](https://github.com/psf/black) to automatically
6+
enforce a consistent code style. You can apply `black` and other pre-configured
7+
linters with `tox -e lint`.
8+
9+
This project uses [`flake8`](https://flake8.pycqa.org) and several plugins for
10+
additional checks of documentation style, security issues, good variable
11+
nomenclature, and more (
12+
see [`tox.ini`](tox.ini) for a list of flake8 plugins). You can check if your
13+
code passes `flake8` with `tox -e flake8`.
14+
15+
Each of these checks are run on each commit using GitHub Actions as a continuous
16+
integration service. Passing all of them is required for accepting a
17+
contribution. If you're unsure how to address the feedback from one of these
18+
tools, please say so either in the description of your pull request or in a
19+
comment, and we will help you.
20+
21+
These code style contribution guidelines have been adapted from the
22+
[cthoyt/cookiecutter-snekpack](https://github.com/cthoyt/cookiecutter-snekpack/blob/main/%7B%7Bcookiecutter.package_name%7D%7D/.github/CODE_OF_CONDUCT.md)
23+
Python package template.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy Documentation
2+
3+
# Controls when the action will run. Triggers the workflow on push
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches: [ main ]
8+
9+
paths:
10+
- 'src/docs/*'
11+
- 'src/schema/*.yaml'
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
15+
build-docs:
16+
# The type of runner that the job will run on
17+
runs-on: ubuntu-latest
18+
19+
# Steps represent a sequence of tasks that will be executed as part of the job
20+
steps:
21+
#----------------------------------------------
22+
# check-out repo and set-up python
23+
#----------------------------------------------
24+
- name: Check out repository
25+
uses: actions/checkout@v3
26+
with:
27+
# persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
28+
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
29+
30+
- name: Set up Python3
31+
uses: actions/setup-python@v3
32+
with:
33+
python-version: 3.9
34+
35+
#----------------------------------------------
36+
# install & configure poetry
37+
#----------------------------------------------
38+
- name: Install Poetry
39+
uses: snok/[email protected]
40+
41+
#----------------------------------------------
42+
# install dependencies if cache does not exist
43+
#----------------------------------------------
44+
- name: Install dependencies
45+
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
46+
run: poetry install --no-interaction
47+
48+
#----------------------------------------------
49+
# Create documentation and deploy.
50+
#----------------------------------------------
51+
- name: Create local docs
52+
run: |
53+
mkdir docs
54+
touch docs/.nojekyll
55+
cp -r src/docs/* docs/
56+
make deploy-gh-doc

.github/workflows/main.yaml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Built from:
2+
# https://docs.github.com/en/actions/guides/building-and-testing-python
3+
# https://github.com/snok/install-poetry#workflows-and-tips
4+
5+
name: Build and test
6+
7+
on:
8+
push:
9+
branches: [ main ]
10+
pull_request:
11+
branches: [ main ]
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: [ '3.9' ]
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
pip install tox
28+
- name: Check code quality with flake8
29+
run: tox -e flake8
30+
31+
test:
32+
runs-on: ubuntu-latest
33+
strategy:
34+
matrix:
35+
python-version: [ '3.9' ]
36+
37+
steps:
38+
39+
#----------------------------------------------
40+
# check-out repo and set-up python
41+
#----------------------------------------------
42+
- name: Check out repository
43+
uses: actions/checkout@v3
44+
45+
- name: Set up Python ${{ matrix.python-version }}
46+
uses: actions/setup-python@v3
47+
with:
48+
python-version: ${{ matrix.python-version }}
49+
50+
#----------------------------------------------
51+
# install & configure poetry
52+
#----------------------------------------------
53+
- name: Install Poetry
54+
uses: snok/[email protected]
55+
with:
56+
virtualenvs-create: true
57+
virtualenvs-in-project: true
58+
59+
#----------------------------------------------
60+
# load cached venv if cache exists
61+
#----------------------------------------------
62+
- name: Load cached venv
63+
id: cached-poetry-dependencies
64+
uses: actions/cache@v3
65+
with:
66+
path: .venv
67+
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
68+
69+
#----------------------------------------------
70+
# install dependencies if cache does not exist
71+
#----------------------------------------------
72+
- name: Install dependencies
73+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
74+
run: poetry install --no-interaction --no-root
75+
76+
#----------------------------------------------
77+
# install your root project, if required
78+
#----------------------------------------------
79+
- name: Install library
80+
run: poetry install --no-interaction --extras gilda
81+
82+
#----------------------------------------------
83+
# run test suite
84+
#----------------------------------------------
85+
- name: Run tests
86+
run: poetry run python -m unittest discover
87+
88+
#----------------------------------------------
89+
# coverage report
90+
#----------------------------------------------
91+
- name: Generate coverage results
92+
run: |
93+
poetry run coverage run -m unittest discover
94+
poetry run coverage xml
95+
poetry run coverage report -m
96+
97+
#----------------------------------------------
98+
# upload coverage results
99+
#----------------------------------------------
100+
- name: Upload coverage report
101+
uses: codecov/[email protected]
102+
with:
103+
name: codecov-results-${{ matrix.python-version }}
104+
token: ${{ secrets.CODECOV_TOKEN }}
105+
file: ./coverage.xml
106+
fail_ci_if_error: true
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-n-publish:
9+
name: Build and publish Python 🐍 distributions 📦 to PyPI
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v3
17+
with:
18+
python-version: 3.9
19+
20+
- name: Install Poetry
21+
uses: snok/[email protected]
22+
with:
23+
virtualenvs-create: true
24+
virtualenvs-in-project: true
25+
26+
- name: Install dependencies
27+
run: poetry install --no-interaction
28+
29+
- name: Build source and wheel archives
30+
run: |
31+
poetry version $(git describe --tags --abbrev=0)
32+
poetry build
33+
34+
- name: Publish distribution 📦 to PyPI
35+
uses: pypa/[email protected]
36+
with:
37+
user: __token__
38+
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)