Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding initial project stucture #1

Merged
merged 1 commit into from
Jun 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @ssbarnea
3 changes: 3 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Community Code of Conduct

Please see the official [Ansible Community Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html).
51 changes: 51 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Format and labels used aim to match those used by Ansible project
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: 'Major Changes'
labels:
- 'major' # c6476b
- title: 'Minor Changes'
labels:
- 'feature' # 006b75
- 'enhancement' # ededed
- 'refactoring'
- title: 'Bugfixes'
labels:
- 'bug' # fbca04
- title: 'Deprecations'
labels:
- 'deprecated' # fef2c0
exclude-labels:
- 'skip-changelog'
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
- 'feature'
- 'enhancement'
- 'refactoring'
patch:
labels:
- 'patch'
- 'bug'
- 'deprecated'
default: patch
autolabeler:
- label: 'skip-changelog'
title: '/chore/i'
- label: 'bug'
title: '/fix/i'
- label: 'enhancement'
title: '/(enhance|improve)/i'
- label: 'feature'
title: '/feature/i'
- label: 'dreprecated'
title: '/deprecat/i'
template: |
$CHANGES

Kudos goes to: $CONTRIBUTORS
21 changes: 21 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://github.com/jesusvasquez333/verify-pr-label-action
name: labels
on:
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]

jobs:
check_pr_labels:
runs-on: ubuntu-latest
name: verify
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Verify PR label action
uses: jesusvasquez333/[email protected]
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
valid-labels: 'bug, enhancement, feature, refactoring, major, deprecated, skip-changelog'
invalid-labels: 'help wanted, invalid, feedback-needed, incomplete'
pull-request-number: '${{ github.event.pull_request.number }}'
disable-reviews: true
18 changes: 18 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: release-drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
- 'releases/**'
- 'stable/**'

jobs:
update_release_draft:
runs-on: ubuntu-20.04
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: release

on:
release:
types: [published, created, edited]

jobs:
pypi:
name: Publish to PyPI registry
environment: release
runs-on: ubuntu-20.04

env:
FORCE_COLOR: 1
PY_COLORS: 1
TOXENV: packaging
TOX_PARALLEL_NO_SPINNER: 1

steps:
- name: Switch to using Python 3.8 by default
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install tox
run: >-
python3 -m
pip install
--user
tox
- name: Check out src from Git
uses: actions/checkout@v2
with:
fetch-depth: 0 # needed by setuptools-scm
- name: Build dists
run: python -m tox
- name: Publish to test.pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment doesn't match the content

github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
212 changes: 212 additions & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
name: gh

on:
create: # is used for publishing to PyPI and TestPyPI
tags: # any tag regardless of its name, no branches
- "**"
push: # only publishes pushes to the main branch to TestPyPI
branches: # any integration branch but not tag
- "main"
pull_request:
release:
types:
- published # It seems that you can publish directly without creating
schedule:
- cron: 1 0 * * * # Run daily at 0:01 UTC
# Run every Friday at 18:02 UTC
# https://crontab.guru/#2_18_*_*_5
# - cron: 2 18 * * 5

jobs:
linters:
name: >-
${{ matrix.env.TOXENV }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- 3.8
os:
- ubuntu-20.04
env:
- TOXENV: lint
- TOXENV: packaging
env:
TOX_PARALLEL_NO_SPINNER: 1
FORCE_COLOR: 1

steps:
- name: Check out src from Git
uses: actions/checkout@v2
with:
fetch-depth: 0 # needed by setuptools-scm
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# - name: set PY_SHA256
# run: echo "::set-env name=PY_SHA256::$(python -VV | sha256sum | cut -d' ' -f1)"
# - name: Pre-commit cache
# uses: actions/cache@v1
# with:
# path: ~/.cache/pre-commit
# key: ${{ runner.os }}-pre-commit-${{ env.PY_SHA256 }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('tox.ini') }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('.pre-commit-config.yaml') }}-${{ hashFiles('pytest.ini') }}
# - name: Pip cache
# uses: actions/cache@v1
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ env.PY_SHA256 }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('tox.ini') }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('.pre-commit-config.yaml') }}-${{ hashFiles('pytest.ini') }}
# restore-keys: |
# ${{ runner.os }}-pip-
# ${{ runner.os }}-
- name: Install tox
run: |
python3 -m pip install --upgrade tox
- name: Log installed dists
run: >-
python -m pip freeze --all
- name: >-
Initialize tox envs
run: >-
python -m
tox
--parallel auto
--parallel-live
--notest
--skip-missing-interpreters false
-vv
env: ${{ matrix.env }}
- name: Test with tox
run: |
python -m tox --parallel auto --parallel-live
env: ${{ matrix.env }}
- name: Archive logs
uses: actions/upload-artifact@v2
with:
name: logs.zip
path: .tox/**/log/

