4343 outputs :
4444 # Flag that is raised when any rust code is changed.
4545 rust_code : ${{ steps.check_rust_code.outputs.changed }}
46+ # Flag that is raised when any upstream lib code is changed.
47+ upstream_lib : ${{ steps.check_upstream_lib.outputs.changed }}
48+ # Flag that is raised when any extra test is changed.
49+ extra_test : ${{ steps.check_extra_test.outputs.changed }}
4650 steps :
4751 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4852 with :
7680 env :
7781 MERGE_BASE : ${{ steps.merge_base.outputs.sha }}
7882
83+ - name : Check if there was any upstream lib related change
84+ id : check_upstream_lib
85+ run : |
86+ if git diff --quiet "${MERGE_BASE}...HEAD" -- \
87+ ':Lib/**' \
88+ ':(exclude)Lib/test/**' \
89+ ':.github/workflows/ci.yaml' \
90+ ; then
91+ echo "changed=false" >> "$GITHUB_OUTPUT"
92+ else
93+ echo "changed=true" >> "$GITHUB_OUTPUT"
94+ fi
95+ env :
96+ MERGE_BASE : ${{ steps.merge_base.outputs.sha }}
97+
98+ - name : Check if there was any extra test related change
99+ id : check_extra_test
100+ run : |
101+ if git diff --quiet "${MERGE_BASE}...HEAD" -- \
102+ ':extra_tests/**' \
103+ ':.github/workflows/ci.yaml' \
104+ ; then
105+ echo "changed=false" >> "$GITHUB_OUTPUT"
106+ else
107+ echo "changed=true" >> "$GITHUB_OUTPUT"
108+ fi
109+ env :
110+ MERGE_BASE : ${{ steps.merge_base.outputs.sha }}
111+
79112 rust_tests :
80113 if : ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
81114 env :
@@ -123,23 +156,6 @@ jobs:
123156 run : cargo test
124157 if : runner.os != 'Windows' # Requires pyo3 0.29+ on Windows
125158
126- - name : check compilation without host_env (sandbox mode)
127- run : |
128- cargo check -p rustpython-vm --no-default-features --features compiler
129- cargo check -p rustpython-stdlib --no-default-features --features compiler
130- cargo build --no-default-features --features stdlib,importlib,stdio,encodings,freeze-stdlib
131- if : runner.os == 'Linux'
132-
133- - name : sandbox smoke test
134- run : |
135- target/debug/rustpython extra_tests/snippets/sandbox_smoke.py
136- target/debug/rustpython extra_tests/snippets/stdlib_re.py
137- if : runner.os == 'Linux'
138-
139- - name : Test openssl build
140- run : cargo build --no-default-features --features ssl-openssl
141- if : runner.os == 'Linux'
142-
143159 # - name: Install tk-dev for tkinter build
144160 # run: sudo apt-get update && sudo apt-get install -y tk-dev
145161 # if: runner.os == 'Linux'
@@ -160,6 +176,53 @@ jobs:
160176 PYTHONPATH : scripts
161177 if : runner.os == 'Linux'
162178
179+ sandbox_test :
180+ runs-on : ubuntu-latest
181+ needs :
182+ - determine_changes
183+ if : |
184+ (
185+ !contains(github.event.pull_request.labels.*.name, 'skip:ci') && (
186+ needs.determine_changes.outputs.rust_code == 'true' ||
187+ needs.determine_changes.outputs.upstream_lib == 'true' ||
188+ needs.determine_changes.outputs.extra_tests == 'true'
189+ )
190+ ) || github.ref == 'refs/heads/main'
191+ name : sandbox tests
192+ steps :
193+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
194+ with :
195+ persist-credentials : false
196+
197+ - uses : dtolnay/rust-toolchain@stable
198+
199+ - name : Restore cache
200+ uses : actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
201+ with :
202+ path : |
203+ ~/.cargo/bin/
204+ ~/.cargo/registry/index/
205+ ~/.cargo/registry/cache/
206+ ~/.cargo/git/db/
207+ target/
208+ key : ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-
209+ restore-keys : |
210+ ${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
211+ ${{ runner.os }}-stable--
212+
213+ - name : check compilation without host_env
214+ run : |
215+ cargo check -p rustpython-vm --no-default-features --features compiler
216+ cargo check -p rustpython-stdlib --no-default-features --features compiler
217+
218+ - name : cargo build
219+ run : cargo build --no-default-features --features stdlib,importlib,stdio,encodings,freeze-stdlib
220+
221+ - name : sandbox smoke test
222+ run : |
223+ target/debug/rustpython extra_tests/snippets/sandbox_smoke.py
224+ target/debug/rustpython extra_tests/snippets/stdlib_re.py
225+
163226 cargo_check :
164227 name : cargo check
165228 runs-on : ${{ matrix.os }}
0 commit comments