Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
services:
trinity-node-1:
image: trinity-rft:latest-unittest
user: "${UID}:${GID}"
pull_policy: never
command: sh -c "pip install -e .[dev] && ray start --head --dashboard-host 0.0.0.0 --include-dashboard true --block"
environment:
Expand All @@ -26,6 +27,7 @@ services:

trinity-node-2:
image: trinity-rft:latest-unittest
user: "${UID}:${GID}"
pull_policy: never
command: sh -c "pip install -e .[dev] && ray start --address=trinity-node-1:6379 --block"
environment:
Expand Down
33 changes: 23 additions & 10 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
types: [created]

permissions:
contents: read
contents: write
checks: write
pull-requests: write

jobs:
unittest:
Expand All @@ -14,31 +16,42 @@ jobs:
runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: trinity-${{ github.run_id }}
fetch-depth: 0

- name: Setup docker compose
working-directory: trinity-${{ github.run_id }}/.github/workflows/docker
run: |
export UID=$(id -u)
export GID=$(id -g)
docker compose up -d
sleep 5s

- name: Check ray status
working-directory: trinity-${{ github.run_id }}/.github/workflows/docker
run: |
docker compose exec trinity-node-1 ray status
docker compose exec trinity-node-2 ray status

- name: Run unittest
working-directory: trinity-${{ github.run_id }}/.github/workflows/docker
run: |
docker compose exec trinity-node-1 pytest tests --ignore=tests/data --junitxml=pytest.xml
docker compose exec trinity-node-1 pytest tests --ignore=tests/data --ctrf report.json
continue-on-error: true

- name: Upload test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: trinity-${{ github.run_id }}/pytest.xml
path: trinity-${{ github.run_id }}/report.json

- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
junitxml-title: Unittest Result Summary
junitxml-path: trinity-${{ github.run_id }}/pytest.xml
report-path: trinity-${{ github.run_id }}/report.json
pull-request-report: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always()
# TODO: run data tests after the dependency conflict is resolved
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dev = [
"isort>=5.12.0",
"mypy>=1.7.0",
"pytest>=8.0.0",
"pytest-json-ctrf",
]

doc = [
Expand Down