Skip to content

Commit

Permalink
add: verify_amplify_backend_compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyu99 committed Sep 3, 2024
1 parent 8e2a8da commit c852973
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
6 changes: 6 additions & 0 deletions codebuild_specs/pr_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ batch:
compute-type: BUILD_GENERAL1_MEDIUM
depend-on:
- build_linux
- identifier: verify_amplify_backend_compatability
buildspec: codebuild_specs/verify_amplify_backend_compatability.yml
env:
image: aws/codebuild/amazonlinux2-x86_64-standard:5.0
depend-on:
- build_linux
9 changes: 9 additions & 0 deletions codebuild_specs/verify_amplify_backend_compatability.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 0.2
env:
shell: bash
variables:
NODE_OPTIONS: --max-old-space-size=8096
phases:
build:
commands:
- source ./shared-scripts.sh && _verifyAmplifyBackendCompatability
48 changes: 48 additions & 0 deletions shared-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,54 @@ function _lint {
loadCacheFromBuildJob
chmod +x codebuild_specs/scripts/lint_pr.sh && ./codebuild_specs/scripts/lint_pr.sh
}
function _verifyAmplifyBackendCompatability {
echo "Verify Amplify Backend Compatability"

# Install NVM and set Node.js version
echo "Installing NVM and setting Node.js version"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 18.16.0
nvm use 18.16.0

loadCacheFromBuildJob

# Increase buffer size to avoid error when git operations return large response on CI
git config http.version HTTP/1.1
git config http.postBuffer 157286400

git checkout -b _vab
git symbolic-ref HEAD --short
git rev-parse HEAD

# Fetching git tags from upstream
# For forked repo only
# Can be removed when using team account
echo "fetching tags"
git fetch --tags https://github.com/aws-amplify/amplify-category-api
# Create the folder to avoid failure when no packages are published due to no change detected
rm -rf ../verdaccio-cache && mkdir ../verdaccio-cache

git config user.email [email protected]
git config user.name "Doesnt Matter"

source ./shared-scripts.sh && _publishLocalWorkspace
setNpmRegistryUrlToLocal
npm config get registry

cd ..
git clone https://github.com/aws-amplify/amplify-backend.git
cd amplify-backend
npm update
git diff package-lock.json | grep -e 'graphql-api-construct' -e 'data-construct'
npm run build && npm run test

cd $CODEBUILD_SRC_DIR
unsetNpmRegistryUrl
npm config get registry
yarn verdaccio-stop
}
function _publishToLocalRegistry {
echo "Publish To Local Registry"
loadCacheFromBuildJob
Expand Down

0 comments on commit c852973

Please sign in to comment.