Skip to content

Commit 98c1f8f

Browse files
Release please_pex and wheel_resolver independently of each other
For all intents and purposes, please_pex and wheel_resolver are independent tools - they're written in different languages, and share no common dependencies. Version them independently, and restructure the CI workflow so they are built, tested and released independently of each other.
1 parent 4113d8a commit 98c1f8f

File tree

12 files changed

+171
-47
lines changed

12 files changed

+171
-47
lines changed

.github/workflows/plugin.yaml

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ on:
33
- push
44
- pull_request
55
jobs:
6+
test-wheel_resolver:
7+
name: Test wheel_resolver (Python ${{ matrix.python }})
8+
uses: ./.github/workflows/plugin_test.yaml
9+
with:
10+
id: wheel_resolver
11+
runner: ubuntu-latest
12+
python: ${{ matrix.python }}
13+
please_pex_from_repo: false
14+
test_targets: //tools/wheel_resolver/...
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python:
19+
- '3.9'
20+
- '3.10'
21+
- '3.11'
22+
- '3.12'
23+
- '3.13'
24+
- '3.14'
625
test-please_pex:
726
name: Test (Python ${{ matrix.python }}, in-repo please_pex)
827
uses: ./.github/workflows/plugin_test.yaml
@@ -37,26 +56,46 @@ jobs:
3756
- '3.12'
3857
- '3.13'
3958
- '3.14'
40-
release-tools:
41-
name: Release tools
59+
release-please_pex:
60+
name: Release please_pex
4261
if: github.ref == 'refs/heads/master'
4362
needs:
4463
- test-please_pex
4564
runs-on: ubuntu-latest
4665
steps:
4766
- name: Check out code
4867
uses: actions/checkout@v5
49-
- name: Build tools
50-
run: ./pleasew build //package:release_files
51-
- name: Release tools
68+
- name: Build release files
69+
run: ./pleasew build //package:please_pex_release_files
70+
- name: Create release
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
uses: thought-machine/release-action@master
74+
with:
75+
release-files: plz-out/package/please_pex
76+
version-file: tools/please_pex/VERSION
77+
change-log-file: tools/please_pex/ChangeLog
78+
release-prefix: please_pex
79+
release-wheel_resolver:
80+
name: Release wheel_resolver
81+
if: github.ref == 'refs/heads/master'
82+
needs:
83+
- test-wheel_resolver
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Check out code
87+
uses: actions/checkout@v5
88+
- name: Build release files
89+
run: ./pleasew build //package:wheel_resolver_release_files
90+
- name: Create release
5291
env:
5392
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5493
uses: thought-machine/release-action@master
5594
with:
56-
release-files: plz-out/package
57-
version-file: tools/VERSION
58-
change-log-file: tools/ChangeLog
59-
release-prefix: tools
95+
release-files: plz-out/package/wheel_resolver
96+
version-file: tools/wheel_resolver/VERSION
97+
change-log-file: tools/wheel_resolver/ChangeLog
98+
release-prefix: wheel_resolver
6099
release-plugin:
61100
name: Release plugin
62101
if: github.ref == 'refs/heads/master'

.github/workflows/plugin_test.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
on:
22
workflow_call:
33
inputs:
4+
id:
5+
description: "A identifier for this test run. Will be included in the Please log archive file name."
6+
type: string
7+
default: test
48
runner:
59
description: "The GitHub runner type on which this workflow should run."
610
required: true
@@ -14,6 +18,10 @@ on:
1418
required: false
1519
type: boolean
1620
default: false
21+
test_targets:
22+
description: "A space-delimited list of targets to pass to `plz test`."
23+
type: string
24+
default: //...
1725
jobs:
1826
test:
1927
name: Run tests
@@ -38,9 +46,9 @@ jobs:
3846
cp $(./pleasew query outputs //tools/please_pex) $HOME/please_pex
3947
echo "PLZ_ARGS="$(grep ^PLZ_ARGS= $GITHUB_ENV | cut -d= -f2-)" -o plugin.python.pextool:$HOME/please_pex" >> $GITHUB_ENV
4048
- name: Run tests
41-
run: ./pleasew test --keep_going --log_file plz-out/log/test.log
49+
run: ./pleasew test --keep_going --log_file plz-out/log/test.log ${{ inputs.test_targets }}
4250
- name: Archive logs
4351
uses: actions/upload-artifact@v4
4452
with:
45-
name: logs-python_${{ inputs.python }}-please_pex_${{ inputs.please_pex_from_repo && 'repo' || 'stable' }}
53+
name: logs-${{ inputs.id }}-python_${{ inputs.python }}-please_pex_${{ inputs.please_pex_from_repo && 'repo' || 'stable' }}
4654
path: plz-out/log

build_defs/version.build_defs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
def version(name:str, version_file:str="VERSION", visibility:list=["PUBLIC"]):
1+
def version(name:str, version_const:str="VERSION", version_file:str="VERSION", visibility:list=["PUBLIC"]):
2+
assert version_const == version_const.upper(), "version_const must be a constant identifier"
23
return genrule(
3-
name = name,
4-
srcs = [version_file],
5-
outs = [f"{name}.build_defs"],
6-
cmd = "echo VERSION = \\\"$(cat $SRCS)\\\" > $OUT",
7-
visibility = visibility,
8-
)
9-
4+
name = name,
5+
srcs = [version_file],
6+
outs = [f"{name}.build_defs"],
7+
cmd = f'''echo "{version_const} = '$(cat $SRCS)'" > $OUTS''',
8+
visibility = visibility,
9+
)

