Skip to content

Commit 046633f

Browse files
authored
build: use pixi to manage build environment (#1021)
Migrates the build logic from using a fragmented approach requiring many manual setup steps to a centralized approach which uses [pixi](https://pixi.prefix.dev) to manage the full build environment.
1 parent 7cceb83 commit 046633f

21 files changed

Lines changed: 4539 additions & 146 deletions

.editorconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,41 @@ insert_final_newline = true
77
indent_style = space
88
trim_trailing_whitespace = true
99

10+
# Markdown files - preserve formatting
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
1014
[site/**]
1115
charset = unset
1216
end_of_line = unset
1317
insert_final_newline = unset
1418
indent_style = unset
1519
trim_trailing_whitespace = unset
1620

21+
# ANTLR-generated parser files (auto-generated, do not format)
22+
[tests/type/antlr_parser/**]
23+
charset = unset
24+
end_of_line = unset
25+
insert_final_newline = unset
26+
indent_style = unset
27+
trim_trailing_whitespace = unset
28+
29+
[tests/coverage/antlr_parser/**]
30+
charset = unset
31+
end_of_line = unset
32+
insert_final_newline = unset
33+
indent_style = unset
34+
trim_trailing_whitespace = unset
35+
36+
# Makefiles require tabs for indentation
37+
[Makefile]
38+
indent_style = tab
39+
indent_size = 4
40+
41+
# Go files use tabs for indentation (gofmt standard)
42+
[*.go]
43+
indent_style = tab
44+
indent_size = 4
45+
1746
[*.{proto,yaml,yml}]
1847
indent_size = 2

.flake8

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ exclude =
88
# exclude generated type parser
99
tests/type/antlr_parser/*.py,
1010
# exclude generated files
11-
gen/
11+
gen/,
12+
# exclude .pixi
13+
.pixi,
14+
# exclude .venv
15+
.venv

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
proto/buf.lock linguist-generated=true
22
tests/coverage/antlr_parser/** linguist-generated=true
33
tests/type/antlr_parser/** linguist-generated=true
4+
5+
# SCM syntax highlighting & preventing 3-way merges
6+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true -diff

.github/workflows/pr.yml

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,106 +8,117 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v6
11-
- uses: actions/setup-python@v6
11+
- uses: prefix-dev/setup-pixi@v0.9.4
1212
with:
13-
python-version: '3.13'
14-
cache: 'pip'
15-
cache-dependency-path: ./site/requirements.txt
16-
- run: pip install -r ./site/requirements.txt
13+
pixi-version: v0.66.0
14+
cache: true
1715
- name: Generate Static Site
18-
run: mkdocs build
19-
working-directory: ./site
16+
run: pixi run mkdocs build
2017
editorconfig-checker:
2118
name: Check editorconfig
2219
runs-on: ubuntu-latest
2320
steps:
24-
- uses: editorconfig-checker/action-editorconfig-checker@v2
21+
- uses: actions/checkout@v6
22+
- uses: prefix-dev/setup-pixi@v0.9.4
23+
with:
24+
pixi-version: v0.66.0
25+
cache: true
26+
- name: Run editorconfig-checker
27+
run: pixi run editorconfig-checker
2528
proto-format-check:
2629
name: Check Protobuf Style
2730
runs-on: ubuntu-latest
2831
steps:
2932
- uses: actions/checkout@v6
30-
- uses: bufbuild/buf-setup-action@v1.50.0
33+
- uses: prefix-dev/setup-pixi@v0.9.4
3134
with:
32-
github_token: ${{ github.token }}
33-
- run: buf format --diff --exit-code
35+
pixi-version: v0.66.0
36+
cache: true
37+
- name: Lint Protobuf
38+
run: pixi run lint-protobuf
39+
- name: Check Protobuf Style
40+
run: pixi run check-protobuf
3441
proto:
3542
name: Check Protobuf
3643
runs-on: ubuntu-latest
3744
steps:
3845
- uses: actions/checkout@v6
39-
- uses: bufbuild/buf-setup-action@v1.50.0
46+
- uses: prefix-dev/setup-pixi@v0.9.4
4047
with:
41-
github_token: ${{ github.token }}
42-
- uses: bufbuild/buf-lint-action@v1
48+
pixi-version: v0.66.0
49+
cache: true
4350
- name: Compile protobuf
44-
run: buf generate
51+
run: pixi run generate-protobuf
4552
yamllint:
4653
name: Lint YAML extensions
4754
runs-on: ubuntu-latest
4855
steps:
4956
- uses: actions/checkout@v6
57+
- uses: prefix-dev/setup-pixi@v0.9.4
58+
with:
59+
pixi-version: v0.66.0
60+
cache: true
5061
- name: Run yamllint
51-
run: yamllint .
62+
run: pixi run yamllint
5263
yamlvalidate:
5364
name: Validate YAML extensions
5465
runs-on: ubuntu-latest
5566
steps:
5667
- uses: actions/checkout@v6
57-
- uses: actions/setup-python@v6
68+
- uses: prefix-dev/setup-pixi@v0.9.4
5869
with:
59-
python-version: '3.13'
60-
- run: pip install check-jsonschema
61-
- run: check-jsonschema --schemafile text/simple_extensions_schema.yaml extensions/*.yaml
62-
- run: check-jsonschema --schemafile text/simple_extensions_schema.yaml site/examples/**/*.yaml
63-
- run: check-jsonschema --schemafile text/dialect_schema.yaml dialects/tests/*.yaml
70+
pixi-version: v0.66.0
71+
cache: true
72+
- name: Validate YAML extensions
73+
run: |
74+
pixi run check-jsonschema --schemafile text/simple_extensions_schema.yaml extensions/*.yaml
75+
pixi run check-jsonschema --schemafile text/simple_extensions_schema.yaml site/examples/**/*.yaml
76+
pixi run check-jsonschema --schemafile text/dialect_schema.yaml dialects/tests/*.yaml
6477
dry_run_release:
6578
name: Dry-run release
6679
runs-on: ubuntu-latest
6780
steps:
6881
- uses: actions/checkout@v6
6982
with:
7083
fetch-depth: 0
71-
- uses: bufbuild/buf-setup-action@v1.50.0
72-
with:
73-
github_token: ${{ github.token }}
74-
- uses: actions/setup-node@v6
84+
- uses: prefix-dev/setup-pixi@v0.9.4
7585
with:
76-
node-version: "20"
77-
- run: ./ci/release/dry_run.sh
86+
pixi-version: v0.66.0
87+
cache: true
88+
- name: Dry-run release
89+
run: pixi run dry-run
7890
python-style:
7991
name: Style-check and lint Python files, and run tests
8092
runs-on: ubuntu-latest
8193
steps:
8294
- uses: actions/checkout@v6
83-
- uses: bufbuild/buf-setup-action@v1.50.0
95+
- uses: prefix-dev/setup-pixi@v0.9.4
8496
with:
85-
github_token: ${{ github.token }}
86-
- name: Install dependencies
87-
run: python3 -m pip install -r requirements.txt
97+
pixi-version: v0.66.0
98+
cache: true
8899
- name: Generate protobuf bindings
89-
run: buf generate
100+
run: pixi run generate-protobuf
90101
- name: Black
91-
run: python3 -m black --diff --check .
102+
run: pixi run black
92103
- name: Flake8
93-
run: python3 -m flake8 .
104+
run: pixi run flake8
94105
- name: Run tests including test_substrait_extension_coverage
95-
run: |
96-
pytest
106+
run: pixi run test
97107
check-proto-prefix:
98108
name: Check proto-prefix.py
99109
runs-on: ubuntu-latest
100110
steps:
101111
- uses: actions/checkout@v6
102-
- uses: bufbuild/buf-setup-action@v1.50.0
112+
- uses: prefix-dev/setup-pixi@v0.9.4
103113
with:
104-
github_token: ${{ github.token }}
114+
pixi-version: v0.66.0
115+
cache: true
105116
- name: Run proto-prefix.py
106-
run: tools/proto_prefix.py output test proto go_package=github.com/test/proto
117+
run: pixi run tools/proto_prefix.py output test proto go_package=github.com/test/proto
107118
- name: Modify buf config to build rewritten proto files
108119
run: |
109120
echo "version: v1" > buf.work.yaml
110121
echo "directories:" >> buf.work.yaml
111122
echo " - output" >> buf.work.yaml
112123
- name: Compile rewritten proto files
113-
run: buf generate
124+
run: pixi run generate-protobuf

.github/workflows/pr_breaking.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v6
12-
- uses: bufbuild/buf-setup-action@v1.50.0
12+
- uses: prefix-dev/setup-pixi@v0.9.4
1313
with:
14-
github_token: ${{ github.token }}
14+
pixi-version: v0.66.0
15+
cache: true
1516
- name: check for breaking changes
1617
id: check-breaking
1718
run: |
1819
19-
if ! buf breaking --against 'https://github.com/substrait-io/substrait.git#branch=main'; then
20+
if ! pixi run buf breaking --against 'https://github.com/substrait-io/substrait.git#branch=main'; then
2021
breaking="true"
2122
else
2223
breaking="false"

.github/workflows/pr_title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
script: |
3535
const message = `**ACTION NEEDED**
36-
36+
3737
Substrait follows the [Conventional Commits
3838
specification](https://www.conventionalcommits.org/en/v1.0.0/) for
3939
release automation.

.github/workflows/release.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,13 @@ jobs:
2929
fetch-depth: 0
3030
token: ${{ steps.generate-token.outputs.token }}
3131

32-
- uses: actions/setup-node@v6
32+
- uses: prefix-dev/setup-pixi@v0.9.4
3333
with:
34-
node-version: "20"
35-
36-
- uses: bufbuild/buf-setup-action@v1.50.0
37-
with:
38-
github_token: ${{ github.token }}
34+
pixi-version: v0.66.0
35+
cache: true
3936

4037
- name: run semantic-release
41-
run: ./ci/release/run.sh
38+
run: pixi run release
4239
env:
4340
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
4441
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

.github/workflows/site.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ jobs:
1515
if: ${{ github.repository == 'substrait-io/substrait' }}
1616
steps:
1717
- uses: actions/checkout@v6
18-
- uses: actions/setup-python@v6
18+
- uses: prefix-dev/setup-pixi@v0.9.4
1919
with:
20-
python-version: '3.13'
21-
cache: 'pip'
22-
cache-dependency-path: ./site/requirements.txt
23-
- run: pip install -r ./site/requirements.txt
20+
pixi-version: v0.66.0
21+
cache: true
2422
- name: Copy schema file for website
2523
run: |
2624
mkdir -p ./site/docs/schemas
2725
cp ./text/simple_extensions_schema.yaml ./site/docs/schemas/simple_extensions
2826
- name: Generate Static Site
29-
run: mkdocs build
30-
working-directory: ./site
27+
run: pixi run mkdocs build
3128
- name: Deploy Static Site to GitHub
3229
uses: peaceiris/actions-gh-pages@v4
3330
with:

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@
44
**/build
55
gen
66
__pycache__
7+
8+
# pixi environments
9+
.pixi/*
10+
!.pixi/config.toml
11+
12+
# uv virtual environment
13+
.venv

.licenserc.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ header:
22
license:
33
spdx-id: Apache-2.0
44

5-
paths:
6-
- 'proto/substrait/**'
5+
paths:
6+
- 'proto/substrait/**'
77

8-
comment: never
8+
comment: never

0 commit comments

Comments
 (0)