-
Notifications
You must be signed in to change notification settings - Fork 5
89 lines (77 loc) · 2.65 KB
/
Copy pathlambda.yml
File metadata and controls
89 lines (77 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Lambda
on:
push:
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel superseded runs on feature branches and PRs. Never on develop/main
# or tags: the release gate needs a completed Test/Build run per commit.
cancel-in-progress: >-
${{ github.ref != 'refs/heads/develop'
&& github.ref != 'refs/heads/main'
&& !startsWith(github.ref, 'refs/tags/') }}
jobs:
package:
name: Lambda ZIP Package
# Avoid double runs: in-repo branches are covered by the push event above.
# Fork PRs have no push event, so they are covered here instead.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
package:
- data-seeder
- mailer
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: '3.14'
- name: Create build info
run: |
bash scripts/build-info.sh
- name: Create Lambda package
run: |
cd packages/dsw-${{ matrix.package }}
make lambda-package
- name: Check Lambda package compressed size
run: |
MAX_ZIPPED=$((250 * 1024 * 1024))
SIZE_BYTES=$(stat --printf="%s" "$ZIP")
SIZE_MB=$((SIZE_BYTES / (1024 * 1024)))
echo "Zipped size: $SIZE_BYTES bytes ($SIZE_MB MB)"
if [ "$SIZE_BYTES" -gt "$MAX_ZIPPED" ]; then
echo "❌ ZIP file exceeds 250 MB limit"
exit 1
fi
echo "✅ ZIP size within limit"
env:
ZIP: packages/dsw-${{ matrix.package }}/${{ matrix.package }}-lambda.zip
- name: Check Lambda package uncompressed size
run: |
MAX_UNZIPPED=$((250 * 1024 * 1024))
TMPDIR=$(mktemp -d)
unzip -q "$ZIP" -d "$TMPDIR"
SIZE_BYTES=$(du -sb "$TMPDIR" | awk '{print $1}')
SIZE_MB=$((SIZE_BYTES / (1024 * 1024)))
rm -rf "$TMPDIR"
echo "Unzipped size: $SIZE_BYTES bytes ($SIZE_MB MB)"
if [ "$SIZE_BYTES" -gt "$MAX_UNZIPPED" ]; then
echo "❌ Unzipped size exceeds 250 MB limit"
exit 1
fi
echo "✅ Unzipped size within Lambda limit"
env:
ZIP: packages/dsw-${{ matrix.package }}/${{ matrix.package }}-lambda.zip
- name: Create artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.package }}-lambda.zip
path: packages/dsw-${{ matrix.package }}/${{ matrix.package }}-lambda.zip