Skip to content

Commit

Permalink
Merge pull request #999 from pulp/update-ci/main
Browse files Browse the repository at this point in the history
Update CI files for branch main
  • Loading branch information
quba42 authored Jan 30, 2024
2 parents 84725f4 + 7f43fbe commit ade679d
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 34 deletions.
13 changes: 8 additions & 5 deletions .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main():
"--branches",
default="supported",
help="A comma separated list of branches to check for releases. Can also use keyword: "
"'supported'. Defaults to 'supported', see `ci_update_branches` in "
"'supported'. Defaults to 'supported', see `supported_release_branches` in "
"`plugin_template.yml`.",
)
opts = parser.parse_args()
Expand All @@ -46,12 +46,15 @@ def main():
if branches == "supported":
with open(f"{d}/template_config.yml", mode="r") as f:
tc = yaml.safe_load(f)
branches = tc["ci_update_branches"]
branches.append(DEFAULT_BRANCH)
branches = set(tc["supported_release_branches"])
latest_release_branch = tc["latest_release_branch"]
if latest_release_branch is not None:
branches.add(latest_release_branch)
branches.add(DEFAULT_BRANCH)
else:
branches = branches.split(",")
branches = set(branches.split(","))

if diff := set(branches) - set(available_branches):
if diff := branches - set(available_branches):
print(f"Supplied branches contains non-existent branches! {diff}")
exit(1)

Expand Down
8 changes: 5 additions & 3 deletions .ci/scripts/collect_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
CHANGELOG_FILE = tc_settings.get("filename", "NEWS.rst")
START_STRING = tc_settings.get(
"start_string",
"<!-- towncrier release notes start -->\n"
if CHANGELOG_FILE.endswith(".md")
else ".. towncrier release notes start\n",
(
"<!-- towncrier release notes start -->\n"
if CHANGELOG_FILE.endswith(".md")
else ".. towncrier release notes start\n"
),
)
TITLE_FORMAT = tc_settings.get("title_format", "{name} {version} ({project_date})")

Expand Down
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-304-gc53c1e3
2021.08.26-310-g59cd732
13 changes: 13 additions & 0 deletions .github/workflows/create-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ jobs:
run: |
find CHANGES -type f -regex ".*\.\(bugfix\|doc\|feature\|misc\|deprecation\|removal\)" -exec git rm {} +
- name: Checkout plugin template
uses: actions/checkout@v3
with:
repository: pulp/plugin_template
path: plugin_template
fetch-depth: 0

