Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

36 changes: 8 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,21 @@ jobs:

- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 24
node-version-file: ".node-version"
cache: "npm"

- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
id: setup-python
with:
python-version: "3.14"
python-version-file: ".python-version"

- name: python - setup dependency cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
- name: python - setup uv
uses: astral-sh/setup-uv@ed21f2f24f8dd64503750218de024bcf64c7250a # v7.1.5
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('requirements.txt') }}
path: .venv
enable-cache: true

- name: python - install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV

- name: python - lint
run: make py-lint

- name: python - test
run: make py-test

- name: npm - install dependencies
run: npm ci

- name: npm - lint
run: make npm-lint

- name: npm - test
run: make npm-test
- name: build and verify
run: make ci

- name: conditionally semantic release
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/update-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,10 @@ jobs:

- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 24
node-version-file: ".node-version"

- name: Install dependencies
run: npm ci

- name: Update CDK and Jest snapshots
run: make snapshots
- name: Build and update snapshots
run: make build

- name: Check for snapshot changes
id: check_changes
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.11.1
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
2 changes: 0 additions & 2 deletions .tool-versions

This file was deleted.

171 changes: 114 additions & 57 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,78 +1,135 @@
VENV = .venv/bin

.PHONY: all
all: install-deps build fmt lint test
all: build

.PHONY: install-deps
install-deps:
@echo "=== Running target: install-deps ==="
npm install --ignore-scripts
python3 -m venv .venv && \
$(VENV)/pip install -r requirements.txt
###########################
# Composite targets
# ###########################

.PHONY: build
build:
@echo "=== Running target: build ==="
npm run build # runs build through prepare-script
build: install lint-fix fmt npm-build snapshots

.PHONY: ci
ci: install lint fmt-check npm-build test

.PHONY: install
install: py-install npm-install

.PHONY: lint
lint: py-lint-check npm-lint-check

.PHONY: lint-fix
lint-fix: py-lint-fix npm-lint-fix

.PHONY: fmt
fmt: py-fmt-fix npm-fmt-fix

.PHONY: fmt-check
fmt-check: py-fmt-check npm-fmt-check

.PHONY: test
test: npm-test py-test
test: py-test npm-test

.PHONY: snapshots
snapshots: npm-test-update

.PHONY: clean
clean: npm-clean py-clean

.PHONY: clean-all
clean-all: npm-clean-all py-clean-all


###########################
# NPM targets
###########################
.PHONY: npm-install
npm-install:
ifeq ($(CI),true)
npm ci
else
npm install --ignore-scripts
endif

.PHONY: npm-build
npm-build:
npm run build

.PHONY: npm-fmt-fix
npm-fmt-fix:
npm run fmt

.PHONY: npm-fmt-check
npm-fmt-check:
npm run fmt:check

.PHONY: npm-upgrade-deps
npm-upgrade-deps:
npm run upgrade-dependencies

.PHONY: npm-biome-migrate
npm-biome-migrate:
npm run biome-migrate

.PHONY: npm-test
npm-test:
@echo "=== Running target: npm-test ==="
npm run test

py-test:
@echo "=== Running target: py-test ==="
TARGET_BUCKET_URL=s3://dummy/web \
EXPIRE_SECONDS=86400 \
DEPLOY_LOG_BUCKET_URL=s3://dummy/deployments.log \
$(VENV)/python -m unittest discover webapp_deploy
.PHONY: npm-test-update
npm-test-update:
npm run test:update

.PHONY: fmt
fmt:
.PHONY: npm-lint-check
npm-lint-check:
npm run lint

.PHONY: npm-lint-fix
npm-lint-fix:
npm run lint:fix
$(VENV)/black webapp_deploy

.PHONY: npm-fmt
npm-fmt:
@echo "=== Running target: npm-fmt ==="
npm run format
.PHONY: npm-clean
npm-clean:
rm -rf dist/ lib/

.PHONY: py-fmt
py-fmt:
@echo "=== Running target: py-fmt ==="
$(VENV)/black webapp_deploy
.PHONY: npm-clean-all
npm-clean-all: npm-clean
rm -rf node_modules/

