@@ -19,47 +19,78 @@ jobs:
1919 AWS_DEFAULT_REGION : " us-east-1"
2020 AWS_ACCESS_KEY_ID : " AKIAIOSFODNN7EXAMPLE"
2121 AWS_SECRET_ACCESS_KEY : " wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
22+ LOG_PATH : /tmp/debug-logs
23+ PIP_LOG_FILE : /tmp/pip.log
2224 steps :
2325 - uses : actions/checkout@v2
2426 - uses : actions/setup-python@v1
2527 with :
2628 python-version : 3.7
2729 - name : Install Dependencies Python
28- id : installation_python
30+ id : install_python
2931 run : |
32+ mkdir "$LOG_PATH"
3033 pip install --upgrade pip setuptools wheel aws-sam-cli -r https://raw.githubusercontent.com/aws-cloudformation/cloudformation-cli/master/requirements.txt
3134 pip install .
3235 - uses : actions/setup-node@v1
3336 with :
3437 node-version : 12
3538 - name : Install Dependencies Node.js
36- id : installation_nodejs
39+ id : install_nodejs
3740 run : |
38- npm ci --optional && npm run build
41+ npm ci --optional --timing && npm run build
3942 - name : Run Unit Tests
4043 id : unit_testing
4144 run : |
4245 pre-commit run --all-files --verbose
4346 - name : Upload Coverage
44- id : coverage
47+ id : codecov
4548 run : |
4649 curl -s https://codecov.io/bash > codecov.sh
4750 bash codecov.sh -f coverage/py/coverage.xml -F unittests -n codecov-python
4851 bash codecov.sh -f coverage/ts/coverage-final.json -F unittests -n codecov-typescript
49- - name : Upload Artifacts
50- id : upload_artifacts
52+ - name : Upload Coverage Artifacts
53+ id : upload_coverage
5154 uses : actions/upload-artifact@v1
5255 with :
5356 name : coverage
5457 path : coverage/
5558 - name : Run Integration Tests
5659 id : integration_testing
5760 run : |
61+ RPDK_PACKAGE=$(npm pack --silent)
62+ RPDK_PATH=$PWD/$RPDK_PACKAGE
5863 DIR=$(mktemp -d)
5964 cd "$DIR"
65+ echo ::set-env name=PROJECT_DIR::$DIR
6066 ls -la
6167 printf "AWS::Foo::Bar\n1\nn" | cfn init -vv
6268 ls -la
63- cfn validate -vv && cfn generate -vv
64- cfn submit --dry-run -vv
65- sam local invoke --debug --event sam-tests/create.json TestEntrypoint
69+ mkdir ./dist
70+ cp "$RPDK_PATH" ./dist
71+ npm install --timing "./dist/$RPDK_PACKAGE"
72+ cfn generate -vv && cfn validate -vv
73+ npm install --optional --timing
74+ sam build --debug --build-dir ./build TypeFunction
75+ sam build --debug --build-dir ./build TestEntrypoint
76+ sam local invoke -t build/template.yaml --debug --event sam-tests/create.json --log-file sam.log TestEntrypoint
77+ grep -q '"status":"SUCCESS"' sam.log
78+ - name : Gather Debug Logs
79+ id : gather_logs
80+ continue-on-error : true
81+ if : failure()
82+ run : |
83+ mkdir "$LOG_PATH/_logs" 2>&1 || :
84+ cp -r "$(npm config get cache)/_logs" "$LOG_PATH" 2>&1 || :
85+ cp "$GITHUB_WORKSPACE/npm-debug.log" "$LOG_PATH/_logs" 2>&1 || :
86+ cp "$PROJECT_DIR/npm-debug.log" "$LOG_PATH/_logs" 2>&1 || :
87+ cp "$PIP_LOG_FILE" "$LOG_PATH" 2>&1 || :
88+ cp "$PROJECT_DIR/rpdk.log" "$LOG_PATH" 2>&1 || :
89+ cp "$PROJECT_DIR/sam.log" "$LOG_PATH" 2>&1 || :
90+ - name : Upload Debug Artifacts
91+ id : upload_logs
92+ if : failure()
93+ uses : actions/upload-artifact@v1
94+ with :
95+ name : debug-logs
96+ path : ${{ env.LOG_PATH }}
0 commit comments