-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Automated Program Upgrade Testing (#811)
* CI: build previous artifacts * testing: same artifacts * fix: compare hashes without paths * cleanup duplicate workflow + fix dir * enable running when changes detected * parallize flow + fix bool issues * test: no changes to contracts - should skip runs * test: change to contract folder but not to contracts - should skip test after comparing artifact hashes * test: should run upgrade test with changes to contracts folder + testing against 1.0.2 * splitting up reusable components * e2e: test program v1.0.2 -> v1.1.0 upgrade * documentation
- Loading branch information
Showing
10 changed files
with
461 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,45 +46,6 @@ runs: | |
docker stop build-container | ||
docker rm build-container | ||
# should be used again after moving from projectserum/build to backpackapp/build | ||
- name: Install latest Git version (>= 2.18.0) for actions/checkout | ||
if: ${{ inputs.image == '' && inputs.image-version == '' }} | ||
shell: bash | ||
run: | | ||
apt-get update | ||
apt-get install software-properties-common -y | ||
add-apt-repository ppa:git-core/ppa | ||
apt update | ||
apt install git -y | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
- name: Setup go | ||
if: ${{ inputs.image == '' && inputs.image-version == '' }} | ||
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | ||
with: | ||
go-version-file: "go.mod" | ||
check-latest: true | ||
- name: Generate build artifacts for go bindings check | ||
if: ${{ inputs.image == '' && inputs.image-version == '' }} | ||
shell: bash | ||
run: anchor build | ||
working-directory: contracts | ||
- name: Check generated go bindings are up to date | ||
if: ${{ inputs.image == '' && inputs.image-version == '' }} | ||
shell: bash | ||
run: | | ||
go install github.com/gagliardetto/[email protected] | ||
./scripts/anchor-go-gen.sh | ||
git diff --stat --exit-code | ||
- name: Generate program_ids | ||
if: ${{ inputs.image == '' && inputs.image-version == '' }} | ||
shell: bash | ||
run: ./scripts/programs-keys-gen.sh | ||
- name: Generate build artifacts with custom program_ids | ||
if: ${{ inputs.image == '' && inputs.image-version == '' }} | ||
shell: bash | ||
run: anchor build | ||
working-directory: contracts | ||
|
||
#save the contracts artifacts | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,64 @@ | ||
# Contents | ||
|
||
- [How To Run E2E Tests](../docs/RunningE2eTests.md) | ||
- [How To Run E2E Tests](../docs/RunningE2eTests.md) | ||
|
||
## Automated Program Upgrade Testing | ||
|
||
Main Benefit: automatically test that changes made to programs are upgradeable from the deployed version | ||
|
||
Previously, program upgrade testing is a manual process where a node cluster is spun up against deployed programs, | ||
and then steps are manually executed. The following workflow describes automated program testing for any changes | ||
that occur in the `chainlink-solana/contracts` folder. | ||
|
||
This workflow adds additional steps to the base [e2e_custom_cl workflow](https://github.com/smartcontractkit/chainlink-solana/blob/develop/.github/workflows/e2e_custom_cl.yml). | ||
|
||
```mermaid | ||
flowchart TD | ||
classDef base stroke:#00f | ||
testimage[Check Test Image Existence] | ||
buildver[Build Container Version] | ||
smoketest[Execute Smoke Tests] | ||
currentartifacts[Build Current Artifacts] | ||
buildtestimage[Build & Push Test Image] | ||
compcheck[Test Compilation Check] | ||
climage[Build Custom CL Image] | ||
class compcheck,buildver,climage,testimage,currentartifacts,smoketest,buildtestimage base | ||
compcheck --> smoketest | ||
buildver --> currentartifacts | ||
currentartifacts --> smoketest | ||
climage --> smoketest | ||
currentartifacts .->|is labeled?| buildtestimage | ||
classDef upgrade stroke:#0f0 | ||
changecheck[Check Contract Changes] | ||
prevartifacts[Build Previous Artifacts] | ||
combineartifacts[Combine Artifacts For Test] | ||
upgradetest[Execute Upgrade Test] | ||
class changecheck,prevartifacts,combineartifacts,upgradetest upgrade | ||
changecheck .->|changed?| prevartifacts | ||
changecheck .->|changed?| combineartifacts | ||
changecheck .->|changed?| upgradetest | ||
buildver --> prevartifacts | ||
prevartifacts --> combineartifacts | ||
currentartifacts --> combineartifacts | ||
combineartifacts .->|artifacts different?| upgradetest | ||
climage --> upgradetest | ||
compcheck --> upgradetest | ||
``` | ||
|
||
- 🟦 **BLUE**: represents the base smoke test jobs | ||
- 🟩 **GREEN**: represents the program upgrade test jobs | ||
- the program upgrade test is only run when two conditions are true: | ||
- files within `./contract` are changed: this prevents running an integration test unless needed | ||
- generated program artifacts differ from the *pinned* version in the workflow: this prevents running an integration test unless actual program changes were made, not just trivial changes | ||
- note: the pinned version needs to be manually updated to track with the deployed production version | ||
|
||
### Workflow Runs for Upgrade Testing | ||
|
||
✅ **v1.0.2 -> v1.1.0** | ||
|
||
- [commit](https://github.com/smartcontractkit/chainlink-solana/pull/811/commits/0699d595e373e4a3d781b3249f38dda0087421dc) | ||
- [e2e tests job run with upgrade test](https://github.com/smartcontractkit/chainlink-solana/actions/runs/10292293982/job/28486398103?pr=811) |
Oops, something went wrong.