-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to CI #701
Changes to CI #701
Conversation
WalkthroughThe changes in this pull request primarily focus on enhancing the GitHub Actions workflow defined in Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
.github/workflows/deploy.yml (2)
166-178
: Enhance error handling in schema processingWhile the schema processing steps are well-structured, let's add better error handling:
echo "Installing dependencies..." - pnpm install + pnpm install || { + echo "Failed to install dependencies" + exit 1 + } echo "Processing schema..." - npm run start + npm run start || { + echo "Failed to process schema" + exit 1 + } echo "Flattening schema..." - npm run flatten + npm run flatten || { + echo "Failed to flatten schema" + exit 1 + } echo "Exporting schema..." - npm run export + npm run export || { + echo "Failed to export schema" + exit 1 + }
198-202
: Consider making the wait duration configurableThe hard-coded 6-minute wait might need adjustment based on schema update patterns.
+ env: + SCHEMA_WAIT_DURATION: ${{ vars.SCHEMA_WAIT_DURATION || 360 }} steps: - name: Wait for schema updates run: | echo "Waiting 6 minutes for schema updates to propagate..." - sleep 360 + sleep ${SCHEMA_WAIT_DURATION} echo "Wait complete, proceeding with Armor workflow trigger"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/deploy.yml
(2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/deploy.yml
120-120: shellcheck reported issue in this script: SC2086:info:7:30: Double quote to prevent globbing and word splitting
(shellcheck)
120-120: shellcheck reported issue in this script: SC2086:info:8:36: Double quote to prevent globbing and word splitting
(shellcheck)
120-120: shellcheck reported issue in this script: SC2086:info:15:38: Double quote to prevent globbing and word splitting
(shellcheck)
120-120: shellcheck reported issue in this script: SC2086:info:16:36: Double quote to prevent globbing and word splitting
(shellcheck)
120-120: shellcheck reported issue in this script: SC2086:info:22:33: Double quote to prevent globbing and word splitting
(shellcheck)
🔇 Additional comments (2)
.github/workflows/deploy.yml (2)
113-117
: LGTM: Well-structured job output definition
The addition of the should_continue
output variable provides clear control flow for downstream jobs.
224-227
: LGTM: Well-implemented smoke test integration
The addition of the @smoke_test
grep pattern and version map integration aligns well with the PR objectives for streamlining the testing process.
Also applies to: 245-246
if (testnetKernelsList.includes(kernelAddress)) { | ||
workflowFile = 'develop.yml'; | ||
} else if (kernelAddress === testnetStagingKernels) { | ||
} else if (testnetStagingKernelsList.includes(kernelAddress)) { | ||
workflowFile = 'staging.yml'; | ||
} else { | ||
core.setFailed('Error: Kernel not found in known configurations'); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance workflow file selection error handling
let workflowFile;
if (testnetKernelsList.includes(kernelAddress)) {
workflowFile = 'develop.yml';
} else if (testnetStagingKernelsList.includes(kernelAddress)) {
workflowFile = 'staging.yml';
} else {
- core.setFailed('Error: Kernel not found in known configurations');
+ core.setFailed(`Error: Kernel ${kernelAddress} not found in known configurations. Available kernels: Testnet [${testnetKernelsList}], Staging [${testnetStagingKernelsList}]`);
return;
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if (testnetKernelsList.includes(kernelAddress)) { | |
workflowFile = 'develop.yml'; | |
} else if (kernelAddress === testnetStagingKernels) { | |
} else if (testnetStagingKernelsList.includes(kernelAddress)) { | |
workflowFile = 'staging.yml'; | |
} else { | |
core.setFailed('Error: Kernel not found in known configurations'); | |
return; | |
} | |
if (testnetKernelsList.includes(kernelAddress)) { | |
workflowFile = 'develop.yml'; | |
} else if (testnetStagingKernelsList.includes(kernelAddress)) { | |
workflowFile = 'staging.yml'; | |
} else { | |
core.setFailed(`Error: Kernel ${kernelAddress} not found in known configurations. Available kernels: Testnet [${testnetKernelsList}], Staging [${testnetStagingKernelsList}]`); | |
return; | |
} |
KERNEL_ADDRESS="${{ inputs.kernel_address }}" | ||
IFS=',' read -ra TESTNET_KERNELS_ARR <<< "${{ vars.TESTNET_KERNELS }}" | ||
IFS=',' read -ra TESTNET_STAGING_KERNELS_ARR <<< "${{ vars.TESTNET_STAGING_KERNELS }}" | ||
|
||
for kernel in "${TESTNET_KERNELS_ARR[@]}"; do | ||
if [[ "${KERNEL_ADDRESS}" == "${kernel}" ]]; then | ||
echo "branch=develop" >> $GITHUB_OUTPUT | ||
elif [[ "${KERNEL_ADDRESS}" == "${TESTNET_STAGING_KERNELS}" ]]; then | ||
echo "branch=testnet-staging" >> $GITHUB_OUTPUT | ||
else | ||
echo "Error: Kernel not found in known configurations" | ||
exit 1 | ||
echo "should_continue=true" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
done | ||
|
||
- name: Checkout Schema Parser | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: andromedaprotocol/schema-parser | ||
ref: ${{ steps.check-kernel.outputs.branch }} | ||
token: ${{ secrets.CI_PAT }} | ||
|
||
- name: Download Schemas | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: temp-schemas | ||
path: "packages/schema-parser/schema" | ||
|
||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 8 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
cache: 'pnpm' | ||
|
||
- name: Process Schema | ||
working-directory: packages/schema-parser | ||
run: | | ||
set -eo pipefail | ||
echo "Installing dependencies..." | ||
pnpm install | ||
echo "Processing schema..." | ||
npm run start | ||
echo "Flattening schema..." | ||
npm run flatten | ||
echo "Exporting schema..." | ||
npm run export | ||
|
||
- name: Commit and Push Changes | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
|
||
if [[ -n $(git status --porcelain) ]]; then | ||
git add . | ||
git commit -m "chore: Update schema for kernel: ${{ inputs.kernel_address }}" | ||
git push | ||
else | ||
echo "No changes to commit" | ||
for kernel in "${TESTNET_STAGING_KERNELS_ARR[@]}"; do | ||
if [[ "${KERNEL_ADDRESS}" == "${kernel}" ]]; then | ||
echo "branch=testnet-staging" >> $GITHUB_OUTPUT | ||
echo "should_continue=true" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
done | ||
|
||
echo "Skip: Kernel not found in known configurations" | ||
echo "should_continue=false" >> $GITHUB_OUTPUT | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance shell script robustness and error handling
While the array-based kernel checking is well-designed, let's improve the shell script robustness:
- KERNEL_ADDRESS="${{ inputs.kernel_address }}"
+ KERNEL_ADDRESS="${{ inputs.kernel_address || '' }}"
- IFS=',' read -ra TESTNET_KERNELS_ARR <<< "${{ vars.TESTNET_KERNELS }}"
- IFS=',' read -ra TESTNET_STAGING_KERNELS_ARR <<< "${{ vars.TESTNET_STAGING_KERNELS }}"
+ if [[ -z "${{ vars.TESTNET_KERNELS }}" ]] || [[ -z "${{ vars.TESTNET_STAGING_KERNELS }}" ]]; then
+ echo "Error: Required kernel environment variables are not set"
+ exit 1
+ fi
+
+ IFS=',' read -ra TESTNET_KERNELS_ARR <<< "${{ vars.TESTNET_KERNELS }}"
+ IFS=',' read -ra TESTNET_STAGING_KERNELS_ARR <<< "${{ vars.TESTNET_STAGING_KERNELS }}"
+
+ if [[ -z "${KERNEL_ADDRESS}" ]]; then
+ echo "Error: Kernel address is required"
+ echo "should_continue=false" >> $GITHUB_OUTPUT
+ exit 1
+ fi
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
KERNEL_ADDRESS="${{ inputs.kernel_address }}" | |
IFS=',' read -ra TESTNET_KERNELS_ARR <<< "${{ vars.TESTNET_KERNELS }}" | |
IFS=',' read -ra TESTNET_STAGING_KERNELS_ARR <<< "${{ vars.TESTNET_STAGING_KERNELS }}" | |
for kernel in "${TESTNET_KERNELS_ARR[@]}"; do | |
if [[ "${KERNEL_ADDRESS}" == "${kernel}" ]]; then | |
echo "branch=develop" >> $GITHUB_OUTPUT | |
elif [[ "${KERNEL_ADDRESS}" == "${TESTNET_STAGING_KERNELS}" ]]; then | |
echo "branch=testnet-staging" >> $GITHUB_OUTPUT | |
else | |
echo "Error: Kernel not found in known configurations" | |
exit 1 | |
echo "should_continue=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
done | |
- name: Checkout Schema Parser | |
uses: actions/checkout@v4 | |
with: | |
repository: andromedaprotocol/schema-parser | |
ref: ${{ steps.check-kernel.outputs.branch }} | |
token: ${{ secrets.CI_PAT }} | |
- name: Download Schemas | |
uses: actions/download-artifact@v4 | |
with: | |
name: temp-schemas | |
path: "packages/schema-parser/schema" | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'pnpm' | |
- name: Process Schema | |
working-directory: packages/schema-parser | |
run: | | |
set -eo pipefail | |
echo "Installing dependencies..." | |
pnpm install | |
echo "Processing schema..." | |
npm run start | |
echo "Flattening schema..." | |
npm run flatten | |
echo "Exporting schema..." | |
npm run export | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
if [[ -n $(git status --porcelain) ]]; then | |
git add . | |
git commit -m "chore: Update schema for kernel: ${{ inputs.kernel_address }}" | |
git push | |
else | |
echo "No changes to commit" | |
for kernel in "${TESTNET_STAGING_KERNELS_ARR[@]}"; do | |
if [[ "${KERNEL_ADDRESS}" == "${kernel}" ]]; then | |
echo "branch=testnet-staging" >> $GITHUB_OUTPUT | |
echo "should_continue=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
done | |
echo "Skip: Kernel not found in known configurations" | |
echo "should_continue=false" >> $GITHUB_OUTPUT | |
KERNEL_ADDRESS="${{ inputs.kernel_address || '' }}" | |
if [[ -z "${{ vars.TESTNET_KERNELS }}" ]] || [[ -z "${{ vars.TESTNET_STAGING_KERNELS }}" ]]; then | |
echo "Error: Required kernel environment variables are not set" | |
exit 1 | |
fi | |
IFS=',' read -ra TESTNET_KERNELS_ARR <<< "${{ vars.TESTNET_KERNELS }}" | |
IFS=',' read -ra TESTNET_STAGING_KERNELS_ARR <<< "${{ vars.TESTNET_STAGING_KERNELS }}" | |
if [[ -z "${KERNEL_ADDRESS}" ]]; then | |
echo "Error: Kernel address is required" | |
echo "should_continue=false" >> $GITHUB_OUTPUT | |
exit 1 | |
fi | |
for kernel in "${TESTNET_KERNELS_ARR[@]}"; do | |
if [[ "${KERNEL_ADDRESS}" == "${kernel}" ]]; then | |
echo "branch=develop" >> $GITHUB_OUTPUT | |
echo "should_continue=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
done | |
for kernel in "${TESTNET_STAGING_KERNELS_ARR[@]}"; do | |
if [[ "${KERNEL_ADDRESS}" == "${kernel}" ]]; then | |
echo "branch=testnet-staging" >> $GITHUB_OUTPUT | |
echo "should_continue=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
done | |
echo "Skip: Kernel not found in known configurations" | |
echo "should_continue=false" >> $GITHUB_OUTPUT |
Implementation
Changes:
Made test kernels envs to be lists, if provided kernel is not in those two, skip last two steps
Updated andromeda armour trigger, to trigger only smoke tests
Testing
https://github.com/andromedaprotocol/andromeda-core/actions/runs/12182462497
Summary by CodeRabbit
New Features
Bug Fixes
Chores