- name: Update CI branches in template_config
working-directory: plugin_template
run: |
python3 ./plugin-template pulp_deb --github --latest-release-branch "${NEW_BRANCH}"
git add -A
- name: Make a PR with version bump and without CHANGES/*
uses: peter-evans/create-pull-request@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: "Deb Publish Release"
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]"
- "[0-9]+.[0-9]+.[0-9]+"

defaults:
run:
Expand All @@ -22,7 +22,7 @@ jobs:

build-bindings-docs:
needs:
- "build-artifacts"
- "build"
runs-on: "ubuntu-latest"
# Install scripts expect TEST to be set, 'docs' is most appropriate even though we don't run tests
env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
with:
fetch-depth: 0
path: "pulp_deb"
token: ${{ secrets.RELEASE_TOKEN }}

- uses: "actions/setup-python@v4"
with:
Expand Down
Empty file modified .github/workflows/scripts/release.sh
100644 → 100755
Empty file.
23 changes: 11 additions & 12 deletions .github/workflows/scripts/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,30 +129,29 @@ echo "Checking for uncommitted migrations..."
cmd_user_prefix bash -c "django-admin makemigrations deb --check --dry-run"

# Run unit tests.
cmd_user_prefix bash -c "PULP_DATABASES__default__USER=postgres pytest -v -r sx --color=yes -p no:pulpcore --pyargs pulp_deb.tests.unit"
cmd_user_prefix bash -c "PULP_DATABASES__default__USER=postgres pytest -v -r sx --color=yes --suppress-no-test-exit-code -p no:pulpcore --pyargs pulp_deb.tests.unit"

# Run functional tests
if [[ "$TEST" == "performance" ]]; then
if [[ -z ${PERFORMANCE_TEST+x} ]]; then
cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulp_deb.tests.performance"
cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --suppress-no-test-exit-code --capture=no --durations=0 --pyargs pulp_deb.tests.performance"
else
cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulp_deb.tests.performance.test_${PERFORMANCE_TEST}"
cmd_user_prefix bash -c "pytest -vv -r sx --color=yes --suppress-no-test-exit-code --capture=no --durations=0 --pyargs pulp_deb.tests.performance.test_${PERFORMANCE_TEST}"
fi
exit
fi

if [ -f "$FUNC_TEST_SCRIPT" ]; then
source "$FUNC_TEST_SCRIPT"
else
if [[ "$GITHUB_WORKFLOW" == "Deb Nightly CI/CD" ]]
then
cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulp_deb.tests.functional -m parallel -n 8 --nightly"
cmd_user_prefix bash -c "pytest -v -r sx --color=yes --pyargs pulp_deb.tests.functional -m 'not parallel' --nightly"

else
cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulp_deb.tests.functional -m parallel -n 8"
cmd_user_prefix bash -c "pytest -v -r sx --color=yes --pyargs pulp_deb.tests.functional -m 'not parallel'"
fi
if [[ "$GITHUB_WORKFLOW" =~ "Nightly" ]]
then
cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulp_deb.tests.functional -m parallel -n 8 --nightly"
cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulp_deb.tests.functional -m 'not parallel' --nightly"
else
cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulp_deb.tests.functional -m parallel -n 8"
cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulp_deb.tests.functional -m 'not parallel'"
fi
fi
export PULP_FIXTURES_URL="http://pulp-fixtures:8080"
pushd ../pulp-cli-deb
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/scripts/update_backport_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ def random_color():
assert response.status_code == 200
old_labels = set([x["name"] for x in response.json() if x["name"].startswith("backport-")])

# get ci_update_branches from template_config.yml
# get list of branches from template_config.yml
with open("./template_config.yml", "r") as f:
plugin_template = yaml.safe_load(f)
new_labels = set(["backport-" + x for x in plugin_template["ci_update_branches"]])
branches = set(plugin_template["supported_release_branches"])
latest_release_branch = plugin_template["latest_release_branch"]
if latest_release_branch is not None:
branches.add(latest_release_branch)
new_labels = {"backport-" + x for x in branches}

# delete old labels that are not in new labels
for label in old_labels.difference(new_labels):
Expand Down
2 changes: 1 addition & 1 deletion docs/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-304-gc53c1e3
2021.08.26-310-g59cd732
2 changes: 1 addition & 1 deletion functest_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest
pytest<8
python-debian>=0.1.36
pytest-custom_exit_code
pytest-xdist
Expand Down
2 changes: 1 addition & 1 deletion lint_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# For more info visit https://github.com/pulp/plugin_template

# python packages handy for developers, but not required by pulp
black
black==23.12.1
check-manifest
flake8
flake8-black
Expand Down
11 changes: 5 additions & 6 deletions template_config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# This config represents the latest values used when running the plugin-template. Any settings that
# were not present before running plugin-template have been added with their default values.

# generated with [email protected]301-g83f0607
# generated with [email protected]310-g59cd732

additional_repos: []
api_root: /pulp/
black: true
check_commit_message: true
Expand All @@ -12,11 +11,7 @@ check_manifest: true
check_stray_pulpcore_imports: true
ci_env: {}
ci_trigger: '{pull_request: {branches: [''*'']}}'
ci_update_branches:
- '3.0'
- '3.1'
ci_update_docs: true
ci_update_release_behavior: null
cli_package: pulp-cli-deb
cli_repo: https://github.com/pulp/pulp-cli-deb.git
core_import_allowed: []
Expand All @@ -33,6 +28,7 @@ flake8_ignore: []
github_org: pulp
issue_tracker: github
kanban: false
latest_release_branch: null
lint_requirements: true
noissue_marker: '[noissue]'
parallel_test_workers: 8
Expand Down Expand Up @@ -72,6 +68,9 @@ stalebot: true
stalebot_days_until_close: 30
stalebot_days_until_stale: 90
stalebot_limit_to_pulls: true
supported_release_branches:
- '3.0'
- '3.1'
sync_ci: true
test_azure: true
test_cli: true
Expand Down
1 change: 1 addition & 0 deletions unittest_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pytest<8
pytest-django

0 comments on commit ade679d

Please sign in to comment.