Skip to content

Commit 7fd9510

Browse files
authored
Fix unittest action (#17)
1 parent 8a82ac7 commit 7fd9510

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

.github/workflows/docker/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
services:
22
trinity-node-1:
33
image: trinity-rft:latest-unittest
4+
user: "${UID}:${GID}"
45
pull_policy: never
56
command: sh -c "pip install -e .[dev] && ray start --head --dashboard-host 0.0.0.0 --include-dashboard true --block"
67
environment:
@@ -26,6 +27,7 @@ services:
2627

2728
trinity-node-2:
2829
image: trinity-rft:latest-unittest
30+
user: "${UID}:${GID}"
2931
pull_policy: never
3032
command: sh -c "pip install -e .[dev] && ray start --address=trinity-node-1:6379 --block"
3133
environment:

.github/workflows/unittest.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,35 @@ jobs:
2323
- name: Setup docker compose
2424
working-directory: trinity-${{ github.run_id }}/.github/workflows/docker
2525
run: |
26+
export UID=$(id -u)
27+
export GID=$(id -g)
2628
docker compose up -d
29+
sleep 5s
30+
31+
- name: Check ray status
32+
working-directory: trinity-${{ github.run_id }}/.github/workflows/docker
33+
run: |
34+
docker compose exec trinity-node-1 ray status
35+
docker compose exec trinity-node-2 ray status
2736
2837
- name: Run unittest
2938
working-directory: trinity-${{ github.run_id }}/.github/workflows/docker
3039
run: |
31-
docker compose exec trinity-node-1 pytest tests --ignore=tests/data --junitxml=pytest.xml
40+
docker compose exec trinity-node-1 pytest tests --ignore=tests/data --ctrf report.json
3241
continue-on-error: true
3342

3443
- name: Upload test results
3544
uses: actions/upload-artifact@v4
3645
with:
3746
name: pytest-results
38-
path: trinity-${{ github.run_id }}/pytest.xml
47+
path: trinity-${{ github.run_id }}/report.json
3948

40-
- name: Pytest coverage comment
41-
uses: MishaKav/pytest-coverage-comment@main
49+
- name: Publish Test Report
50+
uses: ctrf-io/github-test-reporter@v1
4251
with:
43-
junitxml-title: Unittest Result Summary
44-
junitxml-path: trinity-${{ github.run_id }}/pytest.xml
52+
report-path: trinity-${{ github.run_id }}/report.json
53+
pull-request-report: true
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
if: always()
4557
# TODO: run data tests after the dependency conflict is resolved

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ dev = [
5252
"isort>=5.12.0",
5353
"mypy>=1.7.0",
5454
"pytest>=8.0.0",
55+
"pytest-json-ctrf",
5556
]
5657

5758
doc = [

0 commit comments

Comments
 (0)