|
| 1 | +name: Generate Duvet Report for TestServer |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + # Optional inputs that can be provided when calling this workflow |
| 6 | + |
| 7 | +jobs: |
| 8 | + duvet: |
| 9 | + runs-on: macos-latest |
| 10 | + permissions: |
| 11 | + id-token: write |
| 12 | + contents: read |
| 13 | + pages: write |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v6 |
| 18 | + |
| 19 | + # There are a lot of submodules here |
| 20 | + # This initializes the checkouts in parallel (--jobs) |
| 21 | + # rather than in series the way actions/checkout@v6 does it. |
| 22 | + |
| 23 | + - name: Get CPU count |
| 24 | + id: cpu-count |
| 25 | + run: echo "count=$(node -p 'require("os").cpus().length')" >> $GITHUB_OUTPUT |
| 26 | + |
| 27 | + - name: Setup git submodules with PAT |
| 28 | + run: | |
| 29 | + git config --global url."https://github.com/".insteadOf "git@github.com:" |
| 30 | + git config --global credential.helper store |
| 31 | + echo "https://x-token-auth:${{ secrets.PAT_FOR_SPEC }}@github.com" > ~/.git-credentials |
| 32 | +
|
| 33 | + - name: Optimize git for performance |
| 34 | + run: | |
| 35 | + git config --global fetch.parallel ${{ steps.cpu-count.outputs.count }} |
| 36 | + git config --global submodule.fetchJobs ${{ steps.cpu-count.outputs.count }} |
| 37 | + git config --global remote.origin.tagOpt --no-tags |
| 38 | +
|
| 39 | + - name: Checkout submodules with --jobs |
| 40 | + run: | |
| 41 | + git submodule update --init --depth 1 --single-branch --jobs ${{ steps.cpu-count.outputs.count }} test-server/ |
| 42 | + |
| 43 | + |
| 44 | + - name: Checkout CPP code cpp-v3 |
| 45 | + uses: actions/checkout@v6 |
| 46 | + with: |
| 47 | + submodules: recursive |
| 48 | + repository: aws/aws-sdk-cpp |
| 49 | + ref: main |
| 50 | + path: test-server/cpp-v3-server/aws-sdk-cpp/ |
| 51 | + |
| 52 | + - name: Setup Rust toolchain |
| 53 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 54 | + with: |
| 55 | + toolchain: stable |
| 56 | + |
| 57 | + - name: Build and install duvet |
| 58 | + run: | |
| 59 | + cargo install duvet --locked |
| 60 | +
|
| 61 | + - name: Run duvet |
| 62 | + if: always() |
| 63 | + run: cd test-server && make duvet |
| 64 | + |
| 65 | + - name: Upload duvet reports |
| 66 | + if: always() |
| 67 | + uses: actions/upload-artifact@v7 |
| 68 | + with: |
| 69 | + name: test-server-reports |
| 70 | + include-hidden-files: true |
| 71 | + path: test-server/*-server/.duvet/reports/report.html |
| 72 | + |
| 73 | + - name: Generate compliance dashboard |
| 74 | + if: always() |
| 75 | + run: | |
| 76 | + cd test-server/spec-compliance-dashboard |
| 77 | + python generate_compliance_dashboard.py |
| 78 | +
|
| 79 | + - name: Create dashboard redirect index.html |
| 80 | + if: always() |
| 81 | + run: | |
| 82 | + cat > test-server/index.html << 'EOF' |
| 83 | + <!DOCTYPE html> |
| 84 | + <html lang="en"> |
| 85 | + <head> |
| 86 | + <meta charset="UTF-8"> |
| 87 | + <meta http-equiv="refresh" content="0; url=spec-compliance-dashboard/compliance_homepage.html"> |
| 88 | + <title>Redirecting to Compliance Dashboard...</title> |
| 89 | + </head> |
| 90 | + <body> |
| 91 | + <p>Redirecting to <a href="spec-compliance-dashboard/compliance_homepage.html">Compliance Dashboard</a>...</p> |
| 92 | + </body> |
| 93 | + </html> |
| 94 | + EOF |
| 95 | +
|
| 96 | + - name: Upload compliance dashboard |
| 97 | + if: always() |
| 98 | + uses: actions/upload-artifact@v7 |
| 99 | + with: |
| 100 | + name: compliance-dashboard |
| 101 | + include-hidden-files: true |
| 102 | + path: | |
| 103 | + test-server/spec-compliance-dashboard/compliance_homepage.html |
| 104 | + test-server/*/compliance_summary_report.html |
| 105 | + test-server/*/.duvet/reports/report.html |
| 106 | + test-server/spec-compliance-dashboard/templates/* |
| 107 | + test-server/index.html |
| 108 | +
|
| 109 | + - name: Setup Pages |
| 110 | + if: always() && (github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/fireegg-test-servers') && github.event_name == 'push' |
| 111 | + uses: actions/configure-pages@v5 |
| 112 | + |
| 113 | + - name: Upload Pages artifact |
| 114 | + if: always() && (github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/fireegg-test-servers') && github.event_name == 'push' |
| 115 | + uses: actions/upload-pages-artifact@v3 |
| 116 | + with: |
| 117 | + path: test-server/ |
| 118 | + |
| 119 | + - name: Deploy to GitHub Pages |
| 120 | + if: always() && (github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/fireegg-test-servers') && github.event_name == 'push' |
| 121 | + uses: actions/deploy-pages@v4 |
0 commit comments