fix #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: | |
push: | |
branches: [ '*' ] | |
tags: [ '*' ] | |
pull_request: | |
branches: [ '*' ] | |
env: | |
PYTHON_VERSION: "3.12" | |
TOKENIZERS_PARALLELISM: "false" | |
PYTHONPATH: "." | |
jobs: | |
check_local_runner: | |
strategy: | |
matrix: | |
cpu: ['M3', 'M4'] | |
include: | |
- benchmark_timeout: 500 | |
runs-on: ['self-hosted', 'macOS', '${{ matrix.cpu }}'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
echo "python${PYTHON_VERSION} -m venv env" | bash | |
source env/bin/activate | |
pip install --upgrade pip | |
pip install . | |
- name: Run exo | |
run: | | |
ALL_NODE_IDS=$(for i in $(seq 0 ${{ strategy.job-total }} -1); do echo -n "${GITHUB_JOB}_${i},"; done | sed 's/,$//') | |
MY_NODE_ID="${GITHUB_JOB}_${{ strategy.job-index }}" | |
DEBUG_DISCOVERY=7 DEBUG=7 exo --node-id="${MY_NODE_ID}" --filter-node-ids="${ALL_NODE_IDS}" --chatgpt-api-port 52415 --disable-tui > output1.log 2>&1 & | |
PID1=$! | |
tail -f output1.log & | |
TAIL1=$! | |
trap 'kill $TAIL1' EXIT | |
for i in {1..100}; do | |
nodes=$(curl http://localhost:52415/topology | jq .nodes | length) | |
if [ "$nodes" -eq "${{ strategy.job-total }}" ]; then | |
break | |
fi | |
sleep 5 | |
done | |
if ! kill -0 $PID1 2>/dev/null; then | |
echo "Instance (PID $PID1) died unexpectedly. Log output:" | |
cat output1.log | |
exit 1 | |
fi | |
if [ "${{ strategy.job-index }}" -eq "0" ]; then | |
python .github/bench.py | |
else | |
sleep ${{ matrix.benchmark_timeout }} | |
fi | |
kill $PID1 | |
- name: Test | |
run: | | |
echo "GITHUB_JOB: ${GITHUB_JOB}, GITHUB_RUN_ID: ${GITHUB_RUN_ID}, GITHUB_RUN_NUMBER: ${GITHUB_RUN_NUMBER}, GITHUB_WORKFLOW: ${GITHUB_WORKFLOW}" |