forked from aws/aws-sam-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
242 lines (234 loc) · 6.88 KB
/
build.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: Build And Test
on:
pull_request:
branches:
- develop
- "feat/*"
- "feat-*"
merge_group:
types: [ checks_requested ]
branches:
- develop
- "feat/*"
- "feat-*"
# to automatically cancel the running workflow for same PR.
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
run-workflow:
name: PR Workflow
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
needs:
- make-pr
- integration-tests
- smoke-and-functional-tests
- docker-disabled
steps:
- name: report-failure
if : |
needs.make-pr.result != 'success' ||
needs.integration-tests.result != 'success' ||
needs.smoke-and-functional-tests.result != 'success' ||
needs.docker-disabled.result != 'success'
run: exit 1
- name: report-success
run: exit 0
make-pr:
name: make pr / ${{ matrix.os }} / ${{ matrix.python }}
if: github.repository_owner == 'aws'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.11"
steps:
- uses: actions/checkout@v3
# @melasmar
# TODO: Revert back to use 3.7 to all operating systems after the regression issue in Python
# https://github.com/actions/setup-python/issues/682 in github action got resolved
- uses: actions/setup-python@v4
if: matrix.os != 'macos-latest' || ( matrix.os == 'macos-latest' && matrix.python != '3.7' )
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-python@v4
if: matrix.os == 'macos-latest' && matrix.python == '3.7'
with:
python-version: "3.7.16"
- run: test -f "./.github/ISSUE_TEMPLATE/Bug_report.md" # prevent Bug_report.md from being renamed or deleted
- run: make init
- run: make pr
integration-tests:
name: Integration Tests / ${{ matrix.os }} / ${{ matrix.python }} / ${{ matrix.tests_folder }}
if: github.repository_owner == 'aws'
runs-on: ${{ matrix.os }}
env:
AWS_DEFAULT_REGION: us-east-1
SAM_CLI_DEV: "1"
CARGO_LAMBDA_VERSION: 0.17.1
CI: true
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
# folders that is commented below requires credentials, no need to spare time to run them
tests_folder:
- "buildcmd"
#- "delete"
#- "deploy"
- "init"
#- "list"
- "local"
#- "logs"
#- "package"
- "pipeline"
#- "publish"
- "root"
- "scripts"
#- "sync"
- "telemetry"
#- "traces"
#- "validate"
- "docs"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
# set last version as the one in matrix to make it default
python-version: |
3.7
3.8
3.9
3.10
3.11
${{ matrix.python }}
- uses: actions/setup-go@v4
with:
go-version: '1.19'
- uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
# Install and configure Rust
- name: Install rustup
run: |
: install rustup if needed
if ! command -v rustup &> /dev/null ; then
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
fi
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: rustup toolchain install stable
run: rustup toolchain install stable --profile minimal --no-self-update
- run: rustup default stable
- run: |
: disable incremental compilation
echo CARGO_INCREMENTAL=0 >> $GITHUB_ENV
- run: |
: enable colors in Cargo output
echo CARGO_TERM_COLOR=always >> $GITHUB_ENV
# Install and configure Cargo Lambda
- name: Install Cargo Lambda
run: pip install cargo-lambda==$CARGO_LAMBDA_VERSION
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Init samdev
run: make init
- name: Run integration tests for ${{ matrix.tests_folder }}
run: pytest -vv tests/integration/${{ matrix.tests_folder }}
smoke-and-functional-tests:
name: Functional & Smoke Tests / ${{ matrix.os }} / ${{ matrix.python }}
if: github.repository_owner == 'aws'
runs-on: ${{ matrix.os }}
env:
AWS_DEFAULT_REGION: us-east-1
SAM_CLI_DEV: "1"
CARGO_LAMBDA_VERSION: 0.17.1
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.11"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Init samdev
run: make init
- name: Run functional & smoke tests
run: pytest -vv -n 4 tests/functional tests/smoke
docker-disabled:
name: Docker-disabled Tests / ${{ matrix.os }}
if: github.repository_owner == 'aws'
runs-on: ${{ matrix.os }}
env:
SAM_CLI_DEV: "1"
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
# These are the versions of Python that correspond to the supported Lambda runtimes
python-version: |
3.10
3.9
3.8
3.7
- name: Init samdev
run: make init
- name: Stop Docker Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo systemctl stop docker
- name: Stop Docker Windows
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: stop-service docker
- name: Check Docker not Running
run: docker info
id: run-docker-info
continue-on-error: true
- name: Report failure
if: steps.run-docker-info.outcome == 'success'
run: exit 1
- name: Run tests without Docker
run: pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_PythonFunctions_WithoutDocker