Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions .github/workflows/plugin_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
runs-on: ${{ (inputs.platform == 'freebsd_amd64' || inputs.platform == 'linux_amd64') && 'ubuntu-24.04' || (inputs.platform == 'linux_arm64' && 'ubuntu-24.04-arm' || (inputs.platform == 'darwin_amd64' && 'macos-15-intel' || (inputs.platform == 'darwin_arm64' && 'macos-15' || 'unknown'))) }}
steps:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proof that all of this works is in the "in-repo please_pex tool" test matrix passing - the others will fail because they use the build defs from this PR but the older stable version of please_pex, which is missing features added by this PR. The GHA workflow is now structured in such a way that only the "in-repo please_pex tool" test matrix needs to pass in order for a new version of please_pex to be released, so after I've tagged a new please_pex version and updated //tools:please_pex to download it, the other test matrices will also start passing again.

- name: Install Python in CI environment
# actions/setup-python doesn't support FreeBSD - instead, interpreters for the supported Python versions are
# pre-installed in the FreeBSD runner image.
if: ${{ inputs.platform != 'freebsd_amd64' }}
id: python
uses: actions/setup-python@v6
Expand All @@ -36,14 +38,11 @@ jobs:
update-environment: false
- name: Check out code
uses: actions/checkout@v5
- name: Configure plugin's default Python interpreter
run: |
_python_path="${{ inputs.platform == 'freebsd_amd64' && format('python{0}', inputs.python) || steps.python.outputs.python-path }}"
echo "PLZ_ARGS=-o plugin.python.defaultinterpreter:$_python_path" >> $GITHUB_ENV
- name: Configure plugin to use please_pex tool built from source
if: inputs.please_pex_from_repo
run: |
echo "PLZ_ARGS=${PLZ_ARGS:+$PLZ_ARGS }-o plugin.python.pextool://tools/please_pex" >> $GITHUB_ENV
# PexTool can't be set to //tools/please_pex for e2e tests because it can't be built inside the e2e test
# environment - skip the e2e tests if we're using //tools/please_pex as the pex tool.
run: echo "PLZ_ARGS=${PLZ_ARGS:+$PLZ_ARGS }-o plugin.python.pextool://tools/please_pex -e plz_e2e_test" >> $GITHUB_ENV
- name: Run tests (in nested runner)
if: ${{ inputs.platform == 'freebsd_amd64' }}
uses: cross-platform-actions/[email protected]
Expand All @@ -55,11 +54,22 @@ jobs:
shell: bash
environment_variables: PLZ_ARGS
shutdown_vm: true
run: ./pleasew test --keep_going --log_file plz-out/log/test.log ${{ inputs.test_targets }}
run: |
_external_interpreter="python${{ inputs.python }}"
_in_repo_interpreter="//third_party/cc/cpython:cpython_${{ inputs.python }}|python"
echo "*** Running tests using external Python interpreter: $_external_interpreter"
./pleasew -o "plugin.python.defaultinterpreter:$_external_interpreter" test --rerun --keep_going --log_file plz-out/log/test-external_interpreter.log ${{ inputs.test_targets }}
echo "*** Running tests using in-repo Python interpreter: $_in_repo_interpreter"
./pleasew -o "plugin.python.defaultinterpreter:$_in_repo_interpreter" test --rerun --keep_going --log_file plz-out/log/test-in_repo_interpreter.log ${{ inputs.test_targets }}
- name: Run tests (on host)
if: ${{ inputs.platform != 'freebsd_amd64' }}
run: |
./pleasew test --keep_going --log_file plz-out/log/test.log ${{ inputs.test_targets }}
_external_interpreter="${{ steps.python.outputs.python-path }}"
_in_repo_interpreter="//third_party/cc/cpython:cpython_${{ inputs.python }}|python"
echo "*** Running tests using external Python interpreter: $_external_interpreter"
./pleasew -o "plugin.python.defaultinterpreter:$_external_interpreter" test --rerun --keep_going --log_file plz-out/log/test-external_interpreter.log ${{ inputs.test_targets }}
echo "*** Running tests using in-repo Python interpreter: $_in_repo_interpreter"
./pleasew -o "plugin.python.defaultinterpreter:$_in_repo_interpreter" test --rerun --keep_going --log_file plz-out/log/test-in_repo_interpreter.log ${{ inputs.test_targets }}
- name: Archive logs
uses: actions/upload-artifact@v4
with:
Expand Down
56 changes: 46 additions & 10 deletions .plzconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
[Please]
Version = >=17.21.0
Version = >=17.25.1

