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
91 changes: 47 additions & 44 deletions .github/workflows/plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,51 @@
name: Python rules
on: [push, pull_request]
name: Plugin
on:
- push
- pull_request
jobs:
test-please_pex:
name: Test (Python ${{ matrix.python }}, in-repo please_pex)
uses: ./.github/workflows/plugin_test.yaml
with:
runner: ubuntu-latest
python: ${{ matrix.python }}
please_pex_from_repo: true
strategy:
fail-fast: false
matrix:
python:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
test:
name: Test (Python ${{ matrix.python-version }}, ${{ matrix.pex-tool }} pex tool)
runs-on: ubuntu-latest
name: Test (Python ${{ matrix.python }}, stable please_pex release)
uses: ./.github/workflows/plugin_test.yaml
with:
runner: ubuntu-latest
python: ${{ matrix.python }}
please_pex_from_repo: false
strategy:
fail-fast: false
matrix:
python-version:
python:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
pex-tool:
- default
- in-repo
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Use this Python in Please build environments
run: |
echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
echo "PLZ_ARGS=-o plugin.python.defaultinterpreter:$(which python3) -o build.passenv:CI_PYTHON_VERSION" >> $GITHUB_ENV
- name: Build and use in-repo pex tool
if: matrix.pex-tool == 'in-repo'
run: |
./pleasew build //tools/please_pex
cp $(./pleasew query outputs //tools/please_pex) $HOME/please_pex
echo "PLZ_ARGS="$(grep ^PLZ_ARGS= $GITHUB_ENV | cut -d= -f2-)" -o plugin.python.pextool:$HOME/please_pex" >> $GITHUB_ENV
- name: Run tests
run: ./pleasew test --log_file plz-out/log/test.log -e e2e
- name: Run e2e test
run: ./pleasew test --log_file plz-out/log/e2e.log -i e2e
- name: Archive logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.python-version }}-please_pex-${{ matrix.pex-tool }}
path: plz-out/log
release:
needs: [test]
release-tools:
name: Release tools
if: github.ref == 'refs/heads/master'
needs:
- test-please_pex
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/v1'
steps:
- name: Checkout code
- name: Check out code
uses: actions/checkout@v5
- name: Build
- name: Build tools
run: ./pleasew build //package:release_files
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: thought-machine/release-action@master
- name: Release tools
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -65,3 +55,16 @@ jobs:
version-file: tools/VERSION
change-log-file: tools/ChangeLog
release-prefix: tools
release-plugin:
name: Release plugin
if: github.ref == 'refs/heads/master'
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Release plugin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: thought-machine/release-action@master
46 changes: 46 additions & 0 deletions .github/workflows/plugin_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
workflow_call:
inputs:
runner:
description: "The GitHub runner type on which this workflow should run."
required: true
type: string
python:
description: "The Python version to configure the plugin to use. Must be a value of python-version recognised by the actions/setup-python action."
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
jobs:
test:
name: Run tests
runs-on: ${{ inputs.runner }}
steps:
- name: Install Python in CI environment
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's default Python interpreter
run: |
echo "PLZ_ARGS=-o plugin.python.defaultinterpreter:${{ steps.python.outputs.python-path }}" >> $GITHUB_ENV
- name: Build please_pex
if: inputs.please_pex_from_repo
# This copies the please_pex binary into the runner user's home directory so it persists across steps.
run: |
./pleasew build //tools/please_pex
cp $(./pleasew query outputs //tools/please_pex) $HOME/please_pex
echo "PLZ_ARGS="$(grep ^PLZ_ARGS= $GITHUB_ENV | cut -d= -f2-)" -o plugin.python.pextool:$HOME/please_pex" >> $GITHUB_ENV
- name: Run tests
run: ./pleasew test --keep_going --log_file plz-out/log/test.log
- name: Archive logs
uses: actions/upload-artifact@v4
with:
name: logs-python_${{ inputs.python }}-please_pex_${{ inputs.please_pex_from_repo && 'repo' || 'stable' }}
path: plz-out/log
6 changes: 0 additions & 6 deletions test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,6 @@ python_test(
],
)

# This test need only run in the GitHub Actions workflow - it is skipped outside this environment.
python_test(
name = "ci_test",
srcs = ["ci_test.py"],
)

python_test(
name = "interpreter_not_included_test",
srcs = ["interpreter_not_included_test.py"],
Expand Down
17 changes: 0 additions & 17 deletions test/ci_test.py
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is obsolete now that we're no longer relying on actions/setup-python to put python3 in our PATH - plugin.python.defaultinterpreter is now being set to the absolute path to the interpreter installed by the action, so we know for sure which interpreter we're using.

This file was deleted.