44 push :
55 branches : [ main ]
66 pull_request :
7- branches : [ '*' ]
7+ branches : [ '** ' ]
88
99permissions :
1010 contents : read
@@ -18,91 +18,230 @@ jobs:
1818 - name : Run 'pr' target
1919 run : make pr
2020
21- alpine :
21+ integration-test :
2222 runs-on : ubuntu-latest
2323 strategy :
2424 fail-fast : false
2525 matrix :
26- distro_version : ["3.19", "3.20"]
27- runtime_version : ["3.10", "3.11", "3.12", "3.13"]
2826 include :
29- - distro_version : " 3.21"
27+ # Alpine
28+ - distro : alpine
29+ distro_version : " 3.19"
30+ runtime_version : " 3.10"
31+ python_location : /usr/local/bin/python
32+ - distro : alpine
33+ distro_version : " 3.19"
34+ runtime_version : " 3.11"
35+ python_location : /usr/local/bin/python
36+ - distro : alpine
37+ distro_version : " 3.19"
38+ runtime_version : " 3.12"
39+ python_location : /usr/local/bin/python
40+ - distro : alpine
41+ distro_version : " 3.19"
42+ runtime_version : " 3.13"
43+ python_location : /usr/local/bin/python
44+ - distro : alpine
45+ distro_version : " 3.20"
46+ runtime_version : " 3.10"
47+ python_location : /usr/local/bin/python
48+ - distro : alpine
49+ distro_version : " 3.20"
50+ runtime_version : " 3.11"
51+ python_location : /usr/local/bin/python
52+ - distro : alpine
53+ distro_version : " 3.20"
54+ runtime_version : " 3.12"
55+ python_location : /usr/local/bin/python
56+ - distro : alpine
57+ distro_version : " 3.20"
58+ runtime_version : " 3.13"
59+ python_location : /usr/local/bin/python
60+ - distro : alpine
61+ distro_version : " 3.21"
3062 runtime_version : " 3.14"
31-
32- steps :
33- - uses : actions/checkout@v4
34- - name : Run integration test (alpine ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }})
35- run : |
36- docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
37- CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
38- tests/integration/codebuild/buildspec.os.alpine.yml \
39- alpine "${{ matrix.distro_version }}" "${{ matrix.runtime_version }}"
40-
41- debian :
42- runs-on : ubuntu-latest
43- strategy :
44- fail-fast : false
45- matrix :
46- distro_version : ["bookworm", "bullseye"]
47- runtime_version : ["3.10", "3.11", "3.12", "3.13"]
48- include :
49- - distro_version : " bookworm"
63+ python_location : /usr/local/bin/python
64+ # Debian
65+ - distro : debian
66+ distro_version : bookworm
67+ runtime_version : " 3.10"
68+ python_location : /usr/local/bin/python
69+ - distro : debian
70+ distro_version : bookworm
71+ runtime_version : " 3.11"
72+ python_location : /usr/local/bin/python
73+ - distro : debian
74+ distro_version : bookworm
75+ runtime_version : " 3.12"
76+ python_location : /usr/local/bin/python
77+ - distro : debian
78+ distro_version : bookworm
79+ runtime_version : " 3.13"
80+ python_location : /usr/local/bin/python
81+ - distro : debian
82+ distro_version : bookworm
83+ runtime_version : " 3.14"
84+ python_location : /usr/local/bin/python
85+ - distro : debian
86+ distro_version : bullseye
87+ runtime_version : " 3.10"
88+ python_location : /usr/local/bin/python
89+ - distro : debian
90+ distro_version : bullseye
91+ runtime_version : " 3.11"
92+ python_location : /usr/local/bin/python
93+ - distro : debian
94+ distro_version : bullseye
95+ runtime_version : " 3.12"
96+ python_location : /usr/local/bin/python
97+ - distro : debian
98+ distro_version : bullseye
99+ runtime_version : " 3.13"
100+ python_location : /usr/local/bin/python
101+ # Amazon Linux 2
102+ - distro : amazonlinux2
103+ distro_version : " 2"
104+ runtime_version : " 3.10"
105+ python_location : /usr/local/bin/python3
106+ - distro : amazonlinux2
107+ distro_version : " 2"
108+ runtime_version : " 3.11"
109+ python_location : /usr/local/bin/python3
110+ # Amazon Linux 2023
111+ - distro : amazonlinux2023
112+ distro_version : " 2023"
113+ runtime_version : " 3.12"
114+ python_location : /usr/local/bin/python3
115+ - distro : amazonlinux2023
116+ distro_version : " 2023"
117+ runtime_version : " 3.13"
118+ python_location : /usr/local/bin/python3
119+ - distro : amazonlinux2023
120+ distro_version : " 2023"
121+ runtime_version : " 3.14"
122+ python_location : /usr/local/bin/python3
123+ # Ubuntu
124+ - distro : ubuntu
125+ distro_version : " 22.04"
126+ runtime_version : " 3.10"
127+ python_location : /usr/bin/python3.10
128+ - distro : ubuntu
129+ distro_version : " 22.04"
130+ runtime_version : " 3.11"
131+ python_location : /usr/bin/python3.11
132+ - distro : ubuntu
133+ distro_version : " 22.04"
134+ runtime_version : " 3.12"
135+ python_location : /usr/bin/python3.12
136+ - distro : ubuntu
137+ distro_version : " 22.04"
138+ runtime_version : " 3.13"
139+ python_location : /usr/bin/python3.13
140+ - distro : ubuntu
141+ distro_version : " 22.04"
50142 runtime_version : " 3.14"
143+ python_location : /usr/bin/python3.14
144+ - distro : ubuntu
145+ distro_version : " 24.04"
146+ runtime_version : " 3.10"
147+ python_location : /usr/bin/python3.10
148+ - distro : ubuntu
149+ distro_version : " 24.04"
150+ runtime_version : " 3.11"
151+ python_location : /usr/bin/python3.11
152+ - distro : ubuntu
153+ distro_version : " 24.04"
154+ runtime_version : " 3.12"
155+ python_location : /usr/bin/python3.12
156+ - distro : ubuntu
157+ distro_version : " 24.04"
158+ runtime_version : " 3.13"
159+ python_location : /usr/bin/python3.13
160+ - distro : ubuntu
161+ distro_version : " 24.04"
162+ runtime_version : " 3.14"
163+ python_location : /usr/bin/python3.14
51164
52- steps :
53- - uses : actions/checkout@v4
54- - name : Run integration test (debian ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }})
55- run : |
56- docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
57- CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
58- tests/integration/codebuild/buildspec.os.debian.yml \
59- debian "${{ matrix.distro_version }}" "${{ matrix.runtime_version }}"
60-
61- amazonlinux2 :
62- runs-on : ubuntu-latest
63- strategy :
64- fail-fast : false
65- matrix :
66- runtime_version : ["3.10", "3.11"]
165+ name : " ${{ matrix.distro }} ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }}"
67166
68167 steps :
69- - uses : actions/checkout@v4
70- - name : Run integration test (amazonlinux 2 / python ${{ matrix.runtime_version }})
71- run : |
72- docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
73- CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
74- tests/integration/codebuild/buildspec.os.amazonlinux.2.yml \
75- amazonlinux2 "2" "${{ matrix.runtime_version }}"
76-
77- amazonlinux2023 :
78- runs-on : ubuntu-latest
79- strategy :
80- fail-fast : false
81- matrix :
82- runtime_version : ["3.12", "3.13", "3.14"]
168+ - uses : actions/checkout@v4
83169
84- steps :
85- - uses : actions/checkout@v4
86- - name : Run integration test (amazonlinux 2023 / python ${{ matrix.runtime_version }})
87- run : |
88- docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
89- CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
90- tests/integration/codebuild/buildspec.os.amazonlinux.2023.yml \
91- amazonlinux2023 "2023" "${{ matrix.runtime_version }}"
92-
93- ubuntu :
94- runs-on : ubuntu-latest
95- strategy :
96- fail-fast : false
97- matrix :
98- distro_version : ["22.04", "24.04"]
99- runtime_version : ["3.10", "3.11", "3.12", "3.13", "3.14"]
170+ - name : Extract RIE
171+ run : |
172+ mkdir -p .scratch
173+ ARCHITECTURE=$(arch)
174+ if [[ "$ARCHITECTURE" == "x86_64" ]]; then
175+ RIE="aws-lambda-rie"
176+ elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
177+ RIE="aws-lambda-rie-arm64"
178+ else
179+ echo "Architecture $ARCHITECTURE is not currently supported."
180+ exit 1
181+ fi
182+ tar -xvf tests/integration/resources/${RIE}.tar.gz --directory .scratch
183+ echo "RIE=${RIE}" >> "$GITHUB_ENV"
100184
101- steps :
102- - uses : actions/checkout@v4
103- - name : Run integration test (ubuntu ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }})
104- run : |
105- docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
106- CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
107- tests/integration/codebuild/buildspec.os.ubuntu.yml \
108- ubuntu "${{ matrix.distro_version }}" "${{ matrix.runtime_version }}"
185+ - name : Build Docker image
186+ run : |
187+ DOCKERFILE="tests/integration/docker/Dockerfile.echo.${{ matrix.distro }}"
188+ TMPFILE=".scratch/Dockerfile.tmp"
189+ cp "$DOCKERFILE" "$TMPFILE"
190+ if [[ "${{ matrix.distro }}" == "alpine" ]]; then
191+ echo "RUN apk add curl" >> "$TMPFILE"
192+ fi
193+ echo "COPY .scratch/${RIE} /usr/bin/${RIE}" >> "$TMPFILE"
194+ docker build . \
195+ -f "$TMPFILE" \
196+ -t ric-test \
197+ --build-arg RUNTIME_VERSION=${{ matrix.runtime_version }} \
198+ --build-arg DISTRO_VERSION=${{ matrix.distro_version }} \
199+ --build-arg ARCHITECTURE=$(arch)
200+
201+ - name : Run integration test
202+ run : |
203+ TEST_NAME="ric-integ-test"
204+ docker network create "${TEST_NAME}-net"
205+
206+ docker run \
207+ --detach \
208+ --name "${TEST_NAME}-app" \
209+ --network "${TEST_NAME}-net" \
210+ --entrypoint="" \
211+ ric-test \
212+ sh -c "/usr/bin/${RIE} ${{ matrix.python_location }} -m awslambdaric app.handler"
213+
214+ sleep 2
215+
216+ docker run \
217+ --name "${TEST_NAME}-tester" \
218+ --env "TARGET=${TEST_NAME}-app" \
219+ --network "${TEST_NAME}-net" \
220+ --entrypoint="" \
221+ ric-test \
222+ sh -c 'curl -sS -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time 10'
223+
224+ ACTUAL="$(docker logs --tail 1 "${TEST_NAME}-tester" | xargs)"
225+ EXPECTED="success"
226+ echo "Response: ${ACTUAL}"
227+ if [ "$ACTUAL" != "$EXPECTED" ]; then
228+ echo "FAIL: expected '${EXPECTED}', got '${ACTUAL}'"
229+ exit 1
230+ fi
231+ echo "PASS"
232+
233+ - name : Dump container logs
234+ if : always()
235+ run : |
236+ TEST_NAME="ric-integ-test"
237+ echo "=== App container logs ==="
238+ docker logs "${TEST_NAME}-app" 2>&1 || true
239+ echo "=== Tester container logs ==="
240+ docker logs "${TEST_NAME}-tester" 2>&1 || true
241+
242+ - name : Cleanup
243+ if : always()
244+ run : |
245+ TEST_NAME="ric-integ-test"
246+ docker rm -f "${TEST_NAME}-app" "${TEST_NAME}-tester" 2>/dev/null || true
247+ docker network rm "${TEST_NAME}-net" 2>/dev/null || true
0 commit comments