Skip to content

Commit

Permalink
Add pants_from_sources support. (#77)
Browse files Browse the repository at this point in the history
Closes #30
  • Loading branch information
jsirois authored Jan 27, 2023
1 parent 32ff2e8 commit 4ad5c97
Show file tree
Hide file tree
Showing 9 changed files with 334 additions and 32 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04, macos-11, macOS-11-ARM64, windows-2022]
env:
PY: python3.9
SCIE_PANTS_DEV_CACHE: .scie_pants_dev_cache
steps:
- uses: actions/checkout@v3
- name: Check Formatting
Expand All @@ -38,6 +41,18 @@ jobs:
run: cargo clippy --all
- name: Unit Tests
run: cargo test --all
- name: Setup Python 3.9
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-11' }}
uses: actions/setup-python@v4
with:
# N.B.: We need Python 3.9 for running Pants goals against our tools.pex Python tools
# codebase as well as running Pants from sources in ITs.
python-version: "3.9"
- name: Cache Build and IT Artifacts
uses: actions/cache@v3
with:
path: ${{ env.SCIE_PANTS_DEV_CACHE }}
key: ${{ runner.os }}-${{ runner.arch }}-scie-pants-v0
- name: Build, Package & Integration Tests
if: ${{ matrix.os == 'macOS-11-ARM64' }}
run: |
Expand All @@ -58,13 +73,6 @@ jobs:
run: |
PANTS_BOOTSTRAP_GITHUB_API_BEARER_TOKEN=${{ secrets.GITHUB_TOKEN }} \
cargo run -p package -- test
- name: Setup Python 3.9
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: actions/setup-python@v4
with:
# N.B.: We need Python 3.9 for running Pants goals against our tools.pex Python tools
# codebase.
python-version: "3.9"
- name: Build, Package & Integration Tests
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
Expand All @@ -85,4 +93,3 @@ jobs:
cargo run -p package -- test \
--tools-pex dist/tools.pex --scie-pants dist/scie-pants-linux-x86_64 \
--tools-pex-mismatch-warn
Empty file added BUILD_ROOT
Empty file.
18 changes: 18 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Release Notes

## 0.3.0

This release adds support for running Pants from a local Pants clone. This is useful for testing out
unreleased Pants changes.

This feature used to be provided by a bespoke `pants_from_sources` script copied around to various
repositories; an example of which is [here](
https://github.com/pantsbuild/example-python/blob/1b38d08821865e3756024950bc000bdbd0161b95/pants_from_sources).

There are two ways to activate this mode:
1. Execute `pants` with the `PANTS_SOURCE` environment variable set as the path to the Pants repo
whose Pants code you'd like to run against your repo.
2. Copy, hardlink or symlink your `pants` binary to `pants_from_sources` and execute that.

The first activation method is new. The second mode follows the bespoke `./pants_from_sources`
conventions and assumes `PANTS_SOURCE=../pants`. You can override that by setting the`PANTS_SOURCE`
env var as in the first activation method.

## 0.2.2

This release fixes the scie-pants scie to not expose the interpreter used to run a Pants
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [
[package]
name = "scie-pants"
description = "Protects your Pants from the elements."
version = "0.2.2"
version = "0.3.0"
edition = "2021"
authors = [
"John Sirois <john.sirois@gmail.com>",
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ provides the following:
If you run `scie-pants` in a directory where Pants is not already set up, it will prompt you, and
you can let it set up the latest Pants stable version for your project.

+ Built-in [`pants_from_sources`](
https://github.com/pantsbuild/example-python/blob/1b38d08821865e3756024950bc000bdbd0161b95/pants_from_sources)
support. You can either execute `scie-pants` with `PANTS_SOURCE` set to the path of a local clone
of the [Pants](https://github.com/pantsbuild/pants) repo or else copy, link or symlink your
`scie-pants` executable to `pants_from_sources` and execute that. In this case `PANTS_SOURCE` will
default to `../pants` just as was the case in the bespoke `./pants_from_sources` scripts.

+ Partial support for firewalls:

Currently, you can only re-direct the URLs scie-pants uses to fetch [Python Build Standalone](
Expand Down
Loading

0 comments on commit 4ad5c97

Please sign in to comment.