From 21a89f4b7145421f0df1d1ab2421d746537a60c7 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Tue, 28 Apr 2020 22:37:19 +0200 Subject: [PATCH] update integration tests --- .github/workflows/ci.yml | 49 +++++++++++++++++++++++++------ python/rpdk/typescript/codegen.py | 2 +- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9be6e35..382ebc2 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,35 +19,38 @@ 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 @@ -55,11 +58,39 @@ jobs: - 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 }} diff --git a/python/rpdk/typescript/codegen.py b/python/rpdk/typescript/codegen.py index c5ae3f5..7993692 100644 --- a/python/rpdk/typescript/codegen.py +++ b/python/rpdk/typescript/codegen.py @@ -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: