added tests.yml (#2685)
Browse files### What problem does this PR solve?
added tests.yml
### Type of change
- [ ] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [x] Other (please describe): CI
- .github/workflows/tests.yml +73 -0
.github/workflows/tests.yml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: tests
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- 'main'
|
7 |
+
- '*.*.*'
|
8 |
+
paths-ignore:
|
9 |
+
- 'docs/**'
|
10 |
+
- '*.md'
|
11 |
+
- '*.mdx'
|
12 |
+
pull_request:
|
13 |
+
types: [ opened, synchronize, reopened, labeled ]
|
14 |
+
paths-ignore:
|
15 |
+
- 'docs/**'
|
16 |
+
- '*.md'
|
17 |
+
- '*.mdx'
|
18 |
+
|
19 |
+
# https://docs.github.com/en/actions/using-jobs/using-concurrency
|
20 |
+
concurrency:
|
21 |
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
22 |
+
cancel-in-progress: true
|
23 |
+
|
24 |
+
jobs:
|
25 |
+
ragflow_tests:
|
26 |
+
name: ragflow_tests
|
27 |
+
# https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution
|
28 |
+
# https://github.com/orgs/community/discussions/26261
|
29 |
+
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci') }}
|
30 |
+
runs-on: [ "self-hosted", "debug" ]
|
31 |
+
steps:
|
32 |
+
# https://github.com/hmarr/debug-action
|
33 |
+
#- uses: hmarr/debug-action@v2
|
34 |
+
|
35 |
+
- name: Show PR labels
|
36 |
+
run: |
|
37 |
+
echo "Workflow triggered by ${{ github.event_name }}"
|
38 |
+
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
|
39 |
+
echo "PR labels: ${{ join(github.event.pull_request.labels.*.name, ', ') }}"
|
40 |
+
fi
|
41 |
+
|
42 |
+
- name: Ensure workspace ownership
|
43 |
+
run: echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE
|
44 |
+
|
45 |
+
- name: Check out code
|
46 |
+
uses: actions/checkout@v4
|
47 |
+
|
48 |
+
- name: Build ragflow:dev-slim
|
49 |
+
run: |
|
50 |
+
RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
|
51 |
+
ln -s ${RUNNER_WORKSPACE_PREFIX}/huggingface.co huggingface.co
|
52 |
+
sudo docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
|
53 |
+
|
54 |
+
- name: Build ragflow:dev
|
55 |
+
run: |
|
56 |
+
sudo docker build -f Dockerfile -t infiniflow/ragflow:dev .
|
57 |
+
|
58 |
+
- name: Start ragflow:dev-slim
|
59 |
+
run: |
|
60 |
+
sudo docker compose -f docker/docker-compose.yml up -d
|
61 |
+
|
62 |
+
- name: Stop ragflow:dev-slim
|
63 |
+
run: |
|
64 |
+
sudo docker compose -f docker/docker-compose.yml down -v
|
65 |
+
|
66 |
+
- name: Start ragflow:dev
|
67 |
+
run: |
|
68 |
+
echo "RAGFLOW_IMAGE=infiniflow/ragflow:dev" >> docker/.env
|
69 |
+
sudo docker compose -f docker/docker-compose.yml up -d
|
70 |
+
|
71 |
+
- name: Stop ragflow:dev
|
72 |
+
run: |
|
73 |
+
sudo docker compose -f docker/docker-compose.yml down -v
|