Skip to content

Commit

Permalink
cleaning pass 2
Browse files Browse the repository at this point in the history
  • Loading branch information
hadim committed Jun 6, 2023
1 parent a964142 commit fcf3740
Show file tree
Hide file tree
Showing 128 changed files with 312 additions and 86 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @DomInvivo
128 changes: 128 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
4 changes: 3 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Checklist:

- [ ] Added a `news` entry: _copy `news/TEMPLATE.rst` to `news/my-feature-or-branch.rst`) and edit it._
- [ ] Was this PR discussed in a issue? It is recommended to first discuss a new feature into a GitHub issue before opening a PR.
- [ ] Add tests to cover the fixed bug(s) or the new introduced feature(s) (if appropriate).
- [ ] Update the API documentation is a new function is added or an existing one is deleted.

---
18 changes: 9 additions & 9 deletions .github/workflows/lint.yml → .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
name: Lint
name: code-check

on:
push:
branches:
- "master"
branches: ["main"]
tags: ["*"]
pull_request:
branches:
- "*"
- "!gh-pages"

jobs:
lint-source-code:
name: Lint
runs-on: "ubuntu-latest"

python-format-black:
name: Python lint [black]
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3

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

- name: Install black
run: |
Expand Down
33 changes: 23 additions & 10 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: doc

on:
push:
branches:
- "master"
branches: ["main"]
release:
types: [published]

jobs:
doc:
Expand All @@ -18,22 +19,34 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v3

- name: Setup Mamba
uses: mamba-org/provision-with-micromamba@v14
- name: Setup mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: env.yml
environment-name: goli
environment-name: openfractal
cache-environment: true
cache-downloads: true
cache-env: true
channel-priority: strict

- name: Install library
run: python -m pip install --no-deps .

- name: Deploy the doc
run: |
# Get the privpage branch
echo "Configure git"
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
echo "Get the gh-pages branch"
git fetch origin gh-pages
# Build and serve the doc
mkdocs gh-deploy --force
TAG_OR_BRANCH_NAME=${GITHUB_REF##*/}
if [ $TAG_OR_BRANCH_NAME = "main" ]; then
echo "Build and deploy the doc on main"
mike deploy --push --force main
else
echo "Build and deploy the doc on $TAG_OR_BRANCH_NAME"
mike deploy --push --force stable
mike deploy --push --force $TAG_OR_BRANCH_NAME
fi
112 changes: 112 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: release

on:
workflow_dispatch:
inputs:
release-version:
description: "A valid Semver version string"
required: true

permissions:
contents: write
pull-requests: write

jobs:
release:
# Do not release if not triggered from the default branch
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)

runs-on: ubuntu-latest
timeout-minutes: 30

defaults:
run:
shell: bash -l {0}

steps:
- name: Checkout the code
uses: actions/checkout@v3

- name: Setup mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: env.yml
environment-name: graphium
cache-environment: true
cache-downloads: true
create-args: >-
pip
semver
python-build
setuptools_scm
- name: Check the version is valid semver
run: |
RELEASE_VERSION="${{ inputs.release-version }}"
{
pysemver check $RELEASE_VERSION
} || {
echo "The version '$RELEASE_VERSION' is not a valid Semver version string."
echo "Please use a valid semver version string. More details at https://semver.org/"
echo "The release process is aborted."
exit 1
}
- name: Check the version is higher than the latest one
run: |
# Retrieve the git tags first
git fetch --prune --unshallow --tags &> /dev/null
RELEASE_VERSION="${{ inputs.release-version }}"
LATEST_VERSION=$(git describe --abbrev=0 --tags)
IS_HIGHER_VERSION=$(pysemver compare $RELEASE_VERSION $LATEST_VERSION)
if [ "$IS_HIGHER_VERSION" != "1" ]; then
echo "The version '$RELEASE_VERSION' is not higher than the latest version '$LATEST_VERSION'."
echo "The release process is aborted."
exit 1
fi
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Configure git
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Create and push git tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Tag the release
git tag -a "${{ inputs.release-version }}" -m "Release version ${{ inputs.release-version }}"
# Push the modified changelogs
git push origin main
# Push the tags
git push origin "${{ inputs.release-version }}"
- name: Install library
run: python -m pip install --no-deps .

- name: Build the wheel and sdist
run: python -m build --no-isolation

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: dist/

- name: Create GitHub Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
tag_name: ${{ inputs.release-version }}
body: ${{steps.github_release.outputs.changelog}}
22 changes: 12 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ name: test

on:
push:
branches:
- "master"
branches: ["main"]
tags: ["*"]
pull_request:
branches:
- "*"
- "!gh-pages"
schedule:
- cron: "0 4 * * MON"

jobs:
test:
Expand All @@ -31,17 +34,16 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v3

- name: Setup Mamba
uses: mamba-org/provision-with-micromamba@v15
- name: Setup mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: env.yml
environment-name: goli
extra-specs: |
environment-name: graphium
cache-environment: true
cache-downloads: true
create-args: >-
python=${{ matrix.python-version }}
pytorch=${{ matrix.pytorch-version }}
cache-downloads: true
cache-env: true
channel-priority: strict
- name: Install library
run: python -m pip install --no-deps .
Expand All @@ -50,7 +52,7 @@ jobs:
run: pytest

- name: Test CLI
run: goli --help
run: graphium --help

- name: Test building the doc
run: mkdocs build
Loading

0 comments on commit fcf3740

Please sign in to comment.