Skip to content

Commit 0dc55b9

Browse files
authored
Merge branch 'develop' into fix-8148
2 parents ce6e323 + c95e0ac commit 0dc55b9

163 files changed

Lines changed: 3310 additions & 1836 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
- uses: actions/setup-python@v6
6969
with:
7070
python-version: ${{ matrix.python }}
71+
- uses: astral-sh/setup-uv@v7
7172
- run: test -f "./.github/ISSUE_TEMPLATE/Bug_report.md" # prevent Bug_report.md from being renamed or deleted
7273
- run: make pr
7374

@@ -171,7 +172,7 @@ jobs:
171172
ruby-version: "3.3"
172173
- uses: actions/setup-node@v6
173174
with:
174-
node-version: 22
175+
node-version: 24
175176
- uses: actions/setup-java@v5
176177
with:
177178
distribution: 'corretto'
@@ -185,18 +186,9 @@ jobs:
185186
with:
186187
dotnet-version: '10.0.x'
187188
# Install and configure Rust & Cargo Lambda
188-
- name: Install and configure Rust & Cargo Lambda
189+
- name: Install Rust toolchain and cargo-lambda
189190
if: ${{ matrix.os == 'ubuntu-latest' }}
190-
run: |
191-
: install rustup if needed
192-
if ! command -v rustup &> /dev/null ; then
193-
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
194-
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
195-
fi
196-
rustup toolchain install stable --profile minimal --no-self-update
197-
rustup default stable
198-
pip install cargo-lambda==$CARGO_LAMBDA_VERSION
199-
echo "$HOME/.local/bin" >> $GITHUB_PATH
191+
run: bash tests/install-rust.sh
200192
- name: Init samdev
201193
run: make init
202194
- name: uv install setuptools in Python3.12

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
analyze:
2525
name: Analyze
26-
if: github.repository_owner == 'aws'
26+
if: github.repository == 'aws/aws-sam-cli'
2727
runs-on: ubuntu-latest
2828
permissions:
2929
actions: read

.github/workflows/integration-tests.yml

Lines changed: 258 additions & 252 deletions
Large diffs are not rendered by default.

.github/workflows/notify-slack.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Slack Notifications
22

33
on:
4-
pull_request:
5-
types: [labeled]
64
issues:
75
types: [opened]
86

@@ -12,17 +10,8 @@ jobs:
1210
permissions:
1311
contents: read
1412
steps:
15-
- name: Send External PR Notification
16-
if: github.event_name == 'pull_request' && github.event.label.name == 'pr/external'
17-
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2
18-
env:
19-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
20-
SLACK_TITLE: 'PR Created: ${{ github.event.pull_request.title }} by ${{ github.event.pull_request.user.login }}'
21-
SLACK_FOOTER: ''
22-
MSG_MINIMAL: true
23-
SLACK_MESSAGE: '${{ github.event.pull_request.html_url }}'
2413
- name: Send New Issue Notification
25-
if: github.event_name == 'issue'
14+
if: github.event_name == 'issues'
2615
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2
2716
env:
2817
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/pr-labeler.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ jobs:
1919
pull-requests: write
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/github-script@v8
22+
- name: Apply internal/external label
23+
id: label_step
24+
uses: actions/github-script@v8
2325
with:
2426
github-token: ${{secrets.GITHUB_TOKEN}}
2527
script: |
@@ -29,19 +31,30 @@ jobs:
2931
'Vandita2020', 'roger-zhangg',
3032
'vicheey', 'bnusunny', 'tobixlea',
3133
'reedham-aws', 'licjun', 'dependabot[bot]'
32-
]
34+
];
3335
if (maintainers.includes(context.payload.sender.login)) {
34-
github.rest.issues.addLabels({
36+
await github.rest.issues.addLabels({
3537
issue_number: context.issue.number,
3638
owner: context.repo.owner,
3739
repo: context.repo.repo,
3840
labels: ['pr/internal']
39-
})
41+
});
42+
core.setOutput("external", "false");
4043
} else {
41-
github.rest.issues.addLabels({
44+
await github.rest.issues.addLabels({
4245
issue_number: context.issue.number,
4346
owner: context.repo.owner,
4447
repo: context.repo.repo,
4548
labels: ['pr/external', 'stage/needs-triage']
46-
})
49+
});
50+
core.setOutput("external", "true");
4751
}
52+
- name: Send Slack Notification for External PR
53+
if: steps.label_step.outputs.external == 'true'
54+
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2
55+
env:
56+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
57+
SLACK_TITLE: 'PR Created: ${{ github.event.pull_request.title }} by ${{ github.event.pull_request.user.login }}'
58+
SLACK_FOOTER: ''
59+
MSG_MINIMAL: true
60+
SLACK_MESSAGE: '${{ github.event.pull_request.html_url }}'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Sync to Mirror Repo"
2+
3+
on:
4+
schedule:
5+
# Run twice daily at 3am and 3pm PST
6+
- cron: '0 11,23 * * *'
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
sync-from-public:
11+
runs-on: ubuntu-latest
12+
if: github.repository != 'aws/aws-sam-cli' # Only run in mirror repo
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Checkout public repo
17+
uses: actions/checkout@v6
18+
with:
19+
repository: aws/aws-sam-cli
20+
ref: develop
21+
fetch-depth: 0
22+
23+
- name: Push to mirror repo
24+
run: |
25+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
26+
git push origin develop:develop --force