unit:
name: >-
${{ matrix.tox_env }}@${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
# fail-fast: false
# max-parallel: 5
# The matrix testing goal is to cover the *most likely* environments
# which are expected to be used by users in production. Avoid adding a
# combination unless there are good reasons to test it, like having
# proof that we failed to catch a bug by not running it. Using
# distribution should be prefferred instead of custom builds.
matrix:
python-version:
# keep list sorted as it determines UI order too
- 3.6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually sort by "importance". That is the latest, the lowest, maybe PyPy, and then the rest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alphabetical for the moment

- 3.7
- 3.8
- 3.9
# NOTE: Installing ansible under 3.10-dev is currently not
# NOTE: possible because compiling cffi explodes.
os:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
- ubuntu-20.04
# - windows-latest
# - windows-2016
include:
- tox_env: py36
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of having the toxenv for each interpreter if tox -e py picks up the current one already?

os: ubuntu-20.04
python-version: 3.6
- tox_env: py37
os: ubuntu-20.04
python-version: 3.7
- tox_env: py38
os: ubuntu-20.04
python-version: 3.8
- tox_env: py39
os: ubuntu-20.04
python-version: 3.9
- tox_env: py36
os: macOS-latest
python-version: 3.6
- tox_env: py38
os: macOS-latest
python-version: 3.8

env:
TOX_PARALLEL_NO_SPINNER: 1
FORCE_COLOR: 1

steps:
- name: MacOS workaround for https://github.com/actions/virtual-environments/issues/1187
if: ${{ matrix.os == 'macOS-latest' }}
run: |
sudo sysctl -w net.link.generic.system.hwcksum_tx=0
sudo sysctl -w net.link.generic.system.hwcksum_rx=0
- uses: actions/checkout@v2
with:
fetch-depth: 0 # needed by setuptools-scm
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: >-
Log the currently selected Python
version info (${{ matrix.python-version }})
run: |
python --version --version
which python
# - name: Pip cache
# uses: actions/cache@v1
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ env.PY_SHA256 }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('tox.ini') }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('.pre-commit-config.yaml') }}-${{ hashFiles('pytest.ini') }}
# restore-keys: |
# ${{ runner.os }}-pip-
# ${{ runner.os }}-
- name: Install tox
run: |
python3 -m pip install --upgrade tox
- name: Log installed dists
run: >-
python3 -m pip freeze --all
- name: >-
Initialize tox envs
run: >-
python3 -m
tox
--parallel auto
--parallel-live
--notest
--skip-missing-interpreters false
-vv
env:
TOXENV: ${{ matrix.tox_env }}-core,${{ matrix.tox_env }}-ansible29,${{ matrix.tox_env }}-devel
# sequential run improves browsing experience (almost no speed impact)
- name: "Test with tox: ${{ matrix.tox_env }}-core"
run: |
python3 -m tox
env:
TOXENV: ${{ matrix.tox_env }}-core
- name: "Test with tox: ${{ matrix.tox_env }}-ansible29"
run: |
python3 -m tox
env:
TOXENV: ${{ matrix.tox_env }}-ansible29
- name: "Test with tox: ${{ matrix.tox_env }}-devel"
run: |
python3 -m tox
env:
TOXENV: ${{ matrix.tox_env }}-devel
- name: Archive logs
uses: actions/upload-artifact@v2
with:
name: logs.zip
path: .tox/**/log/
# https://github.com/actions/upload-artifact/issues/123
continue-on-error: true
- name: Report junit failures
uses: shyim/junit-report-annotations-action@3d2e5374f2b13e70f6f3209a21adfdbc42c466ae
with:
path: .tox/junit.*.xml
if: always()
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ dmypy.json

# Pyre type checker
.pyre/
.test-results
Loading