Skip to content

Commit

Permalink
Merge branch 'main' into chore/packit
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored May 28, 2024
2 parents 53b3672 + 29cfc62 commit 84346e1
Show file tree
Hide file tree
Showing 40 changed files with 984 additions and 411 deletions.
278 changes: 111 additions & 167 deletions requirements.txt → .config/constraints.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .config/requirements-docs.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
argparse-manpage
black
mkdocs-ansible>=24.3.1
5 changes: 5 additions & 0 deletions .config/requirements-test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage
pip-tools
pytest-mock
pytest-plus>=0.6.1
pytest>=7.2.0
7 changes: 7 additions & 0 deletions .config/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html
ansible-core>=2.14
packaging
PyYAML
subprocess-tee>=0.4.1
jsonschema>=4.6.0
typing-extensions>=4.5.0;python_version<'3.10'
9 changes: 5 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
---
# Until bug below is sorted we will not allow dependabot to run by itself
# https://github.com/dependabot/dependabot-core/issues/369
version: 2
updates:
- package-ecosystem: pip
directory: /
directory: ".config"
schedule:
day: sunday
interval: weekly
labels:
- dependabot-deps-updates
- skip-changelog
versioning-strategy: lockfile-only
open-pull-requests-limit: 0 # neutered
groups:
dependencies:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
5 changes: 3 additions & 2 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# see https://github.com/ansible/devtools
_extends: ansible/devtools
---
# see https://github.com/ansible/team-devtools
_extends: ansible/team-devtools
5 changes: 3 additions & 2 deletions .github/workflows/ack.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# See https://github.com/ansible/devtools/blob/main/.github/workflows/ack.yml
# See https://github.com/ansible/team-devtools/blob/main/.github/workflows/ack.yml
name: ack
on:
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]

jobs:
ack:
uses: ansible/devtools/.github/workflows/ack.yml@main
uses: ansible/team-devtools/.github/workflows/ack.yml@main
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See https://github.com/ansible/devtools/blob/main/.github/workflows/push.yml
# See https://github.com/ansible/team-devtools/blob/main/.github/workflows/push.yml
name: push
on:
push:
Expand All @@ -9,4 +9,4 @@ on:

jobs:
ack:
uses: ansible/devtools/.github/workflows/push.yml@main
uses: ansible/team-devtools/.github/workflows/push.yml@main
10 changes: 3 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ on:
types: [published]

jobs:
before-release:
uses: ansible/ansible-compat/.github/workflows/tox.yml@main

release:
name: release ${{ github.event.ref }}
needs: before-release
# unable to use environment with uses/with, basically cannot reuse release pipelines
environment: release
runs-on: ubuntu-22.04
Expand All @@ -23,17 +19,17 @@ jobs:
TOX_PARALLEL_NO_SPINNER: 1

steps:
- name: Switch to using Python 3.9 by default
- name: Switch to using Python 3.12 by default
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: "3.12"
- name: Install tox
run: python3 -m pip install --user "tox>=4.0.0"
- name: Check out src from Git
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed by setuptools-scm
- name: Build dists
run: python -m tox -e pkg
run: python3 -m tox -e pkg
- name: Publish to pypi.org
uses: pypa/gh-action-pypi-publish@unstable/v1
116 changes: 88 additions & 28 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:
workflow_call:

jobs:
pre:
name: pre
prepare:
name: prepare
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
Expand All @@ -24,47 +24,50 @@ jobs:
with:
min_python: "3.9"
max_python: "3.12"
default_python: "3.10"
other_names: |
lint
docs
pkg
py39-ansible212
py39-ansible213
py39-ansible214
py39-ansible215
py311-devel
py310-ansible215
py311-ansible215
py312-ansible216
py312-devel
smoke
platforms: linux,macos
macos: minmax
build:
name: ${{ matrix.name }}

runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
needs: pre
needs: prepare
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.pre.outputs.matrix) }}
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
env:
FORCE_COLOR: 1

PYTEST_REQPASS: 108
steps:
- name: Check out src from Git
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed by setuptools-scm
submodules: true

- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}

- name: Pre-commit cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ matrix.name }}-pre-commit-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }}

- name: Pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ matrix.name }}-pip-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }}
Expand All @@ -73,34 +76,91 @@ jobs:
run: python3 -m pip install --upgrade 'tox>=4.0.3'

- name: Initialize tox envs
run: python -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.passed_name }}
run: python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.passed_name }}

- name: Test with tox
run: python -m tox -e ${{ matrix.passed_name }}
- name: tox -e ${{ matrix.passed_name }}
run: python3 -m tox -e ${{ matrix.passed_name }}

- name: Archive logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: logs.zip
path: .tox/**/log/
name: logs-${{ matrix.name }}.zip
path: |
.tox/**/log/
.tox/**/.coverage*
.tox/**/coverage.xml
- name: Upload coverage data
if: ${{ startsWith(matrix.passed_name, 'py') }}
uses: codecov/codecov-action@v3
with:
name: ${{ matrix.passed_name }}
fail_ci_if_error: false # see https://github.com/codecov/codecov-action/issues/598
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false)
- name: Report failure if git reports dirty status
run: |
if [[ -n $(git status -s) ]]; then
# shellcheck disable=SC2016
echo -n '::error file=git-status::'
printf '### Failed as git reported modified and/or untracked files\n```\n%s\n```\n' "$(git status -s)" | tee -a "$GITHUB_STEP_SUMMARY"
exit 99
fi
# https://github.com/actions/toolkit/issues/193

check: # This job does nothing and is only used for the branch protection
check:
if: always()
permissions:
id-token: write
checks: read

needs:
- build
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
# checkout needed for codecov action which needs codecov.yml file
- uses: actions/checkout@v4

- name: Set up Python # likely needed for coverage
uses: actions/setup-python@v5
with:
python-version: "3.12"

- run: pip3 install 'coverage>=7.5.1'

- name: Merge logs into a single archive
uses: actions/upload-artifact/merge@v4
with:
name: logs.zip
pattern: logs-*.zip
# artifacts like py312.zip and py312-macos do have overlapping files
separate-directories: true

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: logs.zip
path: .

- name: Check for expected number of coverage.xml reports
run: |
JOBS_PRODUCING_COVERAGE=12
if [ "$(find . -name coverage.xml | wc -l | bc)" -ne "${JOBS_PRODUCING_COVERAGE}" ]; then
echo "::error::Number of coverage.xml files was not the expected one (${JOBS_PRODUCING_COVERAGE}): $(find . -name coverage.xml |xargs echo)"
exit 1
fi
- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
name: ${{ matrix.passed_name }}
# verbose: true # optional (default = false)
fail_ci_if_error: true
use_oidc: true # cspell:ignore oidc

- name: Check codecov.io status
if: github.event_name == 'pull_request'
uses: coactions/codecov-status@main

- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

- name: Delete Merged Artifacts
uses: actions/upload-artifact/merge@v4
with:
delete-merged: true
Loading

0 comments on commit 84346e1

Please sign in to comment.