Skip to content

Commit

Permalink
Sync with develop
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Ananev <[email protected]>
  • Loading branch information
artemananiev committed Nov 15, 2024
2 parents b307f4b + bea1d1f commit 37bff78
Show file tree
Hide file tree
Showing 557 changed files with 8,673 additions and 3,622 deletions.
1 change: 1 addition & 0 deletions .github/workflows/node-flow-deploy-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
with:
version-policy: specified
new-version: ${{ needs.prepare-deploy-preview.outputs.version }}
dry-run-enabled: ${{ github.event.inputs.dry-run-enabled == 'true' }}
secrets:
access-token: ${{ secrets.GITHUB_TOKEN }}
bucket-name: ${{ secrets.RELEASE_ARTIFACT_BUCKET_NAME }}
Expand Down
74 changes: 72 additions & 2 deletions .github/workflows/zxcron-extended-test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
outputs:
xts-tag-exists: ${{ steps.check-tags-exist.outputs.xts-tag-exists }}
xts-tag-commit: ${{ steps.check-tags-exist.outputs.xts-tag-commit }}
xts-tag-commit-author: ${{ steps.check-tags-exist.outputs.xts-tag-commit-author }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
Expand Down Expand Up @@ -98,11 +99,16 @@ jobs:
BRANCH_ON_DEVELOP="${?}"
set -e
# Get commit author
AUTHOR_NAME=$(git log -1 --format='%an' "${XTS_COMMIT}")
AUTHOR_EMAIL=$(git log -1 --format='%ae' "${XTS_COMMIT}")
# If the tag exists on the Develop Branch set the output variables as appropriate
# Otherwise cancel out
if [[ "${BRANCH_ON_DEVELOP}" -eq 0 ]]; then
echo "xts-tag-exists=true" >> $GITHUB_OUTPUT
echo "xts-tag-commit=${XTS_COMMIT}" >> $GITHUB_OUTPUT
echo "xts-tag-commit-author=${AUTHOR_NAME} <${AUTHOR_EMAIL}>" >> $GITHUB_OUTPUT
echo "### XTS-Candidate commit found" >> $GITHUB_STEP_SUMMARY
echo "xts-tag-commit=${XTS_COMMIT}" >> $GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -242,12 +248,42 @@ jobs:
needs.hedera-node-jrs-panel.result != 'success' ||
needs.tag-for-promotion.result != 'success') &&
!cancelled() && always() }}

steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit

- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
ref: develop
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Collect run logs in a log file
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
run: |
for job_id in $(gh run view ${{ github.run_id }} --json jobs --jq '.jobs | map(.databaseId) | .[0:-1] | .[]'); do
echo "Fetching logs for job $job_id..."
current_job_name=$(gh run view ${{ github.run_id }} --json jobs | jq --argjson job_id "$job_id" -r '.jobs[] | select(.databaseId == $job_id) | .name')
echo "Logs for job $current_job_name :" >> run.log
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/hashgraph/hedera-services/actions/jobs/$job_id/logs >> run.log
done
- name: Upload log as artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
path: run.log

- name: Report failure (slack)
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
env:
Expand Down Expand Up @@ -327,8 +363,42 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Source Commit*: \n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}>"
}
"text": "*Workflow and Commit Information*"
},
"fields": [
{
"type": "mrkdwn",
"text": "*Source Commit*:"
},
{
"type": "mrkdwn",
"text": "<${{ github.server_url }}/${{ github.repository }}/commit/${{ needs.fetch-xts-candidate.outputs.xts-tag-commit }}>"
},
{
"type": "mrkdwn",
"text": "*Commit author*:"
},
{
"type": "mrkdwn",
"text": "${{ needs.fetch-xts-candidate.outputs.xts-tag-commit-author }}"
},
{
"type": "mrkdwn",
"text": "*Workflow run ID*:"
},
{
"type": "mrkdwn",
"text": " ${{ github.run_id }}"
},
{
"type": "mrkdwn",
"text": "*Workflow run URL*:"
},
{
"type": "mrkdwn",
"text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>"
}
]
}
]
}
Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/zxf-dry-run-extended-test-suite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##

name: "ZXF: Extended Test Suite - Dry Run"
on:
workflow_dispatch:
inputs:
commit_sha:
required: true
description: 'The commit sha to check out'
branch_name:
required: true
description: 'The branch name, for JRS Panel output'

permissions:
id-token: write
actions: write
pull-requests: write
statuses: write
checks: write
contents: read

defaults:
run:
shell: bash

jobs:
extended-test-suite:
name: Execute eXtended Test Suite
uses: ./.github/workflows/node-zxc-compile-application-code.yaml
with:
custom-job-label: Execute eXtended Test Suite
enable-timing-sensitive-tests: true
enable-time-consuming-tests: true
enable-hammer-tests: true
enable-hapi-tests-time-consuming: true
enable-network-log-capture: true
ref: ${{ inputs.commit_sha }}
secrets:
access-token: ${{ secrets.GITHUB_TOKEN }}
gradle-cache-username: ${{ secrets.GRADLE_CACHE_USERNAME }}
gradle-cache-password: ${{ secrets.GRADLE_CACHE_PASSWORD }}

