diff --git a/.github/workflows/docker/docker-compose.yaml b/.github/workflows/docker/docker-compose.yaml index e04a722aeb..56f1592eb6 100644 --- a/.github/workflows/docker/docker-compose.yaml +++ b/.github/workflows/docker/docker-compose.yaml @@ -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: @@ -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: diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 12e9165f42..adc172fd44 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -5,7 +5,9 @@ on: types: [created] permissions: - contents: read + contents: write + checks: write + pull-requests: write jobs: unittest: @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 0ac74362d7..89c247e227 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ dev = [ "isort>=5.12.0", "mypy>=1.7.0", "pytest>=8.0.0", + "pytest-json-ctrf", ] doc = [