Skip to content

Commit

Permalink
Enable prettier (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Sep 12, 2023
1 parent 433c4c9 commit b4fd1ea
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 56 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name: ack
on:
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]
workflow_call: # allows reuse of this workflow from other devtools repos
workflow_call: # allows reuse of this workflow from other devtools repos

jobs:
ack:
runs-on: ubuntu-latest
environment: ack
permissions:
checks: write
contents: read
pull-requests: write
steps:

- name: Checkout
uses: actions/checkout@v4

Expand All @@ -37,10 +37,10 @@ jobs:
- 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, bot:chronographer:skip'
invalid-labels: 'help wanted, invalid, feedback-needed, incomplete'
pull-request-number: '${{ github.event.pull_request.number }}'
github-token: "${{ secrets.GITHUB_TOKEN }}"
valid-labels: "bug, enhancement, feature, refactoring, major, deprecated, skip-changelog, bot:chronographer:skip"
invalid-labels: "help wanted, invalid, feedback-needed, incomplete"
pull-request-number: "${{ github.event.pull_request.number }}"
disable-reviews: true

- name: Update release notes if this is already merged
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
matrix_room_id:
description: Matrix ROOM ID
type: string
default: '!aqMMMrOxRZzVDkUlWF:matrix.org' # ansible-devtools
default: "!aqMMMrOxRZzVDkUlWF:matrix.org" # ansible-devtools
workflow_dispatch:
inputs:
message:
Expand All @@ -22,7 +22,7 @@ on:
matrix_room_id:
description: Matrix ROOM ID
type: string
default: '!aqMMMrOxRZzVDkUlWF:matrix.org' # ansible-devtools
default: "!aqMMMrOxRZzVDkUlWF:matrix.org" # ansible-devtools

jobs:
send-message:
Expand All @@ -43,7 +43,7 @@ jobs:
- name: send message
uses: s3krit/[email protected]
with:
room_id: '!aqMMMrOxRZzVDkUlWF:matrix.org' # ansible-devtools
room_id: "!aqMMMrOxRZzVDkUlWF:matrix.org" # ansible-devtools
access_token: ${{ secrets.MATRIX_TOKEN }}
# https://doc.matrix.tu-dresden.de/en/messaging/formatting/
message: >
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
# branches to consider in the event; optional, defaults to all
branches:
- main
- 'releases/**'
- 'stable/**'
workflow_call: # allows reuse of this workflow from other devtools repos
- "releases/**"
- "stable/**"
workflow_call: # allows reuse of this workflow from other devtools repos

jobs:
update_release_draft:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ on:
type: boolean
secrets:
pypi_password:
description: 'API token for pypi.org'
description: "API token for pypi.org"
required: true
testpypi_password:
description: 'API token for test.pypi.org'
description: "API token for test.pypi.org"
required: true

jobs:
Expand All @@ -31,7 +31,6 @@ jobs:
TOX_PARALLEL_NO_SPINNER: 1

steps:

- name: Switch to using Python 3.8 by default
uses: actions/setup-python@v4
with:
Expand All @@ -44,7 +43,7 @@ jobs:
- name: Check out src from Git
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed by setuptools-scm
fetch-depth: 0 # needed by setuptools-scm