package/BUILD

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
subinclude("//tools:version", "//build_defs:archs", "///go//build_defs:go")
1+
subinclude("//build_defs:archs")
22

3-
release_files = {
3+
_tools = {
44
"please_pex": "//tools/please_pex",
55
"wheel_resolver": "//tools/wheel_resolver",
66
}
77

8-
def release_file(name:str, file_target:str, arch:str):
8+
def release_file(name:str, version:str, file_target:str, arch:str):
99
return genrule(
1010
name = f"{name}_{arch}",
1111
srcs = [f"///{arch}" + canonicalise(file_target)],
12-
outs = [f"{name}-{VERSION}-{arch}"],
12+
outs = [f"{name}-{version}-{arch}"],
1313
cmd = "mv $SRC $OUT",
1414
)
1515

16-
filegroup(
17-
name = "release_files",
18-
srcs = [
19-
release_file(name, target, arch)
20-
for name, target in release_files.items()
21-
for arch in SUPPORTED_ARCHS
22-
],
23-
labels = ["hlink:plz-out/package"],
24-
)
25-
16+
for tool, package in _tools.items():
17+
subinclude(f"{package}:version")
18+
filegroup(
19+
name = f"{tool}_release_files",
20+
srcs = [
21+
release_file(tool, VERSION, package, arch)
22+
for arch in SUPPORTED_ARCHS
23+
],
24+
labels = [f"hlink:plz-out/package/{tool}"],
25+
)

tools/BUILD

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
subinclude("//build_defs:version")
2-
3-
version(name = "version")
4-
5-
TOOLS_VERSION = "1.7.0"
1+
_PLEASE_PEX_VERSION = "1.7.0"
62

73
remote_file(
84
name = "please_pex",
9-
url = f"https://github.com/please-build/python-rules/releases/download/tools-v{TOOLS_VERSION}/please_pex-{TOOLS_VERSION}-{CONFIG.OS}_{CONFIG.ARCH}",
5+
url = f"https://github.com/please-build/python-rules/releases/download/tools-v{_PLEASE_PEX_VERSION}/please_pex-{_PLEASE_PEX_VERSION}-{CONFIG.OS}_{CONFIG.ARCH}",
106
hashes = [
117
"d8f518764c06e690ea1a4fb90fd532b00c15247cd7d8fb58562748df5b1a0db7", # darwin_amd64
128
"3a4ff1599c757d2dff4ed9a11e2efa429bb7e644fe8f6ee7191ae1dec903e57b", # darwin_arm64

tools/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

tools/please_pex/BUILD

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
subinclude("//build_defs:python", "///go//build_defs:go")
1+
subinclude(
2+
"///go//build_defs:go",
3+
"//build_defs:python",
4+
"//build_defs:version",
5+
)
6+
7+
version(name = "version")
28

39
go_binary(
410
name = "pex_main",
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Version 2.0.0
2+
-------------
3+
* Release please_pex and wheel_resolver tools independently of each other
4+
15
Version 1.7.0
26
-------------
37
* Upgrade coverage package in please_pex's bootstrap .pex to v7.10.7 (#243)
@@ -46,7 +50,6 @@ Version 1.4.2
4650
* Upgrade `coverage` package to 7.6.4 in please_pex's bootstrap pex (#197)
4751
This drops native-speed tracing support for Python 3.8 and adds it for Python 3.13.
4852
* Remove unnecessary six dependency in the unittest test runner dependency bundle (#199)
49-
* Remove redundant requests dependency from wheel resolver (#200)
5053
* Prevent Python >= 3.12 from emitting a `DeprecationWarning` when using `importlib.metadata`
5154
on modules in pex files (#203)
5255

@@ -68,11 +71,11 @@ Version 1.3.5
6871

6972
Version 1.3.4
7073
-------------
71-
* Refactor wheel_resolver to allow for non-PyPI downloads (#167)
74+
* No changes were made to please_pex in this release
7275

7376
Version 1.3.3
7477
-------------
75-
* Include wheel_resolver in tools release (#164)
78+
* No changes were made to please_pex in this release
7679

7780
Version 1.3.2
7881
-------------
@@ -84,8 +87,7 @@ Version 1.3.1
8487

8588
Version 1.3.0
8689
-------------
87-
* Added wheel_resolver tool; see [README](./wheel_resolver/README.md)
88-
(#149)
90+
* No changes were made to please_pex in this release
8991

9092
Version 1.2.2
9193
-------------

tools/please_pex/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.0.0

tools/wheel_resolver/BUILD

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
subinclude("//build_defs:python")
1+
subinclude(
2+
"//build_defs:python",
3+
"//build_defs:version",
4+
)
5+
6+
version(name = "version")
27

38
python_binary(
49
name="wheel_resolver",

0 commit comments

Comments
 (0)