Update main.yml #116
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: Test on macOS | |
on: | |
push: | |
branches: | |
- main | |
pull_request_target: | |
types: [opened, synchronize, labeled, reopened] | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.id || github.ref }} | |
cancel-in-progress: true | |
env: | |
POETRY_VERSION: "1.8.3" | |
PYTHON_VERSION: "3.10.9" | |
jobs: | |
macos-basic_tests: | |
if: | | |
!contains(github.event.head_commit.message, '[skip ci]') | |
&& !contains(github.event.pull_request.title, '[skip ci]') | |
runs-on: macos-13 | |
steps: | |
- name: Check for required label | |
if: github.event_name == 'pull_request_target' | |
run: | | |
echo " Wait for lint " | |
sleep 60 | |
LABEL=$(curl -s -X GET \ | |
-H "Authorization: Bearer ${{ secrets.PERSONAL_GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels" | \ | |
jq -r '.[].name' | grep -q 'lint_pass' && echo "true" || echo "false") | |
if [ "$LABEL" == "false" ]; then | |
echo "The 'lint_pass' label is missing. Skipping CI process." | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Fetch PR source branch | |
if: github.event_name == 'pull_request_target' | |
run: | | |
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then | |
echo ${{ github.event.pull_request.head.repo.clone_url }} | |
echo ${{ github.event.pull_request.head.ref }} | |
git remote add external_repo ${{ github.event.pull_request.head.repo.clone_url }} | |
git fetch external_repo ${{ github.event.pull_request.head.ref }}:pr_branch | |
else | |
echo ${{ github.event.pull_request.head.ref }} | |
git fetch origin ${{ github.event.pull_request.head.ref }}:pr_branch | |
fi | |
- name: Merge PR branch into main | |
if: github.event_name == 'pull_request_target' | |
run: | | |
git checkout main | |
git merge --no-ff pr_branch | |
git submodule update --init | |
- name: Copy poetry.lock to root directory | |
run: | | |
echo ${{ github.event_name }} "github.event_name" | |
echo ${{ github.event.pull_request.head.repo.full_name }} | |
echo ${{ github.repository }} | |
cat .readthedocs.yaml |wc -l | |
git branch | |
cd LazyLLM-Env &&git branch | |
cd .. | |
cp LazyLLM-Env/poetry.lock . | |
- name: Set up python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Download model | |
run: | | |
pip install modelscope | |
mkdir -p /Users/runner/.lazyllm | |
mkdir -p /Users/runner/.cache/modelscope/hub | |
ln -s /Users/runner/.cache/modelscope/hub /Users/runner/.lazyllm/model | |
modelscope download Shanghai_AI_Laboratory/internlm2-chat-7b & | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
- name: Build project with Poetry | |
run: | | |
poetry build | |
- name: List dist directory | |
run: ls dist | |
- name: Install the built package | |
run: | | |
pip install dist/lazyllm*.whl | |
- name: basic_tests | |
run : | | |
git clone https://[email protected]/LazyAGI/LazyLLM-Data.git /tmp/lazyllm/data | |
pip install -r tests/requirements.txt | |
export LAZYLLM_DATA_PATH=/tmp/lazyllm/data | |
python -m pytest -v --reruns=2 tests/basic_tests/ | |
timeout-minutes: 30 | |
env : | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
macos-charge_tests: | |
if: | | |
!contains(github.event.head_commit.message, '[skip ci]') | |
&& !contains(github.event.pull_request.title, '[skip ci]') | |
runs-on: macos-13 | |
steps: | |
- name: Check for required label | |
if: github.event_name == 'pull_request_target' | |
run: | | |
brew install jq | |
LABEL=$(curl -s -X GET \ | |
-H "Authorization: Bearer ${{ secrets.PERSONAL_GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels" | \ | |
jq -r '.[].name' | grep -q 'lint_pass' && echo "true" || echo "false") | |
if [ "$LABEL" == "false" ]; then | |
echo "The 'lint_pass' label is missing. Skipping CI process." | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Merge PR branch into main | |
if: github.event_name == 'pull_request_target' | |
run: | | |
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then | |
echo ${{ github.event.pull_request.head.repo.clone_url }} | |
echo ${{ github.event.pull_request.head.ref }} | |
git remote add external_repo ${{ github.event.pull_request.head.repo.clone_url }} | |
git fetch external_repo ${{ github.event.pull_request.head.ref }}:pr_branch | |
else | |
echo ${{ github.event.pull_request.head.ref }} | |
git fetch origin ${{ github.event.pull_request.head.ref }}:pr_branch | |
fi | |
- name: Merge PR branch into main | |
if: github.event_name == 'pull_request_target' | |
run: | | |
git checkout main | |
git merge --no-ff pr_branch | |
git submodule update --init | |
- name: Copy poetry.lock to root directory | |
run: | | |
git branch | |
cd LazyLLM-Env &&git branch | |
cd .. | |
cp LazyLLM-Env/poetry.lock . | |
- name: Set up python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
- name: Build project with Poetry | |
run: | | |
poetry build | |
- name: List dist directory | |
run: ls dist | |
- name: Install the built package | |
run: | | |
pip install dist/lazyllm*.whl | |
- name: charge_tests | |
run : | | |
git clone https://[email protected]/LazyAGI/LazyLLM-Data.git /tmp/lazyllm/data | |
pip install -r tests/requirements.txt | |
export LAZYLLM_DATA_PATH=/tmp/lazyllm/data | |
python -m pytest -v --reruns=2 tests/charge_tests | |
env : | |
LAZYLLM_KIMI_API_KEY: ${{ secrets.LAZYLLM_KIMI_API_KEY }} | |
LAZYLLM_GLM_API_KEY: ${{ secrets.LAZYLLM_GLM_API_KEY }} | |
LAZYLLM_QWEN_API_KEY: ${{ secrets.LAZYLLM_QWEN_API_KEY }} | |
LAZYLLM_SENSENOVA_API_KEY: ${{ secrets.LAZYLLM_SENSENOVA_API_KEY }} | |
LAZYLLM_SENSENOVA_SECRET_KEY: ${{ secrets.LAZYLLM_SENSENOVA_SECRET_KEY }} | |
LAZYLLM_PostgreSQL_URL: ${{ secrets.LAZYLLM_PostgreSQL_URL }} | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
timeout-minutes: 25 |