Skip to content

Commit bb3dbfb

Browse files
authored
Merge branch 'main' into pre-commit-ci-update-config
2 parents 346f6f1 + 285fd7b commit bb3dbfb

File tree

6 files changed

+77
-14
lines changed

6 files changed

+77
-14
lines changed

.github/workflows/check-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
if: startsWith(github.event_name, 'pull_request')
118118
run: echo "KEEP_DAYS=7" >> $GITHUB_ENV
119119
- name: Upload built docs
120-
uses: actions/upload-artifact@v4
120+
uses: actions/upload-artifact@v5
121121
with:
122122
name: docs-${{ matrix.target }}-${{ github.sha }}
123123
path: ${{ inputs.docs-dir }}/build/

.github/workflows/check-md-links.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ jobs:
2727
CONFIG_FILE: ${{ inputs.config-file }}
2828
MODIFIED_ONLY: "no"
2929
steps:
30-
- uses: actions/checkout@master
30+
- name: Checkout
31+
uses: actions/checkout@v5
3132

3233
- name: Create local version of config
3334
if: ${{ inputs.config-file == '' }}
@@ -53,14 +54,16 @@ jobs:
5354
}' > 'markdown.links.config.json'
5455
echo "CONFIG_FILE=markdown.links.config.json" >> $GITHUB_ENV
5556
cat 'markdown.links.config.json'
57+
5658
- name: Show config
5759
run: cat ${{ env.CONFIG_FILE }}
5860

5961
- name: narrow scope for PR
6062
if: startsWith(github.event_name, 'pull_request') && inputs.force-check-all == ''
6163
run: echo "MODIFIED_ONLY=yes" >> $GITHUB_ENV
64+
6265
- name: Checking markdown link
63-
uses: gaurav-nelson/github-action-markdown-link-check@v1
66+
uses: tcort/github-action-markdown-link-check@v1
6467
with:
6568
base-branch: ${{ inputs.base-branch }}
6669
use-quiet-mode: "yes"