[Build]
hashcheckers = sha256

[Plugin "cc"]
Target = //plugins:cc
LdGarbageCollection = true

DefaultOptCFlags = -std=c99
DefaultOptCFlags = -Os
DefaultOptCFlags = -DNDEBUG
DefaultOptCFlags = -Wall
DefaultOptCFlags = -Wextra
DefaultOptCFlags = -Werror
DefaultOptCFlags = -flto
DefaultOptCFlags = -D_LARGEFILE64_SOURCE
DefaultOptCFlags = -D_FILE_OFFSET_BITS=64

DefaultDbgCFlags = -std=c99
DefaultDbgCFlags = -g3
DefaultDbgCFlags = -DDEBUG
DefaultDbgCFlags = -Wall
DefaultDbgCFlags = -Wextra
DefaultDbgCFlags = -Werror
DefaultDbgCFlags = -D_LARGEFILE64_SOURCE
DefaultDbgCFlags = -D_FILE_OFFSET_BITS=64

[Plugin "go"]
Target = //plugins:go
Expand All @@ -21,6 +41,7 @@ Target = //plugins:shell

[Plugin "e2e"]
Target = //plugins:e2e
PleaseVersion = 17.25.1
DefaultPlugin = //test:python-rules

[PluginDefinition]
Expand All @@ -30,25 +51,34 @@ name = python
ConfigKey = DefaultInterpreter
DefaultValue = python3
Inherit = true
Help = The Python interpreter to use for any case where one is not explicitly specified
Help = The default Python interpreter to use when building .pex files.

[PluginConfig "default_shebang"]
[PluginConfig "interpreter_options"]
ConfigKey = InterpreterOptions
Optional = true
Repeatable = true
Help = A list of additional arguments to pass to the Python interpreter when building .pex files.

[PluginConfig "default_runtime_interpreters"]
ConfigKey = DefaultRuntimeInterpreters
Optional = true
Repeatable = true
Inherit = true
Help = A list of possible paths to Python interpreters with which to run .pex files.

[PluginConfig "default_runtime_interpreter_args"]
ConfigKey = DefaultRuntimeInterpreterArgs
Optional = true
Help = The shebang to set on binaries / tests where one is not explicitly specified
Repeatable = true
Inherit = true
Help = A list of additional arguments to pass to the Python interpreter when running .pex files.

[PluginConfig "pex_tool"]
ConfigKey = PexTool
DefaultValue = //tools:please_pex
Inherit = true
Help = A path or build label for the pex tool, which is used to create .pex files from python sources

[PluginConfig "interpreter_options"]
ConfigKey = InterpreterOptions
Optional = true
Repeatable = true
Help = Additional command line arguments to pass to the Python interpreter.

[PluginConfig "test_runner"]
ConfigKey = TestRunner
DefaultValue = unittest
Expand Down Expand Up @@ -146,6 +176,12 @@ DefaultValue = "info"
Help = Passes verbosity level to wheel_tool, for example: wheel_tool --verbosity info
Optional = true

[PluginConfig "default_preamble_verbosity"]
ConfigKey = DefaultPreambleVerbosity
DefaultValue = error
Inherit = true
Help = The default logging level for the .pex preamble. Must be one of trace, debug, info, warn, error or fatal.

[PluginConfig "feature_flags"]
DefaultValue = ""
Repeatable = true
Expand Down
Loading
Loading