mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix workflows
This commit is contained in:
28
.github/workflows/release.yml
vendored
28
.github/workflows/release.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
|||||||
runs-on: [ "self-hosted", "ragflow-test" ]
|
runs-on: [ "self-hosted", "ragflow-test" ]
|
||||||
steps:
|
steps:
|
||||||
- name: Ensure workspace ownership
|
- name: Ensure workspace ownership
|
||||||
run: echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE
|
run: echo "chown -R ${USER} ${GITHUB_WORKSPACE}" && sudo chown -R ${USER} ${GITHUB_WORKSPACE}
|
||||||
|
|
||||||
# https://github.com/actions/checkout/blob/v3/README.md
|
# https://github.com/actions/checkout/blob/v3/README.md
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
@ -31,37 +31,37 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare release body
|
- name: Prepare release body
|
||||||
run: |
|
run: |
|
||||||
if [[ $GITHUB_EVENT_NAME == 'create' ]]; then
|
if [[ ${GITHUB_EVENT_NAME} == "create" ]]; then
|
||||||
RELEASE_TAG=${GITHUB_REF#refs/tags/}
|
RELEASE_TAG=${GITHUB_REF#refs/tags/}
|
||||||
if [[ $RELEASE_TAG == 'nightly' ]]; then
|
if [[ ${RELEASE_TAG} == "nightly" ]]; then
|
||||||
PRERELEASE=true
|
PRERELEASE=true
|
||||||
else
|
else
|
||||||
PRERELEASE=false
|
PRERELEASE=false
|
||||||
fi
|
fi
|
||||||
echo "Workflow triggered by create tag: $RELEASE_TAG"
|
echo "Workflow triggered by create tag: ${RELEASE_TAG}"
|
||||||
else
|
else
|
||||||
RELEASE_TAG=nightly
|
RELEASE_TAG=nightly
|
||||||
PRERELEASE=true
|
PRERELEASE=true
|
||||||
echo "Workflow triggered by schedule"
|
echo "Workflow triggered by schedule"
|
||||||
fi
|
fi
|
||||||
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
|
echo "RELEASE_TAG=${RELEASE_TAG}" >> ${GITHUB_ENV}
|
||||||
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
|
echo "PRERELEASE=${PRERELEASE}" >> ${GITHUB_ENV}
|
||||||
RELEASE_DATETIME=$(date --rfc-3339=seconds)
|
RELEASE_DATETIME=$(date --rfc-3339=seconds)
|
||||||
echo Release $RELEASE_TAG created from $GITHUB_SHA at $RELEASE_DATETIME > release_body.md
|
echo Release ${RELEASE_TAG} created from ${GITHUB_SHA} at ${RELEASE_DATETIME} > release_body.md
|
||||||
|
|
||||||
- name: Move the existing mutable tag
|
- name: Move the existing mutable tag
|
||||||
# https://github.com/softprops/action-gh-release/issues/171
|
# https://github.com/softprops/action-gh-release/issues/171
|
||||||
run: |
|
run: |
|
||||||
git fetch --tags
|
git fetch --tags
|
||||||
if [[ $GITHUB_EVENT_NAME == 'schedule' ]]; then
|
if [[ ${GITHUB_EVENT_NAME} == "schedule" ]]; then
|
||||||
# Determine if a given tag exists and matches a specific Git commit.
|
# Determine if a given tag exists and matches a specific Git commit.
|
||||||
# actions/checkout@v4 fetch-tags doesn't work when triggered by schedule
|
# actions/checkout@v4 fetch-tags doesn't work when triggered by schedule
|
||||||
if [ "$(git rev-parse -q --verify "refs/tags/$RELEASE_TAG")" = "$GITHUB_SHA" ]; then
|
if [ "$(git rev-parse -q --verify "refs/tags/${RELEASE_TAG}")" = "${GITHUB_SHA}" ]; then
|
||||||
echo "mutable tag $RELEASE_TAG exists and matches $GITHUB_SHA"
|
echo "mutable tag ${RELEASE_TAG} exists and matches ${GITHUB_SHA}"
|
||||||
else
|
else
|
||||||
git tag -f $RELEASE_TAG $GITHUB_SHA
|
git tag -f ${RELEASE_TAG} ${GITHUB_SHA}
|
||||||
git push -f origin $RELEASE_TAG:refs/tags/$RELEASE_TAG
|
git push -f origin ${RELEASE_TAG}:refs/tags/${RELEASE_TAG}
|
||||||
echo "created/moved mutable tag $RELEASE_TAG to $GITHUB_SHA"
|
echo "created/moved mutable tag ${RELEASE_TAG} to ${GITHUB_SHA}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and push image
|
- name: Build and push image
|
||||||
run: |
|
run: |
|
||||||
echo ${{ secrets.DOCKERHUB_TOKEN }} | sudo docker login --username infiniflow --password-stdin
|
sudo docker login --username infiniflow --password-stdin <<< ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
sudo docker build --build-arg NEED_MIRROR=1 -t infiniflow/ragflow:${RELEASE_TAG} -f Dockerfile .
|
sudo docker build --build-arg NEED_MIRROR=1 -t infiniflow/ragflow:${RELEASE_TAG} -f Dockerfile .
|
||||||
sudo docker tag infiniflow/ragflow:${RELEASE_TAG} infiniflow/ragflow:latest
|
sudo docker tag infiniflow/ragflow:${RELEASE_TAG} infiniflow/ragflow:latest
|
||||||
sudo docker push infiniflow/ragflow:${RELEASE_TAG}
|
sudo docker push infiniflow/ragflow:${RELEASE_TAG}
|
||||||
|
|||||||
32
.github/workflows/tests.yml
vendored
32
.github/workflows/tests.yml
vendored
@ -9,8 +9,11 @@ on:
|
|||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- '*.md'
|
- '*.md'
|
||||||
- '*.mdx'
|
- '*.mdx'
|
||||||
pull_request:
|
# The only difference between pull_request and pull_request_target is the context in which the workflow runs:
|
||||||
types: [ labeled, synchronize, reopened ]
|
# — pull_request_target workflows use the workflow files from the default branch, and secrets are available.
|
||||||
|
# — pull_request workflows use the workflow files from the pull request branch, and secrets are unavailable.
|
||||||
|
pull_request_target:
|
||||||
|
types: [ synchronize, ready_for_review ]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- '*.md'
|
- '*.md'
|
||||||
@ -28,7 +31,7 @@ jobs:
|
|||||||
name: ragflow_tests
|
name: ragflow_tests
|
||||||
# https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution
|
# https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution
|
||||||
# https://github.com/orgs/community/discussions/26261
|
# https://github.com/orgs/community/discussions/26261
|
||||||
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci') }}
|
if: ${{ github.event_name != 'pull_request_target' || contains(github.event.pull_request.labels.*.name, 'ci') }}
|
||||||
runs-on: [ "self-hosted", "ragflow-test" ]
|
runs-on: [ "self-hosted", "ragflow-test" ]
|
||||||
steps:
|
steps:
|
||||||
# https://github.com/hmarr/debug-action
|
# https://github.com/hmarr/debug-action
|
||||||
@ -37,19 +40,20 @@ jobs:
|
|||||||
- name: Ensure workspace ownership
|
- name: Ensure workspace ownership
|
||||||
run: |
|
run: |
|
||||||
echo "Workflow triggered by ${{ github.event_name }}"
|
echo "Workflow triggered by ${{ github.event_name }}"
|
||||||
echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE
|
echo "chown -R ${USER} ${GITHUB_WORKSPACE}" && sudo chown -R ${USER} ${GITHUB_WORKSPACE}
|
||||||
|
|
||||||
# https://github.com/actions/checkout/issues/1781
|
# https://github.com/actions/checkout/issues/1781
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.sha }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
|
|
||||||
- name: Check workflow duplication
|
- name: Check workflow duplication
|
||||||
if: ${{ !cancelled() && !failure() && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci')) }}
|
if: ${{ !cancelled() && !failure() }}
|
||||||
run: |
|
run: |
|
||||||
if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$GITHUB_EVENT_NAME" != "schedule" ]]; then
|
if [[ ${GITHUB_EVENT_NAME} != "pull_request_target" && ${GITHUB_EVENT_NAME} != "schedule" ]]; then
|
||||||
HEAD=$(git rev-parse HEAD)
|
HEAD=$(git rev-parse HEAD)
|
||||||
# Find a PR that introduced a given commit
|
# Find a PR that introduced a given commit
|
||||||
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
|
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
|
||||||
@ -67,14 +71,14 @@ jobs:
|
|||||||
gh run cancel ${GITHUB_RUN_ID}
|
gh run cancel ${GITHUB_RUN_ID}
|
||||||
while true; do
|
while true; do
|
||||||
status=$(gh run view ${GITHUB_RUN_ID} --json status -q .status)
|
status=$(gh run view ${GITHUB_RUN_ID} --json status -q .status)
|
||||||
[ "$status" = "completed" ] && break
|
[ "${status}" = "completed" ] && break
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [[ "$GITHUB_EVENT_NAME" = "pull_request" ]]; then
|
elif [[ ${GITHUB_EVENT_NAME} == "pull_request_target" ]]; then
|
||||||
PR_NUMBER=${{ github.event.pull_request.number }}
|
PR_NUMBER=${{ github.event.pull_request.number }}
|
||||||
PR_SHA_FP=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/PR_${PR_NUMBER}
|
PR_SHA_FP=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/PR_${PR_NUMBER}
|
||||||
# Calculate the hash of the current workspace content
|
# Calculate the hash of the current workspace content
|
||||||
@ -93,18 +97,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Build ragflow:nightly
|
- name: Build ragflow:nightly
|
||||||
run: |
|
run: |
|
||||||
RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
|
RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-${HOME}}
|
||||||
RAGFLOW_IMAGE=infiniflow/ragflow:${GITHUB_RUN_ID}
|
RAGFLOW_IMAGE=infiniflow/ragflow:${GITHUB_RUN_ID}
|
||||||
echo "RAGFLOW_IMAGE=${RAGFLOW_IMAGE}" >> $GITHUB_ENV
|
echo "RAGFLOW_IMAGE=${RAGFLOW_IMAGE}" >> ${GITHUB_ENV}
|
||||||
sudo docker pull ubuntu:22.04
|
sudo docker pull ubuntu:22.04
|
||||||
sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 -f Dockerfile -t ${RAGFLOW_IMAGE} .
|
sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 -f Dockerfile -t ${RAGFLOW_IMAGE} .
|
||||||
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
|
if [[ ${GITHUB_EVENT_NAME} == "schedule" ]]; then
|
||||||
export HTTP_API_TEST_LEVEL=p3
|
export HTTP_API_TEST_LEVEL=p3
|
||||||
else
|
else
|
||||||
export HTTP_API_TEST_LEVEL=p2
|
export HTTP_API_TEST_LEVEL=p2
|
||||||
fi
|
fi
|
||||||
echo "HTTP_API_TEST_LEVEL=${HTTP_API_TEST_LEVEL}" >> $GITHUB_ENV
|
echo "HTTP_API_TEST_LEVEL=${HTTP_API_TEST_LEVEL}" >> ${GITHUB_ENV}
|
||||||
echo "RAGFLOW_CONTAINER=${GITHUB_RUN_ID}-ragflow-cpu-1" >> $GITHUB_ENV
|
echo "RAGFLOW_CONTAINER=${GITHUB_RUN_ID}-ragflow-cpu-1" >> ${GITHUB_ENV}
|
||||||
|
|
||||||
- name: Start ragflow:nightly
|
- name: Start ragflow:nightly
|
||||||
run: |
|
run: |
|
||||||
@ -154,7 +158,7 @@ jobs:
|
|||||||
echo -e "COMPOSE_PROFILES=\${COMPOSE_PROFILES},tei-cpu" >> docker/.env
|
echo -e "COMPOSE_PROFILES=\${COMPOSE_PROFILES},tei-cpu" >> docker/.env
|
||||||
echo -e "TEI_MODEL=BAAI/bge-small-en-v1.5" >> docker/.env
|
echo -e "TEI_MODEL=BAAI/bge-small-en-v1.5" >> docker/.env
|
||||||
echo -e "RAGFLOW_IMAGE=${RAGFLOW_IMAGE}" >> docker/.env
|
echo -e "RAGFLOW_IMAGE=${RAGFLOW_IMAGE}" >> docker/.env
|
||||||
echo "HOST_ADDRESS=http://host.docker.internal:${SVR_HTTP_PORT}" >> $GITHUB_ENV
|
echo "HOST_ADDRESS=http://host.docker.internal:${SVR_HTTP_PORT}" >> ${GITHUB_ENV}
|
||||||
|
|
||||||
sudo docker compose -f docker/docker-compose.yml -p ${GITHUB_RUN_ID} up -d
|
sudo docker compose -f docker/docker-compose.yml -p ${GITHUB_RUN_ID} up -d
|
||||||
uv sync --python 3.10 --only-group test --no-default-groups --frozen && uv pip install sdk/python
|
uv sync --python 3.10 --only-group test --no-default-groups --frozen && uv pip install sdk/python
|
||||||
|
|||||||
Reference in New Issue
Block a user