.github/workflows/check-package.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ on:
4646
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
4747
default: |
4848
{
49-
"os": ["ubuntu-22.04", "macos-13", "windows-2022"],
49+
"os": ["ubuntu-22.04", "macos-latest", "windows-2022"],
5050
"python-version": ["3.9", "3.13"]
5151
}
5252
env-vars:
@@ -99,7 +99,7 @@ jobs:
9999
uses: ./.cicd/.github/actions/pkg-create
100100
- name: Upload 📤 packages
101101
if: ${{ inputs.artifact-name != '' }}
102-
uses: actions/upload-artifact@v4
102+
uses: actions/upload-artifact@v5
103103
with:
104104
name: ${{ inputs.artifact-name }}-build-${{ strategy.job-index }}
105105
path: dist
@@ -120,7 +120,7 @@ jobs:
120120
pip list
121121
122122
- name: Download 📥
123-
uses: actions/download-artifact@v5
123+
uses: actions/download-artifact@v6
124124
with:
125125
# download all build artifacts
126126
pattern: ${{ inputs.artifact-name }}-build-*
@@ -131,7 +131,7 @@ jobs:
131131
ls -lh dist/
132132
twine check dist/*
133133
- name: Upload 📤
134-
uses: actions/upload-artifact@v4
134+
uses: actions/upload-artifact@v5
135135
with:
136136
name: ${{ inputs.artifact-name }}
137137
path: dist
@@ -161,7 +161,7 @@ jobs:
161161
repository: Lightning-AI/utilities
162162
- name: Download 📥 all packages
163163
if: ${{ inputs.artifact-name != '' }}
164-
uses: actions/download-artifact@v5
164+
uses: actions/download-artifact@v6
165165
with:
166166
name: ${{ inputs.artifact-name }}
167167
path: pypi

.github/workflows/ci-testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: ["ubuntu-22.04", "macos-13", "windows-2022"]
19+
os: ["ubuntu-22.04", "macos-latest", "windows-2022"]
2020
python-version: ["3.9", "3.11", "3.13"]
2121
requires: ["oldest", "latest"]
2222
exclude:

.github/workflows/release-pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Create 📦 package
3232
uses: ./.github/actions/pkg-create
3333
- name: Upload 📤 packages
34-
uses: actions/upload-artifact@v4
34+
uses: actions/upload-artifact@v5
3535
with:
3636
name: pypi-packages-${{ github.sha }}
3737
path: dist
@@ -45,7 +45,7 @@ jobs:
4545
- name: Checkout 🛎️
4646
uses: actions/checkout@v5
4747
- name: Download 📥 artifact
48-
uses: actions/download-artifact@v5
48+
uses: actions/download-artifact@v6
4949
with:
5050
name: pypi-packages-${{ github.sha }}
5151
path: dist
@@ -69,7 +69,7 @@ jobs:
6969
with:
7070
submodules: recursive
7171
- name: Download 📥 artifact
72-
uses: actions/download-artifact@v5
72+
uses: actions/download-artifact@v6
7373
with:
7474
name: pypi-packages-${{ github.sha }}
7575
path: dist

scripts/run_standalone_tests.sh

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ test_dir=$1 # parse the first argument
2929
# It can be set through the env variable TEST_TIMEOUT and defaults to 1200 seconds.
3030
test_timeout="${TEST_TIMEOUT:-1200}"
3131

32+
# Base port to start assigning from (default: 12000)
33+
last_used_port="${BASE_PORT:-12000}"
34+
35+
# Port spacing between attempts (default: 20)
36+
port_margin="${PORT_MARGIN:-20}"
37+
38+
3239
# Temporary file to store the collected tests
3340
COLLECTED_TESTS_FILE="collected_tests.txt"
3441

@@ -96,6 +103,43 @@ report=() # final report
96103
pids=() # array of PID for running tests
97104
test_ids=() # array of indexes of running tests
98105
failed_tests=() # array of failed tests
106+
used_ports=() # array of used ports
107+
108+
# --- helper functions ---
109+
110+
get_available_port() {
111+
preferred_port="$1"
112+
113+
# Check the preferred port first
114+
if nc -z localhost "$preferred_port" 2>/dev/null; then
115+
# Preferred port is busy, grab an ephemeral one
116+
port=$(python3 -c "import socket as s; sock=s.socket(); sock.bind(('',0)); print(sock.getsockname()[1]); sock.close()")
117+
echo "$port"
118+
else
119+
# Preferred port is free
120+
echo "$preferred_port"
121+
fi
122+
}
123+
124+
contains() {
125+
local element="$1"
126+
shift
127+
local array=("$@")
128+
129+
for item in "${array[@]}"; do
130+
if [[ "$item" == "$element" ]]; then
131+
echo "true"
132+
return 0
133+
fi
134+
done
135+
136+
echo "false"
137+
return 1
138+
}
139+
140+
141+
# --- Start running tests in parallel batches ---
142+
99143
printf "Running $test_count tests in batches of $test_batch_size:\n"
100144
for i in "${!tests[@]}"; do
101145
test=${tests[$i]}
@@ -108,12 +152,28 @@ for i in "${!tests[@]}"; do
108152
# add the pytest cli to the test command
109153
cli_test="${cli_test} ${cli_pytest}"
110154

111-
printf "\e[95m* Running test $((i+1))/$test_count: $cli_test $test\e[0m\n"
155+
# get the next available unique port based on last_used_port and port_margin
156+
((last_used_port+=port_margin))
157+
available_port=$(get_available_port $last_used_port)
158+
159+
# ensure the port is unique among used ports
160+
while [[ $(contains $available_port "${used_ports[@]}") == "true" ]]; do
161+
# get the next available unique port
162+
((last_used_port+=port_margin))
163+
available_port=$(get_available_port $last_used_port)
164+
done
165+
166+
# mark the port as used
167+
used_ports+=($available_port)
168+
169+
test_command="env STANDALONE_PORT=${available_port} ${cli_test} $test"
170+
171+
printf "\e[95m* Running test $((i+1))/$test_count: $test_command\e[0m\n"
112172

113173
# execute the test in the background
114174
# redirect to a log file that buffers test output. since the tests will run in the background,
115175
# we cannot let them output to std{out,err} because the outputs would be garbled together
116-
${cli_test} "$test" &> "parallel_test_output-$i.txt" &
176+
$test_command &> "parallel_test_output-$i.txt" &
117177
test_ids+=($i) # save the test's id in an array with running tests
118178
pids+=($!) # save the PID in an array with running tests
119179

0 commit comments

Comments
 (0)