-
Notifications
You must be signed in to change notification settings - Fork 17
77 lines (77 loc) · 4.52 KB
/
plugin_test.yaml
File metadata and controls
77 lines (77 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
on:
workflow_call:
inputs:
id:
description: "A identifier for this test run. Will be included in the Please log archive file name."
type: string
default: test
platform:
description: "The platform on which this workflow should run. Must be one of darwin_amd64, darwin_arm64, freebsd_amd64, linux_amd64 or linux_arm64."
required: true
type: string
python:
description: "The major Python version to configure the plugin to use."
required: true
type: string
please_pex_from_repo:
description: "Whether to build please_pex from source and use that as the plugin's please_pex tool (true), or use the existing binary version of please_pex downloaded by //tools:please_pex (false)."
required: false
type: boolean
default: false
test_targets:
description: "A space-delimited list of targets to pass to `plz test`."
type: string
default: //...
jobs:
test:
name: ${{ inputs.platform }}, Python ${{ inputs.python }}
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:
- 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
with:
python-version: ${{ inputs.python }}
update-environment: false
- name: Check out code
uses: actions/checkout@v5
- name: Configure plugin to use please_pex tool built from source
if: inputs.please_pex_from_repo
# 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/action@v0.30.0
with:
operating_system: freebsd
architecture: x86-64
version: '14.3'
image_url: https://github.com/please-build/freebsd-builder/releases/download/v0.12.0-please.3/freebsd-14.3-x86-64.qcow2
shell: bash
environment_variables: PLZ_ARGS
shutdown_vm: true
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: |
_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:
name: logs-${{ inputs.id }}-${{ inputs.platform }}-python_${{ inputs.python }}-please_pex_${{ inputs.please_pex_from_repo && 'repo' || 'stable' }}
path: plz-out/log