|
18 | 18 | AR_REPO: ${{ inputs.repo }} |
19 | 19 |
|
20 | 20 | jobs: |
| 21 | + # Create a list from 1 to `inputs.split` to use as our matrix for `test` |
| 22 | + prepare_groups: |
| 23 | + name: Prepare groups |
| 24 | + id: prepare_groups |
| 25 | + runs-on: ubuntu-latest |
| 26 | + # echo {1..5} => 1 2 3 4 5 |
| 27 | + # echo {1..5} | sed 's/ /, /g' => 1, 2, 3, 4, 5 |
| 28 | + # echo '[$(echo {1..5} | sed 's/ /, /g')]' => [1, 2, 3, 4, 5] |
| 29 | + steps: |
| 30 | + - id: prepare_groups |
| 31 | + runs: | |
| 32 | + group_list=$(echo "[$(echo {1..${{ inputs.split }}} | sed 's/ /, /g')]") |
| 33 | + echo "groups='$group_list'" >> $GITHUB_OUTPUT |
| 34 | +
|
21 | 35 | test: |
22 | 36 | name: Test |
23 | 37 | runs-on: ubuntu-latest |
| 38 | + needs: [prepare_groups] |
24 | 39 | strategy: |
25 | 40 | matrix: |
26 | | - group: [1, 2, 3, 4, 5] |
| 41 | + # Parse our group list into a JSON object |
| 42 | + group: ${{ fromJSON(needs.prepare_groups.outputs.groups) }} |
27 | 43 | steps: |
28 | 44 | - name: Checkout |
29 | 45 | uses: actions/checkout@v4 |
@@ -59,20 +75,91 @@ jobs: |
59 | 75 | if: inputs.run_integration == true |
60 | 76 | run: | |
61 | 77 | make test_env.run_integration GROUP=${{ matrix.group }} SPLIT=${{ inputs.split }} |
62 | | - ## Don't upload on forks for now. |
63 | | - - name: upload using codecovcli |
64 | | - if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} |
65 | | - run: | |
66 | | - make test_env.upload CODECOV_UPLOAD_TOKEN=${{ secrets.CODECOV_ORG_TOKEN }} CODECOV_URL=${{ secrets.CODECOV_URL }} |
67 | | - - name: upload using codecovcli staging |
68 | | - if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} |
69 | | - run: | |
70 | | - make test_env.upload CODECOV_UPLOAD_TOKEN=${{ secrets.CODECOV_ORG_TOKEN_STAGING }} CODECOV_URL=${{ secrets.CODECOV_STAGING_URL }} |
71 | | - - name: upload using codecovcli qa |
72 | | - if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} |
73 | | - run: | |
74 | | - make test_env.upload CODECOV_UPLOAD_TOKEN=${{ secrets.CODECOV_QA_TOKEN }} CODECOV_URL=${{ secrets.CODECOV_QA_URL }} |
75 | | - - name: upload using codecovcli public qa |
76 | | - if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} |
77 | | - run: | |
78 | | - make test_env.upload CODECOV_UPLOAD_TOKEN=${{ secrets.CODECOV_PUBLIC_QA_TOKEN }} CODECOV_URL=${{ secrets.CODECOV_PUBLIC_QA_URL }} |
| 78 | +
|
| 79 | + - uses: actions/upload-artifact@v4 |
| 80 | + if: ${{ !cancelled() }} |
| 81 | + with: |
| 82 | + name: coveragefiles-${{ matrix.group }} |
| 83 | + path: ./*.coverage.xml |
| 84 | + |
| 85 | + - uses: actions/upload-artifact@v4 |
| 86 | + if: ${{ !cancelled() }} |
| 87 | + with: |
| 88 | + name: junitfiles-${{ matrix.group }} |
| 89 | + path: ./*junit*.xml |
| 90 | + |
| 91 | + upload: |
| 92 | + name: Upload to Codecov |
| 93 | + runs-on: ubuntu-latest |
| 94 | + needs: [test] |
| 95 | + strategy: |
| 96 | + matrix: |
| 97 | + include: |
| 98 | + - codecov_url_secret: CODECOV_URL |
| 99 | + codecov_token_secret: CODECOV_ORG_TOKEN |
| 100 | + name: prod |
| 101 | + - codecov_url_secret: CODECOV_STAGING_URL |
| 102 | + codecov_token_secret: CODECOV_ORG_TOKEN_STAGING |
| 103 | + name: staging |
| 104 | + - codecov_url_secret: CODECOV_QA_URL |
| 105 | + codecov_token_secret: CODECOV_QA_ORG |
| 106 | + name: qa |
| 107 | + - codecov_url_secret: CODECOV_PUBLIC_QA_URL |
| 108 | + codecov_token_secret: CODECOV_PUBLIC_QA_TOKEN |
| 109 | + name: public qa |
| 110 | + |
| 111 | + steps: |
| 112 | + - name: Checkout |
| 113 | + uses: actions/checkout@v4 |
| 114 | + with: |
| 115 | + fetch-depth: 0 |
| 116 | + |
| 117 | + - name: Download coverage |
| 118 | + uses: actions/download-artifact@v4 |
| 119 | + with: |
| 120 | + pattern: coveragefiles-* |
| 121 | + merge_multiple: true |
| 122 | + |
| 123 | + - name: Download test results |
| 124 | + uses: actions/download-artifact@v4 |
| 125 | + with: |
| 126 | + pattern: junitfiles-* |
| 127 | + merge_multiple: true |
| 128 | + |
| 129 | + - name: Uploading unit test coverage (${{ matrix.name }}) |
| 130 | + uses: codecov/codecov-action@v5 |
| 131 | + with: |
| 132 | + files: ./unit.*.coverage.xml |
| 133 | + flags: ${{ format('{0}unit', inputs.flag_prefix) }} |
| 134 | + disable_search: true |
| 135 | + token: ${{ secrets[matrix.codecov_token_secret] }} |
| 136 | + url: ${{ secrets[matrix.codecov_url_secret] }} |
| 137 | + |
| 138 | + - name: Uploading integration test coverage (${{ matrix.name }}) |
| 139 | + if: ${{ inputs.run_integration == true }} |
| 140 | + uses: codecov/codecov-action@v5 |
| 141 | + with: |
| 142 | + files: ./integration.*.coverage.xml |
| 143 | + flags: ${{ format('{0}integration', inputs.flag_prefix) }} |
| 144 | + disable_search: true |
| 145 | + token: ${{ secrets[matrix.codecov_token_secret] }} |
| 146 | + url: ${{ secrets[matrix.codecov_url_secret] }} |
| 147 | + |
| 148 | + - name: Uploading unit test results (${{ matrix.name }}) |
| 149 | + uses: codecov/test-results-action@v1 |
| 150 | + with: |
| 151 | + files: ./unit.*.junit.xml |
| 152 | + flags: ${{ format('{0}unit', inputs.flag_prefix) }} |
| 153 | + disable_search: true |
| 154 | + token: ${{ secrets[matrix.codecov_token_secret] }} |
| 155 | + url: ${{ secrets[matrix.codecov_url_secret] }} |
| 156 | + |
| 157 | + - name: Uploading integration test results (${{ matrix.name }}) |
| 158 | + if: ${{ inputs.run_integration == true }} |
| 159 | + uses: codecov/test-results-action@v1 |
| 160 | + with: |
| 161 | + files: ./integration.*.junit.xml |
| 162 | + flags: ${{ format('{0}integration', inputs.flag_prefix) }} |
| 163 | + disable_search: true |
| 164 | + token: ${{ secrets[matrix.codecov_token_secret] }} |
| 165 | + url: ${{ secrets[matrix.codecov_url_secret] }} |
0 commit comments