Skip to content

Commit

Permalink
update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardomourar committed Apr 28, 2020
1 parent 204c1b1 commit 21a89f4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
49 changes: 40 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,78 @@ jobs:
AWS_DEFAULT_REGION: "us-east-1"
AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE"
AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
LOG_PATH: /tmp/debug-logs
PIP_LOG_FILE: /tmp/pip.log
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Dependencies Python
id: installation_python
id: install_python
run: |
mkdir "$LOG_PATH"
pip install --upgrade pip setuptools wheel aws-sam-cli -r https://raw.githubusercontent.com/aws-cloudformation/cloudformation-cli/master/requirements.txt
pip install .
- uses: actions/setup-node@v1
with:
node-version: 12
- name: Install Dependencies Node.js
id: installation_nodejs
id: install_nodejs
run: |
npm ci --optional && npm run build
npm ci --optional --timing && npm run build
- name: Run Unit Tests
id: unit_testing
run: |
pre-commit run --all-files --verbose
- name: Upload Coverage
id: coverage
id: codecov
run: |
curl -s https://codecov.io/bash > codecov.sh
bash codecov.sh -f coverage/py/coverage.xml -F unittests -n codecov-python
bash codecov.sh -f coverage/ts/coverage-final.json -F unittests -n codecov-typescript
- name: Upload Artifacts
id: upload_artifacts
- name: Upload Coverage Artifacts
id: upload_coverage
uses: actions/upload-artifact@v1
with:
name: coverage
path: coverage/
- name: Run Integration Tests
id: integration_testing
run: |
RPDK_PACKAGE=$(npm pack --silent)
RPDK_PATH=$PWD/$RPDK_PACKAGE
DIR=$(mktemp -d)
cd "$DIR"
echo ::set-env name=PROJECT_DIR::$DIR
ls -la
printf "AWS::Foo::Bar\n1\nn" | cfn init -vv
ls -la
cfn validate -vv && cfn generate -vv
cfn submit --dry-run -vv
sam local invoke --debug --event sam-tests/create.json TestEntrypoint
mkdir ./dist
cp "$RPDK_PATH" ./dist
npm install --timing "./dist/$RPDK_PACKAGE"
cfn generate -vv && cfn validate -vv
npm install --optional --timing
sam build --debug --build-dir ./build TypeFunction
sam build --debug --build-dir ./build TestEntrypoint
sam local invoke -t build/template.yaml --debug --event sam-tests/create.json --log-file sam.log TestEntrypoint
grep -q '"status":"SUCCESS"' sam.log
- name: Gather Debug Logs
id: gather_logs
continue-on-error: true
if: failure()
run: |
mkdir "$LOG_PATH/_logs" 2>&1 || :
cp -r "$(npm config get cache)/_logs" "$LOG_PATH" 2>&1 || :
cp "$GITHUB_WORKSPACE/npm-debug.log" "$LOG_PATH/_logs" 2>&1 || :
cp "$PROJECT_DIR/npm-debug.log" "$LOG_PATH/_logs" 2>&1 || :
cp "$PIP_LOG_FILE" "$LOG_PATH" 2>&1 || :
cp "$PROJECT_DIR/rpdk.log" "$LOG_PATH" 2>&1 || :
cp "$PROJECT_DIR/sam.log" "$LOG_PATH" 2>&1 || :
- name: Upload Debug Artifacts
id: upload_logs
if: failure()
uses: actions/upload-artifact@v1
with:
name: debug-logs
path: ${{ env.LOG_PATH }}
2 changes: 1 addition & 1 deletion python/rpdk/typescript/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _remove_build_artifacts(deps_path):
@staticmethod
def _make_build_command(base_path, build_command=None):
command = (
"npm install --optional --loglevel verbose "
"npm install --optional --timing "
+ f"&& sam build --debug --build-dir {base_path}/build"
)
if build_command is not None:
Expand Down

0 comments on commit 21a89f4

Please sign in to comment.