Skip to content

Commit 51bb45d

Browse files
authored
feat(1047): change github workflows and removed redundant e2e config (#1048)
Signed-off-by: mmyslblocky <[email protected]>
1 parent f0d8b5b commit 51bb45d

File tree

8 files changed

+95
-78
lines changed

8 files changed

+95
-78
lines changed

.env.sample

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/workflows/flow-build-application.yaml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ on:
2323
type: boolean
2424
required: false
2525
default: true
26-
enable-e2e-tests:
27-
description: 'E2E Testing Enabled'
26+
enable-integration-tests:
27+
description: 'Integration Testing Enabled'
2828
type: boolean
2929
required: false
3030
default: false
@@ -42,6 +42,12 @@ defaults:
4242
run:
4343
shell: bash
4444

45+
permissions:
46+
contents: read
47+
actions: read
48+
checks: write
49+
statuses: write
50+
4551
jobs:
4652
code:
4753
name: Code
@@ -64,27 +70,31 @@ jobs:
6470
custom-job-label: Standard
6571
enable-unit-tests: true
6672

67-
e2e-tests:
68-
name: E2E Tests
73+
integration-tests:
74+
name: Integration Tests
6975
uses: ./.github/workflows/zxc-compile-code.yaml
70-
if: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
76+
if: ${{ github.event_name == 'push' || github.event.inputs.enable-integration-tests == 'true' }}
7177
with:
7278
custom-job-label: Standard
73-
enable-e2e-tests: true
79+
enable-integration-tests: true
80+
secrets:
81+
integration-tests-network: ${{ secrets.INTEGRATION_TESTS_NETWORK }}
82+
integration-tests-operator-id: ${{ secrets.INTEGRATION_TESTS_OPERATOR_ID }}
83+
integration-tests-operator-key: ${{ secrets.INTEGRATION_TESTS_OPERATOR_KEY }}
7484

7585
analyze:
7686
name: Analyze
7787
uses: ./.github/workflows/zxc-code-analysis.yaml
7888
needs:
7989
- unit-tests
80-
- e2e-tests
81-
if: ${{ (github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' || github.event.inputs.enable-e2e-tests == 'true') && !failure() && !cancelled() }}
90+
- integration-tests
91+
if: ${{ (github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' || github.event.inputs.enable-integration-tests == 'true') && !failure() && !cancelled() }}
8292
with:
8393
custom-job-label: Source Code
8494
#enable-snyk-scan: ${{ github.event_name == 'push' || github.event.inputs.enable-snyk-scan == 'true' }}
8595
enable-codecov-analysis: true
8696
enable-codacy-coverage: true
87-
enable-e2e-coverage-report: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
97+
enable-integration-coverage-report: ${{ github.event_name == 'push' || github.event.inputs.enable-integration-tests == 'true' }}
8898
secrets:
8999
snyk-token: ${{ secrets.SNYK_TOKEN }}
90100
codecov-token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/flow-deploy-release-artifact.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ jobs:
8787
with:
8888
custom-job-label: 'Safety Checks'
8989
enable-unit-tests: true
90-
enable-e2e-tests: true
90+
enable-integration-tests: true
9191
enable-code-style-check: true
92+
secrets:
93+
integration-tests-network: ${{ secrets.INTEGRATION_TESTS_NETWORK }}
94+
integration-tests-operator-id: ${{ secrets.INTEGRATION_TESTS_OPERATOR_ID }}
95+
integration-tests-operator-key: ${{ secrets.INTEGRATION_TESTS_OPERATOR_KEY }}
9296

9397
create-github-release:
9498
name: Github / Release

.github/workflows/flow-pull-request-checks.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,30 @@ jobs:
5454
custom-job-label: Standard
5555
enable-unit-tests: true
5656

57-
e2e-tests:
58-
name: E2E Tests
57+
integration-tests:
58+
name: Integration Tests
5959
uses: ./.github/workflows/zxc-compile-code.yaml
6060
needs:
6161
- code-style
6262
with:
6363
custom-job-label: Standard
64-
enable-e2e-tests: true
64+
enable-integration-tests: true
65+
secrets:
66+
integration-tests-network: ${{ secrets.INTEGRATION_TESTS_NETWORK }}
67+
integration-tests-operator-id: ${{ secrets.INTEGRATION_TESTS_OPERATOR_ID }}
68+
integration-tests-operator-key: ${{ secrets.INTEGRATION_TESTS_OPERATOR_KEY }}
6569

6670
codecov:
6771
name: CodeCov
6872
uses: ./.github/workflows/zxc-code-analysis.yaml
6973
needs:
7074
- unit-tests
71-
- e2e-tests
75+
- integration-tests
7276
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && github.actor != 'dependabot[bot]' }}
7377
with:
7478
custom-job-label: Standard
7579
enable-codecov-analysis: true
76-
enable-e2e-coverage-report: true
80+
enable-integration-coverage-report: true
7781
secrets:
7882
codecov-token: ${{ secrets.CODECOV_TOKEN }}
7983

@@ -82,20 +86,20 @@ jobs:
8286
uses: ./.github/workflows/zxc-code-analysis.yaml
8387
needs:
8488
- unit-tests
85-
- e2e-tests
89+
- integration-tests
8690
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && github.actor != 'dependabot[bot]' }}
8791
with:
8892
custom-job-label: Coverage
8993
enable-codacy-coverage: true
90-
enable-e2e-coverage-report: true
94+
enable-integration-coverage-report: true
9195
secrets:
9296
codacy-project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
9397
# snyk:
9498
# name: Snyk Scan
9599
# uses: ./.github/workflows/zxc-code-analysis.yaml
96100
# needs:
97101
# - unit-tests
98-
# - e2e-tests
102+
# - integration-tests
99103
# if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && github.actor != 'dependabot[bot]' }}
100104
# with:
101105
# custom-job-label: Standard

.github/workflows/zxc-code-analysis.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ on:
3535
type: boolean
3636
required: false
3737
default: false
38-
enable-e2e-coverage-report:
39-
description: 'E2E Coverage Report Enabled'
38+
enable-integration-coverage-report:
39+
description: 'Integration Coverage Report Enabled'
4040
type: boolean
4141
required: false
4242
default: false
@@ -105,12 +105,12 @@ jobs:
105105
name: Unit Test Coverage Report
106106
path: 'coverage/unit'
107107

108-
- name: Download E2E Coverage Report
108+
- name: Download Integration Coverage Report
109109
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
110-
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
110+
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-integration-coverage-report && !cancelled() && !failure() }}
111111
with:
112-
name: E2E Coverage Report
113-
path: 'coverage/e2e'
112+
name: Integration Coverage Report
113+
path: 'coverage/integration'
114114

115115
- name: Publish To Codecov
116116
uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2

.github/workflows/zxc-compile-code.yaml

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ on:
3333
type: boolean
3434
required: false
3535
default: false
36-
enable-e2e-tests:
37-
description: 'E2E Testing Enabled'
36+
enable-integration-tests:
37+
description: 'Integration Testing Enabled'
3838
type: boolean
3939
required: false
4040
default: false
@@ -48,6 +48,16 @@ on:
4848
type: string
4949
required: false
5050
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
5161

5262
defaults:
5363
run:
@@ -110,55 +120,62 @@ jobs:
110120
name: Unit Test Coverage Report
111121
path: 'coverage/unit'
112122

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() }}
115127
run: |
116128
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
117129
sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
118130
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() }}
121135
run: npm install -g @hashgraph/hedera-local
122136

