Skip to content

Commit 03d38d6

Browse files
committed
Update CI
[noissue]
1 parent 7c08b77 commit 03d38d6

19 files changed

+146
-226
lines changed

.bumpversion.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ values =
1818

1919
[bumpversion:file:./setup.py]
2020

21+
[bumpversion:file:./functest_requirements.txt]
22+
2123
[bumpversion:file:./docs/conf.py]

.ci/ansible/Containerfile.j2

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ FROM {{ ci_base | default("ghcr.io/pulp/pulp-ci-centos:" + pulp_container_tag) }
22

33
# Add source directories to container
44
{% for item in plugins %}
5-
{% if item.source.startswith("./") %}
5+
{% if item.source.startswith("./") or item.ci_requirements | default(false) %}
66
ADD {{ item.source }} {{ item.source }}
77
{% endif %}
88
{% endfor %}
99

1010
# Install python packages
1111
# Hacking botocore (https://github.com/boto/botocore/pull/1990)
1212

13-
RUN pip3 install \
13+
RUN pip3 install
1414
{%- if stream_test | default(false) -%}
1515
{{ " " }}django-storages[sftp]
1616
{%- endif -%}
@@ -27,7 +27,10 @@ RUN pip3 install \
2727
{%- if item.name == "pulp-certguard" -%}
2828
{{ " " }}python-dateutil rhsm
2929
{%- endif -%}
30-
{{ " " }}"{{ item.source }}"
30+
{{ " " }}{{ item.source }}
31+
{%- if item.ci_requirements | default(false) -%}
32+
{{ " " }}-r ./{{ item.name }}/ci_requirements.txt
33+
{%- endif -%}
3134
{%- endfor %}
3235

3336
USER pulp:pulp

.ci/scripts/calc_deps_lowerbounds.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
from packaging.requirements import Requirement
99

1010

11-
# We install these from source, but it would be really handy if we could test pulpcore
12-
# compatibility that way too.
13-
EXCEPTIONS = [
14-
"pulpcore",
15-
]
16-
17-
1811
def main():
1912
"""Calculate the lower bound of dependencies where possible."""
2013
with open("requirements.txt") as req_file:
@@ -24,16 +17,13 @@ def main():
2417
except ValueError:
2518
print(line.strip())
2619
else:
27-
if requirement.name.replace("-", "_") in EXCEPTIONS:
28-
print(line.strip())
20+
for spec in requirement.specifier:
21+
if spec.operator == ">=":
22+
min_version = str(spec)[2:]
23+
print(f"{requirement.name}=={min_version}")
24+
break
2925
else:
30-
for spec in requirement.specifier:
31-
if spec.operator == ">=":
32-
min_version = str(spec)[2:]
33-
print(f"{requirement.name}=={min_version}")
34-
break
35-
else:
36-
print(line.strip())
26+
print(line.strip())
3727

3828

3929
if __name__ == "__main__":

.ci/scripts/check_requirements.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# WARNING: DO NOT EDIT!
2+
#
3+
# This file was generated by plugin_template, and is managed by it. Please use
4+
# './plugin-template --github pulp_python' to update this file.
5+
#
6+
# For more info visit https://github.com/pulp/plugin_template
7+
8+
import warnings
9+
from pkg_resources import Requirement
10+
11+
12+
CHECK_MATRIX = [
13+
("requirements.txt", True, True, True),
14+
("dev_requirements.txt", False, True, False),
15+
("ci_requirements.txt", False, True, True),
16+
("doc_requirements.txt", False, True, False),
17+
("lint_requirements.txt", False, True, True),
18+
("unittest_requirements.txt", False, True, True),
19+
("functest_requirements.txt", False, True, True),
20+
("clitest_requirements.txt", False, True, True),
21+
]
22+
23+
errors = []
24+
25+
for filename, check_upperbound, check_prereleases, check_r in CHECK_MATRIX:
26+
try:
27+
with open(filename, "r") as fd:
28+
for nr, line in enumerate(fd.readlines()):
29+
line = line.strip()
30+
if not line or line.startswith("#"):
31+
continue
32+
try:
33+
req = Requirement.parse(line)
34+
except ValueError:
35+
if line.startswith("git+"):
36+
# The single exception...
37+
if "pulp-smash" not in line:
38+
errors.append(f"{filename}:{nr}: Invalid source requirement: {line}")
39+
elif line.startswith("-r "):
40+
if check_r:
41+
errors.append(f"{filename}:{nr}: Invalid deferred requirement: {line}")
42+
else:
43+
errors.append(f"{filename}:{nr}: Unreadable requirement {line}")
44+
else:
45+
if check_prereleases and req.specifier.prereleases:
46+
if req.name != "pulp-python-client":
47+
errors.append(f"{filename}:{nr}: Prerelease versions found in {line}.")
48+
ops = [op for op, ver in req.specs]
49+
spec = str(req.specs)
50+
if "~=" in ops:
51+
warnings.warn(f"{filename}:{nr}: Please avoid using ~= on {req.name}!")
52+
elif "<" not in ops and "<=" not in ops and "==" not in ops:
53+
if check_upperbound:
54+
errors.append(f"{filename}:{nr}: Upper bound missing in {line}.")
55+
except FileNotFoundError:
56+
# skip this test for plugins that don't use this requirements.txt
57+
pass
58+
59+
if errors:
60+
print("Dependency issues found:")
61+
print("\n".join(errors))
62+
exit(1)

.ci/scripts/upper_bound.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/template_gitref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021.08.26-197-g21230dd
1+
2021.08.26-198-g8f49b35

.github/workflows/changelog.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v3
2828
with:
29-
# by default, it uses a depth of 1
30-
# this fetches all history so that we can read each commit
31-
fetch-depth: 0
29+
fetch-depth: 1
3230

3331
- uses: actions/setup-python@v3
3432
with:

.github/workflows/ci.yml

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,17 @@ name: Python CI
1010
on: {pull_request: {branches: ['*']}}
1111
jobs:
1212

13-
14-
single_commit:
15-
name: Assert single commit
16-
if: github.base_ref == 'main'
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v3
20-
with:
21-
fetch-depth: 30
22-
- name: Checkout main
23-
run: git fetch origin main
24-
- name: create local main branch
25-
run: git branch main origin/main
26-
- name: Commit Count Check
27-
run: test `git log --oneline --no-merges HEAD ^main | wc -l ` = 1
13+
ready-to-ship:
2814
runs-on: ubuntu-latest
29-
30-
lint:
31-
runs-on: ubuntu-latest
32-
33-
3415
steps:
3516
- uses: actions/checkout@v3
3617
with:
37-
# by default, it uses a depth of 1
38-
# this fetches all history so that we can read each commit
3918
fetch-depth: 0
40-
4119
- uses: actions/setup-python@v3
4220
with:
4321
python-version: "3.8"
44-
45-
# lint_requirements contains tools needed for flake8, etc.
4622
- name: Install requirements
47-
run: pip3 install -r lint_requirements.txt
48-
23+
run: pip3 install github
4924
- name: Check commit message
5025
if: github.event_name == 'pull_request'
5126
env:
@@ -58,6 +33,36 @@ jobs:
5833
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5934
GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }}
6035
run: sh .github/workflows/scripts/check_commit.sh
36+
- name: Verify requirements files
37+
run: python .ci/scripts/check_requirements.py
38+
single_commit:
39+
runs-on: ubuntu-latest
40+
name: Assert single commit
41+
if: github.base_ref == 'main'
42+
steps:
43+
- uses: actions/checkout@v3
44+
with:
45+
fetch-depth: 0
46+
- name: Checkout main
47+
run: git fetch origin main
48+
- name: create local main branch
49+
run: git branch main origin/main
50+
- name: Commit Count Check
51+
run: test `git log --oneline --no-merges HEAD ^main | wc -l ` = 1
52+
53+
lint:
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- uses: actions/checkout@v3
58+
with:
59+
fetch-depth: 1
60+
- uses: actions/setup-python@v3
61+
with:
62+
python-version: "3.8"
63+
# lint_requirements contains tools needed for flake8, etc.
64+
- name: Install requirements
65+
run: pip3 install -r lint_requirements.txt
6166