- name: Build dists
run: python -m tox
Expand Down
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
---
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
# keep it before yamllint
rev: v3.0.3
hooks:
- id: prettier
always_run: true
- repo: https://github.com/PyCQA/doc8
rev: 'v1.1.1'
rev: "v1.1.1"
hooks:
- id: doc8
- repo: https://github.com/codespell-project/codespell
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ vscode-ansible:::tsclass --> vscode-yaml;
```

Note:

1. [vscode-yaml](https://github.com/redhat-developer/vscode-yaml) project is not directly supported by Ansible devtools team.
2. dotted lines are either test, build or optional requirements
3. 📘 python, 📙 typescript, 📕 ansible collection, 📗 container 📒 github action
Expand Down
2 changes: 1 addition & 1 deletion config/devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
repos:
- ansible-community/molecule
- ansible-community/molecule-plugins
- ansible-community/protogen # deprecated?
- ansible-community/protogen # deprecated?
- ansible-community/role2collection
- ansible/ansible-compat
- ansible/ansible-language-server
Expand Down
14 changes: 7 additions & 7 deletions docs/guides/gha.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Github Actions

* workflow name should be **short** and **lowercase** and match the name of the workflow file
* do not use a workflow name like "ci" because all workflows are related to CI one way or another so they would not be informative
- workflow name should be **short** and **lowercase** and match the name of the workflow file
- do not use a workflow name like "ci" because all workflows are related to CI one way or another so they would not be informative

## Common workflow names

* `tox` : testing jobs that rely on tox, job names should match `tox -e xxx`
* `npm` : testing jobs that reply on npm, job name should match `npm run xxx`
* `ack` : shared workflow that is triggered on any pull-request review, like editing labels
* `push` : shared workflow that is triggered on a merge, usually updates release note drafts
* `release` : workflow that is triggered when a release is made
- `tox` : testing jobs that rely on tox, job names should match `tox -e xxx`
- `npm` : testing jobs that reply on npm, job name should match `npm run xxx`
- `ack` : shared workflow that is triggered on any pull-request review, like editing labels
- `push` : shared workflow that is triggered on a merge, usually updates release note drafts
- `release` : workflow that is triggered when a release is made

## Use a final `check` job to summarize results

Expand Down
9 changes: 7 additions & 2 deletions docs/guides/mentoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,37 @@
**Ansible DevTools** team works almost exclusively on upstream projects, we do engage with other contributors every day. That is why, we are welcoming various periodic mentorship programs.

## For mentees

If you want to learn better on how to improve your **open-source collaboration** and maybe become maintainer of one project, that program might help you achieve this much easier.

The mentorship program should also help you improve collaboration with other open-source projects, especially with those from Python ecosystem.

### Checklist

- [ ] Read and acknowledge our [CoC](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html). TDLD; just be nice and friendly!
- [ ] Join `#ansible-devtools` [matrix or irc](https://docs.ansible.com/ansible/latest/community/communication.html#working-groups) channels using a permanent username, preferably the same as your GitHub account. Remain there as that would be the main medium of communication. Matrix keeps messages by default but if you choose the irc bridged room, you will need to use a bouncer to not miss messages while away.
- [ ] You are welcomed to join or follow us on [twitter](https://twitter.com/i/communities/1530798265561714693), [reddit](https://www.reddit.com/r/ansible/) and engage with others. Socializing is an important skill to master, but also try to avoid overdoing it. Making your name known to others plays an important part in improving collaboration with them but it is a slow process.
- [ ] You are welcomed to join or follow us on [twitter](https://twitter.com/i/communities/1530798265561714693), [reddit](https://www.reddit.com/r/ansible/) and engage with others. Socializing is an important skill to master, but also try to avoid overdoing it. Making your name known to others plays an important part in improving collaboration with them but it is a slow process.
- [ ] Ask your mentor to setup a weekly meeting with you, likely 30 minutes.
- [ ] Check time availability during the day and remember when it is more likely to be able to have quick chats with your mentor.
- [ ] Keep an agenda of items you want to discuss with your mentor, as you are the one that drives the process, not him.
- [ ] Decide on what you want to focus on. We recommend trying with very easy changes and slowly going for more complex.
- [ ] You will see that often enough, you discover unrelated problems that need to be sorted before you can even address the one you were working on. You can either fix them yourself or nicely try to persuade someone else to fix them, often they are problems on some external dependencies.

### Suggestions
- Prefer using the public channel unless the question is really sensitive, like a security or a personal one

- Prefer using the public channel unless the question is really sensitive, like a security or a personal one
- If blocked trying to do something, ask for someone to help you with directions
- If you fail to understand a particular CI/CD failure, ask about it

## For mentors

- [ ] Maintain a recurrent meetings with your mentee and support them in their goals
- [ ] Be available on chat, make use of public and private channels
- [ ] Remember that each side is expected to learn from the other one and that the mentorship program is not about teaching someone that the way you do is the right way.
- [ ] Welcome mentees to question anything, to see why things are one way or another and allow them to come with new ideas.

## Asking for mentorship

- As mentoring is a personal experience, you will need to ask your potential mentor about it in a private message, chat or email.
- Check if you have enough available time to invest in that. It would not be unreasonable to assume that at least **4h/week** would be needed for at least few months.
- Be sure you mention what you aim to gain from that experience, what areas you want to focus on.
Expand Down
15 changes: 7 additions & 8 deletions docs/guides/python/packaging.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
This document is work-in-progress. For the moment it contains only generic guidelines, most of them already used by our projects.

* Ensure we use `src/` layout so we do not accidentally import the module without installation
* Use PEP-517 and seek removal `setup.py`, test if via `tox -e pkg` command.
* Use PEP-621 and seek removal of `setup.cfg` and `pyprojects.toml` files.
* Make docs and test dependencies extras
* Have a single `requirements.txt` that is a lock file produced by pip-compile (pip-tools)
* Enable dependabot to update the `requirements.txt` lock file, optionally focus on a subset of dependencies and limit the maximum number of open pull-requests
* Create tox `deps` job that is updating all dependencies using pip-compile.

- Ensure we use `src/` layout so we do not accidentally import the module without installation
- Use PEP-517 and seek removal `setup.py`, test if via `tox -e pkg` command.
- Use PEP-621 and seek removal of `setup.cfg` and `pyprojects.toml` files.
- Make docs and test dependencies extras
- Have a single `requirements.txt` that is a lock file produced by pip-compile (pip-tools)
- Enable dependabot to update the `requirements.txt` lock file, optionally focus on a subset of dependencies and limit the maximum number of open pull-requests
- Create tox `deps` job that is updating all dependencies using pip-compile.

# tox -e pkg

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/python/pytest.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Useful resources for pytest:

* https://pganssle-talks.github.io/xfail-lightning
- https://pganssle-talks.github.io/xfail-lightning
9 changes: 5 additions & 4 deletions docs/guides/python/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Thanks to the integrations which are in place, it is very easy to release a newer version of our python projects i.e. [ansible-lint], [ansible-navigator], [ansible-compat] and [molecule].

[ansible-lint]:https://github.com/ansible/ansible-lint
[ansible-navigator]:https://github.com/ansible/ansible-navigator
[ansible-compat]:https://github.com/ansible/ansible-compat
[molecule]:https://github.com/ansible-community/molecule
[ansible-lint]: https://github.com/ansible/ansible-lint
[ansible-navigator]: https://github.com/ansible/ansible-navigator
[ansible-compat]: https://github.com/ansible/ansible-compat
[molecule]: https://github.com/ansible-community/molecule

Anyone with appropriate permission to the respective projects will be able to rollout a new release.

Expand All @@ -19,6 +19,7 @@ We use [release-drafter](https://github.com/release-drafter/release-drafter) whi
When a PR is merged, release-drafter runs and adds PR details to the changelog as shown above.

# Releasing a new version

Go to `Draft a new release` inside Github releases and release it! while being sure that you create a discussion thread for it. This will create a new tag.
Once released, the latest version will be deployed and published to PyPI registry.

Expand Down
11 changes: 5 additions & 6 deletions docs/guides/python/tox.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ In order to fail-fast, we want to run quick tests first, like `lint`. The longes

When you run `tox -av`, you will also see the description of each environment, which can be quite informative for a new contributor. Be sure that all of them have a description, one that is less than ~100 characters as wrapping them in terminal makes the whole list harder to read. If you want to add extra details, use comments inside the ini file.


## use short and consistent naming for env names

Tox env names should be short (easy to type) and consistent across projects, so they do not conflict with muscle-memory.
Expand All @@ -51,11 +50,11 @@ Tox env name should not be about the tool as that may change, it should be more

Current list of popular names:

* `py` - unitests
* `lint` - linting, runts all linters (likely pre-commit)
* `docs` - anything related to building docs (aka Sphinx)
* `packaging` - tests related to python packaging
* `deps` - Bumping of test dependencies. This should not be included in default `envlist`, expected to be run only manually.
- `py` - unitests
- `lint` - linting, runts all linters (likely pre-commit)
- `docs` - anything related to building docs (aka Sphinx)
- `packaging` - tests related to python packaging
- `deps` - Bumping of test dependencies. This should not be included in default `envlist`, expected to be run only manually.

## Dependency pinning

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/vscode/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Assuming that the next version is `0.8.1`:
1. `pre-commit run -a`
1. `gh pr create --draft --label skip-changelog`
1. Open pull request on github wait for it to pass. Merge it.
1. Go github releases and release it! while being sure that you create a discussion thread for it. This will create a **tag*.
1. Go github releases and release it! while being sure that you create a discussion thread for it. This will create a \*_tag_.
1. Go to https://studio-jenkins-csb-codeready.apps.ocp-c1.prod.psi.redhat.com/job/ansible/job/vscode-ansible/ and login using IPA/kerberos password (that is **not** the pin+otp one) and requires you to be on corporate VPN. In case you forgot it, you can reset it using https://identity.corp.redhat.com/resetipa
1. trigger the effective publishing. Remember to check both publishing options as they are disabled by default.
1. Use the `Approve` button to approve the effective publishing. This can be found either in the live console last line or on the graphical pipeline view as a dialog.
Expand Down
15 changes: 7 additions & 8 deletions docs/stats/molecule-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ Unmaintained drivers archived between January 5th-8th, 2023: openstack, goss, li

The relatively active drivers were moved to [molecule-plugins](https://github.com/ansible-community/molecule-plugins) repository, where we expected them to be maintained by the community.


### Which drivers should we still see in addition to delegated?

* azure
* docker
* containers
* podman
* ec2
* gce
* vagrant
- azure
- docker
- containers
- podman
- ec2
- gce
- vagrant

### How did we measure the driver popularity?

Expand Down
2 changes: 1 addition & 1 deletion playbooks/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# ansible.builtin.include_vars:
# file: ../config/devtools.yml
# name: devtools
- name: Clone projects # noqa: latest[git]
- name: Clone projects # noqa: latest[git]
loop: "{{ repos }}"
loop_control:
label: "{{ item.name }}"
Expand Down

0 comments on commit b4fd1ea

Please sign in to comment.