.PHONY: lint
lint: npm-lint py-lint

.PHONY: npm-lint
npm-lint:
@echo "=== Running target: npm-lint ==="
npm run lint
###########################
## Python targets
###########################
.PHONY: py-install
py-install:
uv sync

.PHONY: py-lint
py-lint:
@echo "=== Running target: py-lint ==="
$(VENV)/flake8 --exclude .venv webapp_deploy
$(VENV)/black --check webapp_deploy
.PHONY: py-lint-check
py-lint-check:
uv run ruff check webapp_deploy

.PHONY: snapshots
snapshots:
@echo "=== Running target: snapshots ==="
npm test -- --updateSnapshot
.PHONY: py-lint-fix
py-lint-fix:
uv run ruff check --fix webapp_deploy

.PHONY: clean
clean:
rm -rf dist/ lib/
.PHONY: py-fmt-fix
py-fmt-fix:
uv run ruff format webapp_deploy

.PHONY: upgrade-deps
upgrade-deps:
@echo "=== Running target: upgrade-deps ==="
npm run upgrade-dependencies
.PHONY: py-fmt-check
py-fmt-check:
uv run ruff format --check webapp_deploy

.PHONY: biome-migrate
biome-migrate:
@echo "=== Running target: biome-migrate ==="
npm run biome-migrate
.PHONY: py-test
py-test:
TARGET_BUCKET_URL=s3://dummy/web \
EXPIRE_SECONDS=86400 \
DEPLOY_LOG_BUCKET_URL=s3://dummy/deployments.log \
uv run python -m unittest discover webapp_deploy

.PHONY: py-clean
py-clean:
uv run ruff clean
uv clean

.PHONY: py-clean-all
py-clean-all: py-clean
rm -rf venv
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,16 @@ aws lambda invoke \
Testing locally:

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
$ uv sync

# Adjust to your project. See config.py for full list.
export TARGET_BUCKET_URL=s3://my-website/web
export EXPIRE_SECONDS=86400
export DEPLOY_LOG_BUCKET_URL=s3://my-website/deployments.log
export CF_DISTRIBUTION_ID=EKJ2IPY1KTEAR1
$ export TARGET_BUCKET_URL=s3://my-website/web
$ export EXPIRE_SECONDS=86400
$ export DEPLOY_LOG_BUCKET_URL=s3://my-website/deployments.log
$ export CF_DISTRIBUTION_ID=EKJ2IPY1KTEAR1

# Adjust artifact path.
python -m webapp_deploy.main s3://my-bucket/my-release.tgz
$ uv run python -m webapp_deploy.main s3://my-bucket/my-release.tgz
```

## Notes
Expand Down
3 changes: 0 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ cp -r webapp_deploy dist/
if [ -e dist/webapp_deploy/__pycache__ ]; then
rm -rf dist/webapp_deploy/__pycache__
fi

# We currently do not install requirements.txt as the
# items are already present in lambda runtime.
5 changes: 5 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[settings]
idiomatic_version_file_enable_tools = ["python", "node"]

[tools]
uv = "0.9.16"
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"build": "./build.sh && tsc",
"watch": "tsc -w",
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
"test:update": "NODE_OPTIONS=--experimental-vm-modules jest --updateSnapshot",
"lint": "biome check",
"lint:fix": "biome check --fix",
"fmt": "biome format --write",
"fmt:check": "biome format",
"prepare": "npm run build && husky",
"semantic-release": "semantic-release",
"upgrade-dependencies": "ncu --upgrade --install always --format group",
Expand Down
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[project]
name = "webapp-deploy-lambda"
version = "0.1.0"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"boto3==1.42.3",
]

[dependency-groups]
dev = [
"ruff>=0.8.6",
]

[tool.ruff]
target-version = "py313"

[tool.ruff.lint]
select = ["B", "C", "E", "F", "W", "B9"]

3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions src/__snapshots__/index.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading