From 86f0833a250e89356f26e93ac08f106503d02a54 Mon Sep 17 00:00:00 2001
From: Stefan Botez <stebotez@amazon.com>
Date: Wed, 2 Dec 2020 17:16:34 +0000
Subject: [PATCH] Include GitHub action on push and pr

---
 .github/workflows/test-on-push-and-pr.yml     | 22 +++++++++++++++++++
 .../codebuild-local/codebuild_build.sh        |  2 +-
 test/integration/codebuild-local/test_one.sh  |  2 +-
 test/test_bootstrap.py                        |  8 ++++---
 4 files changed, 29 insertions(+), 5 deletions(-)
 create mode 100644 .github/workflows/test-on-push-and-pr.yml

diff --git a/.github/workflows/test-on-push-and-pr.yml b/.github/workflows/test-on-push-and-pr.yml
new file mode 100644
index 0000000..fe17cda
--- /dev/null
+++ b/.github/workflows/test-on-push-and-pr.yml
@@ -0,0 +1,22 @@
+name: test-on-push-and-pr
+
+on:
+  push:
+    branches: [ main ]
+  pull_request:
+    branches: [ '*' ]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+      env:
+        GITHUB_WORKSPACE: /
+    - name: Set up python
+      uses: actions/setup-python@v2
+      with:
+        python-version: '3.8'
+    - name: Run 'pr' target
+      run: make pr
diff --git a/test/integration/codebuild-local/codebuild_build.sh b/test/integration/codebuild-local/codebuild_build.sh
index 64af522..ffadfa3 100755
--- a/test/integration/codebuild-local/codebuild_build.sh
+++ b/test/integration/codebuild-local/codebuild_build.sh
@@ -95,7 +95,7 @@ then
     exit 1
 fi
 
-docker_command="docker run -it "
+docker_command="docker run "
 if isOSWindows
 then
     docker_command+="-v //var/run/docker.sock:/var/run/docker.sock -e "
diff --git a/test/integration/codebuild-local/test_one.sh b/test/integration/codebuild-local/test_one.sh
index 3d0e4fa..01dfa91 100755
--- a/test/integration/codebuild-local/test_one.sh
+++ b/test/integration/codebuild-local/test_one.sh
@@ -31,7 +31,7 @@ main() {
     RUNTIME_VERSION="$4"
     EXTRA_ENV="${5-}"
 
-    CODEBUILD_TEMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}"codebuild."$OS_DISTRIBUTION"-"$DISTRO_VERSION"-"$RUNTIME_VERSION".XXXXXXXXXX)
+    CODEBUILD_TEMP_DIR=$(mktemp -d codebuild."$OS_DISTRIBUTION"-"$DISTRO_VERSION"-"$RUNTIME_VERSION".XXXXXXXXXX)
     trap 'rm -rf $CODEBUILD_TEMP_DIR' EXIT
 
     # Create an env file for codebuild_build.
diff --git a/test/test_bootstrap.py b/test/test_bootstrap.py
index 5f1ac5d..3d69038 100644
--- a/test/test_bootstrap.py
+++ b/test/test_bootstrap.py
@@ -288,11 +288,13 @@ def __init__(self, message):
             xray_fault["exceptions"][0]["stack"][0]["label"], "raise_exception_handler"
         )
         self.assertIsInstance(xray_fault["exceptions"][0]["stack"][0]["line"], int)
-        self.assertEqual(
-            xray_fault["exceptions"][0]["stack"][0]["path"], os.path.realpath(__file__)
+        self.assertTrue(
+            xray_fault["exceptions"][0]["stack"][0]["path"].endswith(
+                os.path.relpath(__file__)
+            )
         )
         self.assertEqual(len(xray_fault["paths"]), 1)
-        self.assertEqual(xray_fault["paths"][0], os.path.realpath(__file__))
+        self.assertTrue(xray_fault["paths"][0].endswith(os.path.relpath(__file__)))
 
     def test_handle_event_request_no_module(self):
         def unable_to_import_module(json_input, lambda_context):