6267

6368

@@ -78,9 +83,6 @@ jobs:
7883
- name: Check for gettext problems
7984
run: sh .ci/scripts/check_gettext.sh
8085

81-
- name: Verify upper bound requirements
82-
run: python .ci/scripts/upper_bound.py
83-
8486
test:
8587
runs-on: ubuntu-latest
8688
# run only after lint finishes
@@ -103,9 +105,7 @@ jobs:
103105
steps:
104106
- uses: actions/checkout@v3
105107
with:
106-
# by default, it uses a depth of 1
107-
# this fetches all history so that we can read each commit
108-
fetch-depth: 0
108+
fetch-depth: 1
109109

110110
- uses: actions/setup-python@v3
111111
with:
@@ -123,7 +123,6 @@ jobs:
123123
echo "TEST=${{ matrix.env.TEST }}" >> $GITHUB_ENV
124124
125125
- name: Before Install
126-
127126
run: .github/workflows/scripts/before_install.sh
128127
shell: bash
129128
env:
@@ -137,7 +136,6 @@ jobs:
137136
GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }}
138137

139138
- name: Install
140-
141139
run: .github/workflows/scripts/install.sh
142140
shell: bash
143141
env:
@@ -150,13 +148,7 @@ jobs:
150148
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151149
GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }}
152150

153-
- name: Install Python client
154-
155-
run: .github/workflows/scripts/install_python_client.sh
156-
shell: bash
157-
158151
- name: Before Script
159-
160152
run: .github/workflows/scripts/before_script.sh
161153
shell: bash
162154
env:
@@ -177,7 +169,6 @@ jobs:
177169
SECRETS_CONTEXT: ${{ toJson(secrets) }}
178170

179171
- name: Script
180-
181172
run: .github/workflows/scripts/script.sh
182173
shell: bash
183174
env:

.github/workflows/create-branch.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v3
2929
with:
30-
# by default, it uses a depth of 1
31-
# this fetches all history so that we can read each commit
32-
fetch-depth: 0
30+
fetch-depth: 1
3331

3432
- uses: actions/setup-python@v3
3533
with:
@@ -42,7 +40,6 @@ jobs:
4240
echo ::endgroup::
4341
4442
- name: Setting secrets
45-
4643
run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT"
4744
env:
4845
SECRETS_CONTEXT: ${{ toJson(secrets) }}

0 commit comments

Comments
 (0)