|
33 | 33 | type: boolean |
34 | 34 | required: false |
35 | 35 | default: false |
36 | | - enable-e2e-tests: |
37 | | - description: 'E2E Testing Enabled' |
| 36 | + enable-integration-tests: |
| 37 | + description: 'Integration Testing Enabled' |
38 | 38 | type: boolean |
39 | 39 | required: false |
40 | 40 | default: false |
|
48 | 48 | type: string |
49 | 49 | required: false |
50 | 50 | default: 'Compiles' |
| 51 | + secrets: |
| 52 | + integration-tests-network: |
| 53 | + description: 'Selected network for integration tests:' |
| 54 | + required: false |
| 55 | + integration-tests-operator-id: |
| 56 | + description: 'Operator ID for integration tests:' |
| 57 | + required: false |
| 58 | + integration-tests-operator-key: |
| 59 | + description: 'Operator private key for integration tests:' |
| 60 | + required: false |
51 | 61 |
|
52 | 62 | defaults: |
53 | 63 | run: |
@@ -110,55 +120,62 @@ jobs: |
110 | 120 | name: Unit Test Coverage Report |
111 | 121 | path: 'coverage/unit' |
112 | 122 |
|
113 | | - - name: Install Docker Compose Plugin |
114 | | - if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }} |
| 123 | + - name: Install Docker Compose Plugin (if tests are performed on localnet) |
| 124 | + env: |
| 125 | + INTEGRATION_TESTS_NETWORK: ${{ secrets.integration-tests-network }} |
| 126 | + if: ${{ inputs.enable-integration-tests && env.INTEGRATION_TESTS_NETWORK == 'localnet' && !cancelled() && !failure() }} |
115 | 127 | run: | |
116 | 128 | sudo curl -fLo /usr/local/lib/docker/cli-plugins/docker-compose https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-linux-x86_64 |
117 | 129 | sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose |
118 | 130 |
|
119 | | - - name: Install Local Node (E2E Tests) |
120 | | - if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }} |
| 131 | + - name: Install Local Node (Integration Tests) (if tests are performed on localnet) |
| 132 | + env: |
| 133 | + INTEGRATION_TESTS_NETWORK: ${{ secrets.integration-tests-network }} |
| 134 | + if: ${{ inputs.enable-integration-tests && env.INTEGRATION_TESTS_NETWORK == 'localnet' && !cancelled() && !failure() }} |
121 | 135 | run: npm install -g @hashgraph/hedera-local |
122 | 136 |
|
123 | | - - name: Setup Local Node (E2E Tests) |
| 137 | + - name: Setup Local Node (Integration Tests) (if tests are performed on localnet) |
124 | 138 | id: setup-local-node |
125 | | - if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }} |
| 139 | + env: |
| 140 | + INTEGRATION_TESTS_NETWORK: ${{ secrets.integration-tests-network }} |
| 141 | + if: ${{ inputs.enable-integration-tests && env.INTEGRATION_TESTS_NETWORK == 'localnet' && !cancelled() && !failure() }} |
126 | 142 | run: hedera start --verbose=trace --detached --full |
127 | 143 |
|
128 | | - - name: Configure E2E Tests |
129 | | - if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }} |
| 144 | + - name: Configure Integration Tests |
| 145 | + env: |
| 146 | + INTEGRATION_TESTS_NETWORK: ${{ secrets.integration-tests-network }} |
| 147 | + INTEGRATION_TESTS_OPERATOR_ID: ${{ secrets.integration-tests-operator-id }} |
| 148 | + INTEGRATION_TESTS_OPERATOR_KEY: ${{ secrets.integration-tests-operator-key }} |
| 149 | + if: ${{ inputs.enable-integration-tests && !cancelled() && !failure() }} |
130 | 150 | run: | |
131 | | - cp .env.sample .env |
132 | | - echo "LOCALNET_OPERATOR_ID=0.0.2" >> ".env" |
133 | | - echo "LOCALNET_OPERATOR_KEY=302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137" >> ".env" |
134 | | - echo "PREVIEWNET_OPERATOR_ID=" >> ".env" |
135 | | - echo "PREVIEWNET_OPERATOR_KEY=" >> ".env" |
136 | | - echo "TESTNET_OPERATOR_ID=" >> ".env" |
137 | | - echo "TESTNET_OPERATOR_KEY=" >> ".env" |
138 | | - echo "MAINNET_OPERATOR_ID=" >> ".env" |
139 | | - echo "MAINNET_OPERATOR_KEY=" >> ".env" |
140 | | -
|
141 | | - - name: Run E2E Tests |
142 | | - if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }} |
143 | | - run: npm run test:e2e |
144 | | - |
145 | | - - name: Teardown Local Node (E2E Tests) |
146 | | - if: ${{ inputs.enable-e2e-tests && steps.setup-local-node.conclusion == 'success' }} |
| 151 | + touch .env.test |
| 152 | + echo "OPERATOR_ID=${{ env.INTEGRATION_TESTS_OPERATOR_ID }}" >> ".env.test" |
| 153 | + echo "OPERATOR_KEY=${{ env.INTEGRATION_TESTS_OPERATOR_KEY }}" >> ".env.test" |
| 154 | + echo "NETWORK=${{ env.INTEGRATION_TESTS_NETWORK }}" >> ".env.test" |
| 155 | +
|
| 156 | + - name: Run Integration Tests |
| 157 | + if: ${{ inputs.enable-integration-tests && !cancelled() && !failure() }} |
| 158 | + run: npm run test:integration |
| 159 | + |
| 160 | + - name: Teardown Local Node (Integration Tests) (if tests are performed on localnet) |
| 161 | + env: |
| 162 | + INTEGRATION_TESTS_NETWORK: ${{ secrets.integration-tests-network }} |
| 163 | + if: ${{ inputs.enable-integration-tests && env.INTEGRATION_TESTS_NETWORK == 'localnet' && steps.setup-local-node.conclusion == 'success' }} |
147 | 164 | run: hedera stop |
148 | 165 |
|
149 | | - - name: Publish E2E Test Report |
| 166 | + - name: Publish Integration Test Report |
150 | 167 | uses: step-security/publish-unit-test-result-action@c8537a200a435e2560109a6a8ed9cac838b62656 # v2.20.5 |
151 | | - if: ${{ inputs.enable-e2e-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }} |
| 168 | + if: ${{ inputs.enable-integration-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }} |
152 | 169 | with: |
153 | | - check_name: 'E2E Test Results' |
154 | | - files: 'junit-e2e.xml' |
| 170 | + check_name: 'Integration Test Results' |
| 171 | + files: 'junit-integration.xml' |
155 | 172 |
|
156 | | - - name: Publish E2E Coverage Report |
| 173 | + - name: Publish Integration Coverage Report |
157 | 174 | uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
158 | | - if: ${{ inputs.enable-e2e-tests && !cancelled() }} |
| 175 | + if: ${{ inputs.enable-integration-tests && !cancelled() }} |
159 | 176 | with: |
160 | | - name: E2E Coverage Report |
161 | | - path: 'coverage/e2e' |
| 177 | + name: Integration Coverage Report |
| 178 | + path: 'coverage/integration' |
162 | 179 |
|
163 | 180 | - name: Publish Test Reports |
164 | 181 | uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
|
0 commit comments