Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 976db7c

Browse files
committed
Merge branch 'main' into antonpirker/use-relay-as-extension
2 parents d38ea45 + f53475f commit 976db7c

File tree

3 files changed

+76
-29
lines changed

3 files changed

+76
-29
lines changed

.github/workflows/test_production.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test Production
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
debug_enabled:
7+
description: "Run the build with tmate debugging enabled (true/false)? (see https://github.com/marketplace/actions/debugging-with-tmate)"
8+
required: false
9+
default: "false"
10+
11+
env:
12+
BUILD_CACHE_KEY: ${{ github.sha }}
13+
CACHED_BUILD_PATHS: |
14+
${{ github.workspace }}/dist-serverless
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
name: "Test Lambda Layer Build (the current v1 that is in production, not the code from the branch)"
20+
steps:
21+
- name: Setup build cache
22+
uses: actions/cache@v2
23+
id: build_cache
24+
with:
25+
path: ${{ env.CACHED_BUILD_PATHS }}
26+
key: ${{ env.BUILD_CACHE_KEY }}
27+
- name: Create dummy Lambda Layer
28+
run: |
29+
echo "Creating a dummy Lambda layer in the /dist-serverless directory..."
30+
mkdir -p dist-serverless
31+
touch dist-serverless/PUT_LAYER_CODE_HERE
32+
echo "Done creating a dummy Lambda layer in the /dist-serverless directory."
33+
- uses: getsentry/action-build-aws-lambda-extension@v1
34+
with:
35+
artifact_name: ${{ github.sha }}
36+
zip_file_name: test-aws-lambda-layer.zip
37+
build_cache_paths: ${{ env.CACHED_BUILD_PATHS }}
38+
build_cache_key: ${{ env.BUILD_CACHE_KEY }}
39+
debug_enabled: ${{ github.event.inputs.debug_enabled }}

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ steps:
4141
zip_file_name: sentry-python-serverless.zip
4242
```
4343

44+
This test script illustrates the usage of the action:
45+
46+
[.github/workflows/test_production.yml](.github/workflows/test_production.yml)
47+
4448
For an full example usage see the Sentry Python SDK:
4549

4650
https://github.com/getsentry/sentry-python/blob/master/.github/workflows/ci.yml
@@ -49,12 +53,17 @@ https://github.com/getsentry/sentry-python/blob/master/.github/workflows/ci.yml
4953

5054
The following are all _required_.
5155

52-
| name | description |
53-
| ------------------- | ----------------------------------------------------------------------------- |
54-
| `artifact_name` | Name of the prepared articact the Lambda Layer zip file should be uploaded to |
55-
| `zip_file_name` | Name of the zip file that will be created |
56-
| `build_cache_key` | Build cache key |
57-
| `build_cache_paths` | Paths of the build cache |
56+
| name | description |
57+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
58+
| `artifact_name` | Name of the prepared articact the Lambda Layer zip file should be uploaded to |
59+
| `zip_file_name` | Name of the zip file that will be created |
60+
| `build_cache_key` | Build cache key |
61+
| `build_cache_paths` | Paths of the build cache |
62+
| `debug_enabled` | If set to "true" debugging is enabled and you can log into the running action. (See https://github.com/marketplace/actions/debugging-with-tmate) |
63+
64+
## Testing
65+
66+
If you want to see an example of a zip file this action can create looks like you can manually run the GitHub action "Test Production". This will create a dummy lambda layer (just containing one placeholder file) and the latest [relay](https://github.com/getsentry/relay) based Sentry Lambda Extension. After the GitHub action has run, you can download the generated artifact at the bottom of the summary page of the GitHub action result.
5867

5968
## Contributing
6069

action.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
name: "Build AWS Lambda Layer"
22
description: "Creates a Lambda layer including the Sentry SDK and the Sentry Lambda extension."
3+
34
inputs:
45
artifact_name:
5-
description: Name of the prepared articact the Lambda Layer zip file should be uploaded to
6+
description: "Name of the prepared articact the Lambda Layer zip file should be uploaded to"
67
required: true
78
zip_file_name:
8-
description: Name of the zip file that will be created
9+
description: "Name of the zip file that will be created"
910
required: true
1011
build_cache_key:
11-
description: Build cache key
12+
description: "Build cache key"
1213
required: true
1314
build_cache_paths:
14-
description: Paths of the build cache
15+
description: "Paths of the build cache"
1516
required: true
16-
on:
17-
workflow_dispatch:
18-
inputs:
19-
debug_enabled:
20-
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
21-
required: false
22-
default: false
17+
debug_enabled:
18+
description: 'Run the build with tmate debugging enabled? (https://github.com/marketplace/actions/debugging-with-tmate)'
19+
required: false
20+
default: "false"
21+
2322
runs:
2423
using: "composite"
2524
steps:
26-
- name: Check build cache
25+
- name: "Check build cache"
2726
uses: actions/cache@v2
2827
id: cache_built_packages
2928
with:
@@ -44,16 +43,16 @@ runs:
4443
run: |
4544
echo "Creating start script..."
4645
cat > dist-serverless/extensions/sentry-lambda-extension << EOT
47-
#!/usr/bin/env bash
48-
set -euo pipefail
49-
./relay run
46+
#!/usr/bin/env bash
47+
set -euo pipefail
48+
./relay run
5049
EOT
5150
chmod +x dist-serverless/extensions/sentry-lambda-extension
5251
echo "Done creating start script."
53-
- name: Setup tmate session
54-
uses: mxschmitt/action-tmate@v3
55-
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
56-
- name: Create Lambda Layer zip
52+
- name: "Setup tmate session"
53+
uses: mxschmitt/action-tmate@v3
54+
if: ${{ inputs.debug_enabled == 'true' }}
55+
- name: "Create Lambda Layer zip"
5756
shell: bash
5857
run: |
5958
echo "Creating ${{ inputs.zip_file_name }}..."
@@ -65,10 +64,10 @@ set -euo pipefail
6564
6665
echo "Contents of the created zip file:"
6766
unzip -Z ${{ inputs.zip_file_name }}
68-
- name: Setup tmate session
69-
uses: mxschmitt/action-tmate@v3
70-
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
71-
- name: Upload zip (will be picked up by Craft for deployment)
67+
- name: "Setup tmate session"
68+
uses: mxschmitt/action-tmate@v3
69+
if: ${{ inputs.debug_enabled == 'true' }}
70+
- name: "Upload zip (will be picked up by Craft for deployment)"
7271
uses: actions/upload-artifact@v3
7372
with:
7473
name: ${{ inputs.artifact_name }}

0 commit comments

Comments
 (0)