123-
- name: Setup Local Node (E2E Tests)
137+
- name: Setup Local Node (Integration Tests) (if tests are performed on localnet)
124138
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() }}
126142
run: hedera start --verbose=trace --detached --full
127143

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() }}
130150
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' }}
147164
run: hedera stop
148165

149-
- name: Publish E2E Test Report
166+
- name: Publish Integration Test Report
150167
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() }}
152169
with:
153-
check_name: 'E2E Test Results'
154-
files: 'junit-e2e.xml'
170+
check_name: 'Integration Test Results'
171+
files: 'junit-integration.xml'
155172

156-
- name: Publish E2E Coverage Report
173+
- name: Publish Integration Coverage Report
157174
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
158-
if: ${{ inputs.enable-e2e-tests && !cancelled() }}
175+
if: ${{ inputs.enable-integration-tests && !cancelled() }}
159176
with:
160-
name: E2E Coverage Report
161-
path: 'coverage/e2e'
177+
name: Integration Coverage Report
178+
path: 'coverage/integration'
162179

163180
- name: Publish Test Reports
164181
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0

jest.e2e.config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
"format:check": "prettier --check .",
3333
"prepare": "husky install",
3434
"test:unit": "cross-env JEST_SUITE_NAME=\"Unit Tests\" JEST_JUNIT_OUTPUT_NAME=\"junit.xml\" jest -c jest.unit.config.js --coverage --coverageDirectory=coverage/unit --detectOpenHandles",
35-
"test:integration": "cross-env JEST_SUITE_NAME=\"Integration Tests\" jest -c jest.integration.config.js --coverage --coverageDirectory=coverage/integration --detectOpenHandles",
35+
"test:integration": "cross-env JEST_SUITE_NAME=\"Integration Tests\" JEST_JUNIT_OUTPUT_NAME=\"junit-integration.xml\" jest -c jest.integration.config.js --coverage --coverageDirectory=coverage/integration --detectOpenHandles",
3636
"test:e2e": "cross-env JEST_SUITE_NAME=\"E2E Tests\" JEST_JUNIT_OUTPUT_NAME=\"junit-e2e.xml\" jest -c jest.e2e.config.js --coverage --coverageDirectory=coverage/e2e --runInBand --passWithNoTests",
37-
"test:all": "npm run test:unit && npm run test:e2e",
37+
"test:all": "npm run test:unit && npm run test:integration",
3838
"test": "npm run test:unit",
3939
"single-test": "jest",
4040
"dev": "ts-node src/hedera-cli.ts",

0 commit comments

Comments
 (0)