.github/workflows/validate_pyinstaller.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
sudo ./sam-installation/install
3333
sam-beta --version
3434
./tests/sanity-check.sh
35-
- uses: actions/upload-artifact@v6
35+
- uses: actions/upload-artifact@v7
3636
with:
3737
name: pyinstaller-linux-zip
3838
path: .build/output/aws-sam-cli-linux-x86_64.zip
@@ -61,7 +61,7 @@ jobs:
6161
sudo ./sam-installation/install
6262
sam-beta --version
6363
./tests/sanity-check.sh
64-
- uses: actions/upload-artifact@v6
64+
- uses: actions/upload-artifact@v7
6565
with:
6666
name: pyinstaller-macos-zip
6767
path: .build/output/aws-sam-cli-macos-x86_64.zip

CONTRIBUTING.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,70 @@ GitHub provides additional document on [forking a repository](https://help.githu
6060
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
6161

6262

63+
## Integration Test Guidelines
64+
65+
Integration tests run in CI via `.github/workflows/integration-tests.yml`. All jobs have AWS credentials. Tests in `build` and `local` jobs that require credentials are separated using a pytest marker.
66+
67+
### Tests that require AWS credentials
68+
69+
Some tests in `tests/integration/buildcmd/` and `tests/integration/local/` need AWS credentials (e.g. STS calls, Lambda layer publishing, SAR template resolution). These are:
70+
71+
- **Excluded** from build/local jobs via `-m "not requires_credential"`
72+
- **Collected and run** in the dedicated `cloud-based-tests` CI job via `-m requires_credential`
73+
74+
To mark a test that requires AWS credentials, add the marker:
75+
76+
```python
77+
import pytest
78+
79+
@pytest.mark.requires_credential
80+
class TestMyCloudFeature(SomeBaseClass):
81+
...
82+
```
83+
84+
The marker is registered in `tests/conftest.py`. Build and local jobs automatically exclude these tests; `cloud-based-tests` automatically includes them.
85+
86+
### Docker container cleanup in parallel tests
87+
88+
`start-api` and `start-lambda` tests run in parallel (`-n 2`). Each test class snapshots existing Docker container IDs before starting its local server, and on teardown only removes containers created after the snapshot. This prevents one worker from killing another worker's containers.
89+
90+
If you write a new base class that manages Docker containers, follow the same pattern in `start_lambda_api_integ_base.py` and `start_api_integ_base.py`: snapshot container IDs in `setUpClass`, and scope removal to only new containers in `tearDownClass`.
91+
92+
### Tier 1 cross-platform smoke tests
93+
94+
A curated subset of ~50 tests marked with `@pytest.mark.tier1` runs on every OS/container-runtime combination (e.g. Linux+Finch). These validate platform-specific code paths: file system operations, container runtime interaction, process spawning, and network operations.
95+
96+
There are two markers:
97+
98+
- `tier1` — standalone tests that don't duplicate any parameterized entry (e.g. a dedicated `test_tier1_*` method calling unique logic)
99+
- `tier1_extra` — dedicated `test_tier1_*` methods whose parameter set already exists in a `@parameterized.expand` list on the same class. These are excluded from normal Linux+Docker CI (via `-m "not tier1_extra"`) to avoid running the same test twice, but included in the tier1 Finch job (via `-m "tier1 or tier1_extra"`).
100+
101+
Run locally with: `pytest -m "tier1 or tier1_extra" tests/integration tests/regression`
102+
103+
To add a tier 1 test for a new feature:
104+
105+
1. Add a dedicated `test_tier1_*` method that calls the existing test logic with one specific parameter set:
106+
107+
```python
108+
@pytest.mark.tier1
109+
def test_tier1_my_feature(self):
110+
"""Single test for cross-platform validation."""
111+
self._test_my_feature("runtime_x", use_container=False)
112+
113+
@pytest.mark.tier1
114+
@skipIf(SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE)
115+
def test_tier1_my_feature_in_container(self):
116+
"""Single container test for cross-platform validation."""
117+
self._test_my_feature("runtime_x", use_container=True)
118+
```
119+
120+
2. If the parameter set already exists in a `@parameterized.expand` list, keep it in the original list and use `@pytest.mark.tier1_extra` instead of `@pytest.mark.tier1` on the dedicated method. This avoids running the same test twice in Linux+Docker CI.
121+
122+
3. If the parameter set does NOT exist in any parameterized list (i.e. it's unique to the tier1 method), use `@pytest.mark.tier1`.
123+
124+
4. Each runtime should have one non-container and one container tier 1 test.
125+
126+
63127
## Finding contributions to work on
64128
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels ((enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/aws/aws-sam-cli/labels/help%20wanted) issues is a great place to start.
65129

Makefile

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,32 @@
22
# environment variable.
33
SAM_CLI_TELEMETRY ?= 0
44

5-
.PHONY: schema
5+
.PHONY: schema init-nightly init-latest-release setup-pytest
66

77
# Initialize environment specifically for Github action tests using uv
88
init:
99
@if [ "$$GITHUB_ACTIONS" = "true" ]; then \
10-
pip install uv==0.9.1 && SAM_CLI_DEV=1 uv pip install --system -e '.[dev]'; \
10+
command -v uv >/dev/null 2>&1 || pip install uv==0.9.1; \
11+
SAM_CLI_DEV=1 uv pip install --system -e '.[dev]'; \
1112
else \
1213
SAM_CLI_DEV=1 pip install -e '.[dev]'; \
1314
fi
1415

16+
# Set up a pytest venv with test dependencies
17+
setup-pytest:
18+
python3.11 -m venv $(HOME)/pytest
19+
uv pip install --python $(HOME)/pytest/bin/python3 -r requirements/dev.txt -r requirements/base.txt
20+
sudo ln -sf $(HOME)/pytest/bin/pytest /usr/local/bin/pytest
21+
pytest --version
22+
23+
# Install SAM CLI nightly binary
24+
init-nightly:
25+
bash tests/install-sam-cli-binary.sh sam-cli-nightly
26+
27+
# Install SAM CLI latest release binary
28+
init-latest-release:
29+
bash tests/install-sam-cli-binary.sh
30+
1531
test:
1632
# Run unit tests and fail if coverage falls below 94%
1733
pytest --cov samcli --cov schema --cov-report term-missing --cov-fail-under 94 tests/unit
@@ -51,7 +67,11 @@ black:
5167
black setup.py samcli tests schema
5268

5369
black-check:
54-
black --check setup.py samcli tests schema
70+
@if python -c "import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)" 2>/dev/null; then \
71+
black --check setup.py samcli tests schema; \
72+
else \
73+
echo "Skipping black check on Python < 3.10"; \
74+
fi
5575

5676
format: black
5777
ruff check samcli --fix

installer/pyinstaller/build-linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if [ "$openssl_version" = "" ]; then
2020
fi
2121

2222
if [ "$zlib_version" = "" ]; then
23-
zlib_version="1.3.1";
23+
zlib_version="1.3.2";
2424
fi
2525

2626
if [ "$CI_OVERRIDE" = "1" ]; then

0 commit comments

Comments
 (0)