Skip to content

Commit e593c5f

Browse files
authored
GHA maintenance (#3876)
1 parent 5cd19b0 commit e593c5f

File tree

6 files changed

+80
-49
lines changed

6 files changed

+80
-49
lines changed

.github/dependabot.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/enabling-and-disabling-dependabot-version-updates
22
version: 2
3+
enable-beta-ecosystems: true
34
updates:
45
- package-ecosystem: "pip"
56
directory: "/"
67
schedule:
7-
interval: "daily"
8+
interval: daily
89
labels:
910
- dependencies
1011
- skip-changelog
11-
open-pull-requests-limit: 3
1212
allow:
13-
- dependency-type: all
13+
- dependency-name: "ansible*"
14+
- dependency-name: pyyaml
1415
- package-ecosystem: "github-actions"
1516
directory: "/"
1617
schedule:
1718
interval: daily
18-
open-pull-requests-limit: 3
1919
labels:
20-
- "dependencies"
21-
- "skip-changelog"
20+
- dependencies
21+
- skip-changelog

.github/release-drafter.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# see https://github.com/ansible-community/devtools
2-
_extends: ansible-community/devtools
1+
# see https://github.com/ansible/devtools
2+
_extends: ansible/devtools

.github/workflows/ack.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml
1+
---
2+
# See https://github.com/ansible/devtools/blob/main/.github/workflows/ack.yml
23
name: ack
34
on:
45
pull_request_target:
56
types: [opened, labeled, unlabeled, synchronize]
67

78
jobs:
89
ack:
9-
uses: ansible-community/devtools/.github/workflows/ack.yml@main
10+
uses: ansible/devtools/.github/workflows/ack.yml@main

.github/workflows/push.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/push.yml
1+
---
2+
# See https://github.com/ansible/devtools/blob/main/.github/workflows/push.yml
23
name: push
34
on:
45
push:
@@ -9,4 +10,4 @@ on:
910

1011
jobs:
1112
ack:
12-
uses: ansible-community/devtools/.github/workflows/push.yml@main
13+
uses: ansible/devtools/.github/workflows/push.yml@main

.github/workflows/release.yml

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
# cspell:ignore mislav
13
name: release
24

35
on:
@@ -8,41 +10,34 @@ jobs:
810
pypi:
911
name: Publish to PyPI registry
1012
environment: release
11-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-22.04
1214

1315
env:
1416
FORCE_COLOR: 1
1517
PY_COLORS: 1
1618
TOXENV: pkg
17-
TOX_PARALLEL_NO_SPINNER: 1
1819

1920
steps:
2021
- name: Switch to using Python 3.9 by default
2122
uses: actions/setup-python@v4
2223
with:
2324
python-version: 3.9
25+
2426
- name: Install tox
25-
run: >-
26-
python3 -m
27-
pip install
28-
--user
29-
tox
27+
run: python3 -m pip install --user "tox>=4.0.0"
28+
3029
- name: Check out src from Git
3130
uses: actions/checkout@v3
3231
with:
3332
fetch-depth: 0 # needed by setuptools-scm
33+
submodules: true
34+
3435
- name: Build dists
3536
run: python -m tox
36-
- name: Publish to test.pypi.org
37-
if: >- # "create" workflows run separately from "push" & "pull_request"
38-
github.event_name == 'release'
39-
uses: pypa/gh-action-pypi-publish@master
40-
with:
41-
password: ${{ secrets.testpypi_password }}
42-
repository_url: https://test.pypi.org/legacy/
37+
4338
- name: Publish to pypi.org
4439
if: >- # "create" workflows run separately from "push" & "pull_request"
4540
github.event_name == 'release'
46-
uses: pypa/gh-action-pypi-publish@master
41+
uses: pypa/gh-action-pypi-publish@release/v1
4742
with:
4843
password: ${{ secrets.pypi_password }}

.github/workflows/tox.yml

+56-22
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
---
12
name: tox
23

34
on:
4-
create: # is used for publishing to PyPI and TestPyPI
5-
tags: # any tag regardless of its name, no branches
65
push: # only publishes pushes to the main branch to TestPyPI
76
branches: # any integration branch but not tag
87
- "main"
9-
tags-ignore:
10-
- "**"
118
pull_request:
12-
schedule:
13-
- cron: 1 0 * * * # Run daily at 0:01 UTC
9+
branches:
10+
- "main"
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
14+
cancel-in-progress: true
15+
16+
env:
17+
FORCE_COLOR: 1 # tox, pytest, ansible-lint
18+
PY_COLORS: 1
1419

1520
jobs:
1621
pre:
@@ -30,26 +35,36 @@ jobs:
3035
docs
3136
pkg
3237
eco
33-
py39-devel
34-
py310-devel
38+
py311-devel
3539
3640
build:
3741
name: ${{ matrix.name }}
38-
runs-on: ubuntu-latest
42+
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
3943
needs: pre
40-
env:
41-
PYTEST_REQPASS: 454
44+
defaults:
45+
run:
46+
shell: ${{ matrix.shell || 'bash'}}
4247
# limit potential endless looks like we had with build-containers
4348
timeout-minutes: 20
4449
strategy:
4550
fail-fast: false
4651
matrix: ${{ fromJson(needs.pre.outputs.matrix) }}
4752

53+
env:
54+
PYTEST_REQPASS: 454
4855
steps:
49-
- name: Check out src from Git
50-
uses: actions/checkout@v3
56+
- uses: actions/checkout@v3
5157
with:
5258
fetch-depth: 0 # needed by setuptools-scm
59+
submodules: true
60+
61+
- name: Set pre-commit cache
62+
uses: actions/cache@v3
63+
if: ${{ matrix.passed_name == 'lint' }}
64+
with:
65+
path: |
66+
~/.cache/pre-commit
67+
key: pre-commit-${{ matrix.name || matrix.passed_name }}-${{ hashFiles('.pre-commit-config.yaml') }}
5368
- name: Install system dependencies
5469
# remove broken .deb ansible and replace with pip version:
5570
# https://github.com/actions/virtual-environments/issues/3001
@@ -66,18 +81,28 @@ jobs:
6681
&& virtualenv foo \
6782
&& source foo/bin/activate \
6883
&& ansible --version
69-
- name: Install a default Python
84+
- name: Set up Python ${{ matrix.python_version || '3.9' }}
85+
if: "!contains(matrix.shell, 'wsl')"
7086
uses: actions/setup-python@v4
7187
with:
72-
python-version: ${{ matrix.python_version }}
73-
- name: Install dependencies
74-
run: |
75-
python3 -m pip install -U pip 'coverage[toml]'
76-
python3 -m pip install 'tox>=4.0.0'
77-
- name: Run tox -e ${{ matrix.passed_name }}
88+
cache: pip
89+
python-version: ${{ matrix.python_version || '3.9' }}
90+
91+
- name: Install tox
7892
run: |
79-
${{ matrix.PREFIX }} tox -e ${{ matrix.passed_name }}
80-
continue-on-error: ${{ matrix.experimental || false }}
93+
python3 -m pip install --upgrade pip
94+
python3 -m pip install --upgrade "tox>=4.0.0"
95+
96+
- name: Log installed dists
97+
run: python3 -m pip freeze --all
98+
99+
- name: Initialize tox envs ${{ matrix.passed_name }}
100+
run: python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.passed_name }}
101+
timeout-minutes: 5 # average is under 1, but macos can be over 3
102+
103+
# sequential run improves browsing experience (almost no speed impact)
104+
- name: tox -e ${{ matrix.passed_name }}
105+
run: python3 -m tox -e ${{ matrix.passed_name }}
81106

82107
- name: Combine coverage data
83108
if: ${{ startsWith(matrix.passed_name, 'py') }}
@@ -93,6 +118,15 @@ jobs:
93118
token: ${{ secrets.CODECOV_TOKEN }}
94119
verbose: true # optional (default = false)
95120

121+
- name: Report failure if git reports dirty status
122+
run: |
123+
if [[ -n $(git status -s) ]]; then
124+
# shellcheck disable=SC2016
125+
echo -n '::error file=git-status::'
126+
printf '### Failed as git reported modified and/or untracked files\n```\n%s\n```\n' "$(git status -s)" | tee -a "$GITHUB_STEP_SUMMARY"
127+
exit 99
128+
fi
129+
# https://github.com/actions/toolkit/issues/193
96130
check:
97131
if: always()
98132

0 commit comments

Comments
 (0)