abbreviated-panel:
name: JRS Panel
uses: ./.github/workflows/zxc-jrs-regression.yaml
with:
custom-job-name: "Platform SDK"
panel-config: "configs/suites/GCP-PRCheck-Abbrev-4N.json"
ref: ${{ inputs.commit_sha }}
branch-name: ${{ inputs.branch_name }}
base-branch-name: ${{ inputs.branch_name }}
slack-results-channel: "regression-test"
slack-summary-channel: "regression-test"
use-branch-for-slack-channel: false
secrets:
access-token: ${{ secrets.PLATFORM_GH_ACCESS_TOKEN }}
gradle-cache-username: ${{ secrets.GRADLE_CACHE_USERNAME }}
gradle-cache-password: ${{ secrets.GRADLE_CACHE_PASSWORD }}
jrs-ssh-user-name: ${{ secrets.PLATFORM_JRS_SSH_USER_NAME }}
jrs-ssh-key-file: ${{ secrets.PLATFORM_JRS_SSH_KEY_FILE }}
gcp-project-number: ${{ secrets.PLATFORM_GCP_PROJECT_NUMBER }}
gcp-sa-key-contents: ${{ secrets.PLATFORM_GCP_KEY_FILE }}
slack-api-token: ${{ secrets.PLATFORM_SLACK_API_TOKEN }}
grafana-agent-username: ${{ secrets.GRAFANA_AGENT_USERNAME }}
grafana-agent-password: ${{ secrets.GRAFANA_AGENT_PASSWORD }}

hedera-node-jrs-panel:
name: Hedera Node JRS Panel
uses: ./.github/workflows/zxc-jrs-regression.yaml
with:
custom-job-name: "Abbrev Update Test"
ref: ${{ inputs.commit_sha }}
branch-name: ${{ inputs.branch_name }}
hedera-tests-enabled: true
use-branch-for-slack-channel: false
panel-config: "configs/services/suites/daily/GCP-Daily-Services-Abbrev-Update-4N-2C.json"
secrets:
access-token: ${{ secrets.PLATFORM_GH_ACCESS_TOKEN }}
jrs-ssh-user-name: ${{ secrets.PLATFORM_JRS_SSH_USER_NAME }}
jrs-ssh-key-file: ${{ secrets.PLATFORM_JRS_SSH_KEY_FILE }}
gcp-project-number: ${{ secrets.PLATFORM_GCP_PROJECT_NUMBER }}
gcp-sa-key-contents: ${{ secrets.PLATFORM_GCP_KEY_FILE }}
slack-api-token: ${{ secrets.PLATFORM_SLACK_API_TOKEN }}
gradle-cache-username: ${{ secrets.GRADLE_CACHE_USERNAME }}
gradle-cache-password: ${{ secrets.GRADLE_CACHE_PASSWORD }}
grafana-agent-username: ${{ secrets.GRAFANA_AGENT_USERNAME }}
grafana-agent-password: ${{ secrets.GRAFANA_AGENT_PASSWORD }}
62 changes: 62 additions & 0 deletions docs/continuous-integration-testing-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Continuous Integration Test Overview and Best Practices

The series of workflows that make up the Continuous Integration Testing and Release (CITR) process are intended
to drive rapid development and release of code within the Hedera Hashgraph services and platform codebase. This
document aims to define key terms associated with CITR and to provide best practices for developers and
maintainers as they introduce new code to the `hedera-services` repository.

## Definitions

- **CITR** - Continuous Integration Test and Release
- **MATS** - Minimal Acceptable Test Suite
- **PR** - Pull Request
- **XTS** - eXtended Test Suite

## Phase 1 - Launch CITR, Enable MATS, Enable XTS

The first phase of the CITR implementation focuses entirely on the introduction of the CITR workflow set. It brings in
two major components of CITR: MATS and XTS.

MATS is the Minimal Acceptable Test Suite; this suite of tests is run against every pull request (PR) that is opened in
the `hashgraph/hedera-services` repository.

XTS is the eXtended Test Suite; this suite of tests is run against the latest commit on the develop branch every three
hours (provided there is a new commit to run against).

MATS tests are inclusive of a series of unit tests and performance tests that must be executed against a PR branch prior
to merging into develop. The MATS tests are intended to complete within a 30-minute time window to provide developers
with valuable insight of the impact of new code on the default branch.

XTS tests are run against the default branch once every three hours. These cover test cases that are unable to complete
within a 30-minute window but which are still necessary to derive if a commit should be considered as a build
candidate. XTS are intended to complete within a given 3-hour window. These tests are described by the
`ZXCron: Extended Test Suite` workflow.

### Dry-Running XTS Tests

There is an additional workflow: `ZXF: Extended Test Suite - Dry Run` which is available for use within the
`hashgraph/hedera-services` repository.

The XTS Dry-Run workflow runs a provided commit on any branch through the same XTS tests that would be run against the
latest on develop every three hours. This workflow is run with a manual trigger and will execute in parallel to any
other actions ongoing in the `hashgraph/hedera-services` repository.

A developer can manually trigger a run using the parameters in the web UI:

```text
Use Workflow From
Branch: develop # this should always be `develop`
The commit sha to check out
<your current commit hash>
The branch name, for JRS Panel output
<your branch name>
```

Or manually using the github CLI:

```bash
cd ${REPO_ROOT}/hedera-services
gh workflow run ./.github/workflows/zxf-dry-run-extended-test-suite.yaml -f commit_sha=`git rev-parse HEAD` -f branch_name='<branch_name>'
```

**Every developer is encouraged to run the XTS Dry-Run workflow against their branch commits prior to merging a PR to default**.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ val maven =
.reader()
)

name.set(project.name)
url = "https://www.hashgraph.com/"
inceptionYear = "2016"

Expand Down
Loading

0 comments on commit 37bff78

Please sign in to comment.