You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8cd480d
Browse filesBrowse the repository at this point in the historyBrowse files
ci(unit-tests): run platform-independent project pins once per push (#1954) (#1956)
- tests/_tiers.py: is_project_pin() and project_pin_paths(), the one rule. A
tests/project module is a pin unless its AST, or that of the repository code
it runs, imports pcapkit or compares the interpreter version.
- unit-tests.yml: project-tests runs the pins under pytest on every pull
request and push, but not under gate-only, and required-checks needs it;
every test and test-ktlo leg ignores them. The docs-only steps stay.
- experimental.yml: lists the pins on the runner's python3 and ignores them.
- tests/_dependency_gates.py: models project-tests as its own selection.
- Tier-guard tests run the steps against the rule; the 1732, queue, 1938 and
1672 tests, the workflows page and its citations follow the new layout.
Closes#1954
# `test`'s pytest flags, with the pins as the selection. A selection that
1800
+
# cannot be computed, or is empty, fails the step rather than letting a
1801
+
# bare `pytest` run the whole suite. `ulimit -f` caps any file a test
1802
+
# writes at 2 GiB (bash counts 1024-byte blocks), as experimental.yml's
1803
+
# `prlimit --fsize` does. The step cap is several times the run's
1804
+
# length, under the job's 20.
1805
+
- name: Run the project pins
1806
+
if: ${{ needs.changes.outputs.code != 'false' }}
1807
+
timeout-minutes: 10
1808
+
shell: bash
1809
+
run: |
1810
+
ulimit -f 2097152
1811
+
if ! pins=$(python -c "from tests._tiers import project_pin_paths; print(' '.join(project_pin_paths()))"); then
1812
+
echo "::error title=Could not compute the project pins::tests._tiers.project_pin_paths() failed -- see the traceback above."
1813
+
exit 1
1814
+
fi
1815
+
if [ -z "$pins" ]; then
1816
+
echo "::error title=No project pins::tests._tiers.project_pin_paths() returned nothing. Refusing to run pytest with no arguments, which would run the whole suite."
# gating leg, and folding it in would widen what merging requires -- a
1903
1967
# change for the maintainer to decide, not one to slip in here.
1904
1968
# `test`, `integration`, `engine-tests` and `pypcap-parity` are the gating
1905
-
# legs; `changes` and `project-tests` are needed only for the docs-only
1906
-
# path below.
1969
+
# legs, and `project-tests` gates every diff too, as the one run of the
1970
+
#project pins (#1954); `changes` is needed for the docs-only path below.
1907
1971
#
1908
1972
# `engine-tests`'s `unsupported` and `not-installable` cells are not a gap
1909
1973
# here: the cell script exits 0 for a cell that declined exactly as
@@ -1924,13 +1988,13 @@ jobs:
1924
1988
# `docs/**` and `*.md` files outside the code directories (the `changes`
1925
1989
# job's classifier), `test`, `integration`, `engine-tests` and
1926
1990
# `pypcap-parity` are skipped by their own `if:`, and `project-tests` runs
1927
-
#instead. A job-level `if:` rather than workflow-level `paths-ignore`,
1928
-
# because `paths-ignore` would not run this workflow at all and leave this
1929
-
# required context pending forever. So `skipped` is accepted for those
1930
-
# legs **only** when `changes` succeeded and said `code == 'false'`, and then
1931
-
# `project-tests` must have succeeded. Every other combination keeps the
1932
-
# strict rule: `changes` failing, its output missing, or any leg skipped
1933
-
# while `code` is `true` fails this gate. `changes` reports `code: true` for
1991
+
#the docs readers as well. A job-level `if:` rather than workflow-level
1992
+
#`paths-ignore`, because `paths-ignore` would not run this workflow at all
1993
+
#and leave this required context pending forever. So `skipped` is accepted
1994
+
#for those legs **only** when `changes` succeeded and said
1995
+
# `code == 'false'`; `project-tests` must have succeeded either way. Every
1996
+
#other combination keeps the strict rule: `changes` failing, its output
1997
+
#missing, or any leg skipped while `code` is `true` fails this gate. `changes` reports `code: true` for
1934
1998
# every event but this workflow's own `pull_request`, so `push` and
1935
1999
# `workflow_call` runs never take this path.
1936
2000
required-checks:
@@ -1966,11 +2030,13 @@ jobs:
1966
2030
failed=1
1967
2031
fi
1968
2032
1969
-
# Docs-only (code == false): a leg may be skipped, and project-tests
1970
-
# is what must have passed. Otherwise every leg must have succeeded.
2033
+
# project-tests runs the project pins on every diff (#1954), and the
2034
+
# docs readers on a docs-only one, so it must pass on both paths.
2035
+
# Docs-only (code == false): a leg may be skipped. Otherwise every leg
2036
+
# must have succeeded.
2037
+
[ "$PROJECT_TESTS" = "success" ] || { echo "::error title=project-tests did not succeed::result was '$PROJECT_TESTS'; it runs the project pins, and on a docs-only diff the docs readers too, so it has to pass."; failed=1; }
1971
2038
if [ "$CODE" = "false" ]; then
1972
2039
allowed="success skipped"
1973
-
[ "$PROJECT_TESTS" = "success" ] || { echo "::error title=project-tests did not succeed::result was '$PROJECT_TESTS'; on a docs-only diff it is the test that has to pass."; failed=1; }
0 commit comments