Browse Source

ci(test): upload reports

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax 2 years ago
parent
commit
4c8af0e2f9
1 changed files with 70 additions and 0 deletions
  1. 70 0
      .github/workflows/test.yml

+ 70 - 0
.github/workflows/test.yml

@@ -80,6 +80,22 @@ jobs:
         name: Test
         name: Test
         run: |
         run: |
           make -o build test-unit
           make -o build test-unit
+      -
+        name: Prepare reports
+        if: always()
+        run: |
+          mkdir -p bundles /tmp/reports
+          find bundles -path '*/root/*overlay2' -prune -o -type f \( -name '*-report.json' -o -name '*.log' -o -name '*.out' -o -name '*.prof' -o -name '*-report.xml' \) -print | xargs sudo tar -czf /tmp/reports.tar.gz
+          tar -xzf /tmp/reports.tar.gz -C /tmp/reports
+          sudo chown -R $(id -u):$(id -g) /tmp/reports
+          tree -nh /tmp/reports
+      -
+        name: Upload reports
+        if: always()
+        uses: actions/upload-artifact@v3
+        with:
+          name: unit-reports
+          path: /tmp/reports/*
 
 
   docker-py:
   docker-py:
     runs-on: ubuntu-20.04
     runs-on: ubuntu-20.04
@@ -106,11 +122,27 @@ jobs:
         name: Test
         name: Test
         run: |
         run: |
           make -o build test-docker-py
           make -o build test-docker-py
+      -
+        name: Prepare reports
+        if: always()
+        run: |
+          mkdir -p bundles /tmp/reports
+          find bundles -path '*/root/*overlay2' -prune -o -type f \( -name '*-report.json' -o -name '*.log' -o -name '*.out' -o -name '*.prof' -o -name '*-report.xml' \) -print | xargs sudo tar -czf /tmp/reports.tar.gz
+          tar -xzf /tmp/reports.tar.gz -C /tmp/reports
+          sudo chown -R $(id -u):$(id -g) /tmp/reports
+          tree -nh /tmp/reports
       -
       -
         name: Test daemon logs
         name: Test daemon logs
         if: always()
         if: always()
         run: |
         run: |
           cat bundles/test-docker-py/docker.log
           cat bundles/test-docker-py/docker.log
+      -
+        name: Upload reports
+        if: always()
+        uses: actions/upload-artifact@v3
+        with:
+          name: docker-py-reports
+          path: /tmp/reports/*
 
 
   integration-flaky:
   integration-flaky:
     runs-on: ubuntu-20.04
     runs-on: ubuntu-20.04
@@ -190,11 +222,31 @@ jobs:
           make -o build test-integration
           make -o build test-integration
         env:
         env:
           TEST_SKIP_INTEGRATION_CLI: 1
           TEST_SKIP_INTEGRATION_CLI: 1
+      -
+        name: Prepare reports
+        if: always()
+        run: |
+          reportsPath="/tmp/reports/${{ matrix.os }}"
+          if [ -n "${{ matrix.mode }}" ]; then
+            reportsPath="$reportsPath-${{ matrix.mode }}"
+          fi
+          mkdir -p bundles $reportsPath
+          find bundles -path '*/root/*overlay2' -prune -o -type f \( -name '*-report.json' -o -name '*.log' -o -name '*.out' -o -name '*.prof' -o -name '*-report.xml' \) -print | xargs sudo tar -czf /tmp/reports.tar.gz
+          tar -xzf /tmp/reports.tar.gz -C $reportsPath
+          sudo chown -R $(id -u):$(id -g) $reportsPath
+          tree -nh $reportsPath
       -
       -
         name: Test daemon logs
         name: Test daemon logs
         if: always()
         if: always()
         run: |
         run: |
           cat bundles/test-integration/docker.log
           cat bundles/test-integration/docker.log
+      -
+        name: Upload reports
+        if: always()
+        uses: actions/upload-artifact@v3
+        with:
+          name: integration-reports
+          path: /tmp/reports/*
 
 
   integration-cli-prepare:
   integration-cli-prepare:
     runs-on: ubuntu-20.04
     runs-on: ubuntu-20.04
@@ -261,8 +313,26 @@ jobs:
         env:
         env:
           TEST_SKIP_INTEGRATION: 1
           TEST_SKIP_INTEGRATION: 1
           TESTFLAGS: "-test.run (${{ matrix.test }})/"
           TESTFLAGS: "-test.run (${{ matrix.test }})/"
+      -
+        name: Prepare reports
+        if: always()
+        run: |
+          reportsPath=/tmp/reports/$(echo -n "${{ matrix.test }}" | sha256sum | cut -d " " -f 1)
+          mkdir -p bundles $reportsPath
+          echo "${{ matrix.test }}" | tr -s '|' '\n' | tee -a "$reportsPath/tests.txt"
+          find bundles -path '*/root/*overlay2' -prune -o -type f \( -name '*-report.json' -o -name '*.log' -o -name '*.out' -o -name '*.prof' -o -name '*-report.xml' \) -print | xargs sudo tar -czf /tmp/reports.tar.gz
+          tar -xzf /tmp/reports.tar.gz -C $reportsPath
+          sudo chown -R $(id -u):$(id -g) $reportsPath
+          tree -nh $reportsPath
       -
       -
         name: Test daemon logs
         name: Test daemon logs
         if: always()
         if: always()
         run: |
         run: |
           cat bundles/test-integration/docker.log
           cat bundles/test-integration/docker.log
+      -
+        name: Upload reports
+        if: always()
+        uses: actions/upload-artifact@v3
+        with:
+          name: integration-cli-reports
+          path: /tmp/reports/*