Skip to content

Commit 62f3ce7

Browse files
pulpbotdralley
authored andcommitted
Update CI files
1 parent 9e2ddfc commit 62f3ce7

File tree

8 files changed

+51
-24
lines changed

8 files changed

+51
-24
lines changed

.ci/scripts/skip_tests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
DOC_PATTERNS = [
2626
r"^docs/",
2727
r"\.md$",
28-
r"\.txt$",
2928
r"LICENSE.*",
3029
r"CHANGELOG.*",
3130
r"CHANGES.*",

.github/workflows/ci.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
runs-on: ubuntu-latest
4848
outputs:
4949
run_tests: ${{ steps.check.outputs.run_tests }}
50+
run_docs: ${{ steps.check.outputs.run_docs }}
5051
steps:
5152
- uses: "actions/checkout@v4"
5253
with:
@@ -67,6 +68,13 @@ jobs:
6768
shell: bash
6869
id: check
6970
run: |
71+
# We only test docs on the default branch (usually main)
72+
if [[ "${{ github.base_ref }}" == *"main" ]]; then
73+
echo "run_docs=1" >> $GITHUB_OUTPUT
74+
else
75+
echo "run_docs=0" >> $GITHUB_OUTPUT
76+
fi
77+
7078
set +e
7179
BASE_REF=${{ github.event.pull_request.base.sha }}
7280
echo "Checking against:"
@@ -80,7 +88,10 @@ jobs:
8088
echo "run_tests=$exit_code" >> $GITHUB_OUTPUT
8189
8290
docs:
91+
needs: "check-changes"
8392
uses: "./.github/workflows/docs.yml"
93+
with:
94+
run_docs: ${{ needs.check-changes.outputs.run_docs }}
8495

8596
lint:
8697
needs:
@@ -133,13 +144,30 @@ jobs:
133144
- name: "Collect needed jobs results"
134145
working-directory: "."
135146
run: |
136-
if [ ${{ needs.check-changes.outputs.run_tests }} == "1" ]; then
137-
# Full test run - check all jobs
138-
echo '${{toJson(needs)}}' | jq -r 'to_entries[]|select(.value.result!="success")|.key + ": " + .value.result'
139-
echo '${{toJson(needs)}}' | jq -e 'to_entries|map(select(.value.result!="success"))|length == 0'
140-
else
141-
# Docs-only run - check only required jobs (exclude lint and test)
142-
echo '${{toJson(needs)}}' | jq -r 'to_entries[]|select(.key != "lint" and .key != "test")|select(.value.result!="success")|.key + ": " + .value.result'
143-
echo '${{toJson(needs)}}' | jq -e 'to_entries|map(select(.key != "lint" and .key != "test"))|map(select(.value.result!="success"))|length == 0'
147+
RUN_TESTS=${{ needs.check-changes.outputs.run_tests }}
148+
RUN_DOCS=${{ needs.check-changes.outputs.run_docs }}
149+
150+
check_jobs() {
151+
local filter="$1"
152+
local needs_json='${{toJson(needs)}}'
153+
# output failed jobs after filter
154+
echo "$needs_json" | jq -r "to_entries[]|select($filter)|select(.value.result!=\"success\")|.key + \": \" + .value.result"
155+
# fails if not all selected jobs passed
156+
echo "$needs_json" | jq -e "to_entries|map(select($filter))|map(select(.value.result!=\"success\"))|length == 0"
157+
}
158+
159+
if [ "$RUN_TESTS" == "1" ] && [ "$RUN_DOCS" == "1" ]; then
160+
FILTERS="true" # check all jobs
161+
elif [ "$RUN_TESTS" == "1" ] && [ "$RUN_DOCS" == "0" ]; then
162+
echo "Skipping docs: running on non-default branch"
163+
FILTERS='.key != "docs"'
164+
elif [ "$RUN_TESTS" == "0" ] && [ "$RUN_DOCS" == "1" ]; then
165+
echo "Skipping tests: only doc changes"
166+
FILTERS='.key != "lint" and .key != "test"'
167+
else # RUN_TESTS=0, RUN_DOCS=0
168+
echo "What is this PR doing??"
169+
FILTERS='.key != "lint" and .key != "test" and .key != "docs"'
144170
fi
171+
172+
check_jobs "$FILTERS"
145173
echo "CI says: Looks good!"

.github/workflows/docs.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
name: "Docs CI"
1010
on:
1111
workflow_call:
12+
inputs:
13+
run_docs:
14+
description: "Whether to run docs jobs"
15+
required: true
16+
type: string
1217

1318
jobs:
1419
changelog:
15-
if: "endsWith(github.base_ref, 'main')"
1620
runs-on: "ubuntu-latest"
1721
defaults:
1822
run:
@@ -34,14 +38,7 @@ jobs:
3438
run: |
3539
towncrier build --yes --version 4.0.0.ci
3640
docs:
37-
if: "endsWith(github.base_ref, 'main')"
41+
if: ${{ inputs.run_docs == '1' }}
3842
uses: 'pulp/pulp-docs/.github/workflows/docs-ci.yml@main'
3943
with:
4044
pulpdocs_ref: 'main'
41-
42-
no-test:
43-
if: "!endsWith(github.base_ref, 'main')"
44-
runs-on: "ubuntu-latest"
45-
steps:
46-
- run: |
47-
echo "Skip docs testing on non-default branches."

.github/workflows/publish.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,11 @@ jobs:
167167
pip install towncrier
168168
169169
- name: "Get release notes"
170-
id: get_release_notes
170+
id: "get_release_notes"
171+
shell: "bash"
171172
run: |
173+
# The last commit before the release commit contains the release CHANGES fragments
174+
git checkout "${TAG_NAME}~"
172175
NOTES=$(towncrier build --draft --version $TAG_NAME)
173176
echo "body<<EOF" >> $GITHUB_OUTPUT
174177
echo "$NOTES" >> $GITHUB_OUTPUT

.github/workflows/scripts/build_python_client.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ rm -rf "pulp_python-client"
2121
./gen-client.sh "../pulp_python/python-api.json" "python" python "pulp_python"
2222

2323
pushd pulp_python-client
24-
python setup.py sdist bdist_wheel --python-tag py3
24+
python -m build
2525

2626
twine check "dist/pulp_python_client-"*"-py3-none-any.whl"
27-
twine check "dist/pulp_python-client-"*".tar.gz"
27+
twine check "dist/pulp_python_client-"*".tar.gz"
2828

2929
tar cvf "../../pulp_python/python-python-client.tar" ./dist
3030

.github/workflows/scripts/publish_client_pypi.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ fi
2222

2323
twine upload -u __token__ -p "${PYPI_API_TOKEN}" \
2424
"dist/pulp_python_client-${VERSION}-py3-none-any.whl" \
25-
"dist/pulp_python-client-${VERSION}.tar.gz" \
25+
"dist/pulp_python_client-${VERSION}.tar.gz" \
2626
;

.github/workflows/scripts/script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pushd ../pulp-openapi-generator
7272
rm -rf "./${PACKAGE}-client"
7373
./gen-client.sh "${COMPONENT}-api.json" "${COMPONENT}" python "${PACKAGE}"
7474
pushd "${PACKAGE}-client"
75-
python setup.py sdist bdist_wheel --python-tag py3
75+
python -m build
7676
popd
7777
else
7878
if [ ! -f "${PACKAGE}-client/dist/${PACKAGE}_client-${VERSION}-py3-none-any.whl" ]

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
- name: "Install python dependencies"
7272
run: |
7373
echo ::group::PYDEPS
74-
pip install towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch bump-my-version 'click<8.3'
74+
pip install build towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch bump-my-version 'click<8.3'
7575
echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulp_python/.ci/assets/httpie/" >> $GITHUB_ENV
7676
echo ::endgroup::
7777

0 commit comments

Comments
 (0)