Skip to content

Commit 4c1b37a

Browse files
alexcpopgillespied
andauthored
feature: Ci/cd orchestrator (#8)
* add ci/cd orchestrator for cdk apps * update branch name from main to prod * bump pyproject version * integrate ci/cd workflow template into dependencies list and init scaffolding --------- Co-authored-by: David Gillespie <david.gillespie@digital.cabinet-office.gov.uk>
1 parent 1587224 commit 4c1b37a

File tree

6 files changed

+60
-3
lines changed

6 files changed

+60
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "gds-idea-app-kit"
7-
version = "0.2.2"
7+
version = "0.2.3"
88
description = "CLI tool for scaffolding and maintaining GDS IDEA web apps on AWS"
99
readme = "README.md"
1010
requires-python = ">=3.11"

src/gds_idea_app_kit/init.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ def run_init(framework: str, app_name: str, python_version: str) -> None:
278278
variables=template_vars,
279279
)
280280

281+
# -- Copy CI/CD workflow --
282+
_copy_template(
283+
templates / "common" / "ci_cd_cdk_app.yml",
284+
project_dir / ".github" / "workflows" / "ci_cd_cdk_app.yml",
285+
)
286+
281287
# -- Copy .devcontainer/ files --
282288
_copy_template(
283289
templates / "common" / "devcontainer.json",

src/gds_idea_app_kit/manifest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# Files that `update` manages, keyed by source location in the templates directory.
1717
# The dict maps template source path -> destination path in the project.
1818
TOOL_OWNED_FILES = {
19+
"common/ci_cd_cdk_app.yml": ".github/workflows/ci_cd_cdk_app.yml",
1920
"common/devcontainer.json": ".devcontainer/devcontainer.json",
2021
"common/docker-compose.yml": ".devcontainer/docker-compose.yml",
2122
"dev_mocks/dev_mock_authoriser.json": "dev_mocks/dev_mock_authoriser.json",
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI/CD Orchestrator for CDK Apps
2+
3+
on:
4+
push:
5+
branches:
6+
- prod
7+
- dev
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
pull-requests: write
13+
14+
jobs:
15+
ci_pr_dev:
16+
uses: co-cddo/gds-idea-workflows-catalogue/.github/workflows/ci_pr_dev.yml@main
17+
with:
18+
run-version-check: false
19+
20+
ci_build:
21+
uses: co-cddo/gds-idea-workflows-catalogue/.github/workflows/ci_build.yml@main
22+
with:
23+
run-version-check: false
24+
25+
ci_pyproject_version:
26+
uses: co-cddo/gds-idea-workflows-catalogue/.github/workflows/ci_pyproject_version.yml@main
27+
with:
28+
run-version-check: false
29+
30+
ci_lint:
31+
uses: co-cddo/gds-idea-workflows-catalogue/.github/workflows/ci_lint.yml@main
32+
with:
33+
run-version-check: false
34+
35+
ci_tests:
36+
uses: co-cddo/gds-idea-workflows-catalogue/.github/workflows/ci_tests.yml@main
37+
with:
38+
run-version-check: false
39+
40+
ci_cdk_diff:
41+
uses: co-cddo/gds-idea-workflows-catalogue/.github/workflows/ci_cdk_diff.yml@main
42+
with:
43+
run-version-check: false
44+
45+
cd:
46+
needs: [ci_pr_dev, ci_build, ci_pyproject_version, ci_lint, ci_tests, ci_cdk_diff]
47+
uses: co-cddo/gds-idea-workflows-catalogue/.github/workflows/cd_workflow_cdk.yml@main

tests/test_manifest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def tracked_project(project_dir):
3131
(project_dir / ".devcontainer").mkdir()
3232
(project_dir / ".devcontainer" / "devcontainer.json").write_text("{}")
3333
(project_dir / ".devcontainer" / "docker-compose.yml").write_text("services:")
34+
(project_dir / ".github" / "workflows").mkdir(parents=True)
35+
(project_dir / ".github" / "workflows" / "ci_cd_cdk_app.yml").write_text("name: CI/CD")
3436
(project_dir / "dev_mocks").mkdir()
3537
(project_dir / "dev_mocks" / "dev_mock_authoriser.json").write_text("{}")
3638
(project_dir / "dev_mocks" / "dev_mock_user.json").write_text("{}")
@@ -84,6 +86,7 @@ def test_hash_file_binary(tmp_path):
8486
def test_tracked_files_include_common_destinations(framework):
8587
tracked = get_tracked_files(framework)
8688
destinations = set(tracked.values())
89+
assert ".github/workflows/ci_cd_cdk_app.yml" in destinations
8790
assert ".devcontainer/devcontainer.json" in destinations
8891
assert ".devcontainer/docker-compose.yml" in destinations
8992
assert "dev_mocks/dev_mock_authoriser.json" in destinations
@@ -174,7 +177,7 @@ def test_build_manifest_hashes_all_tracked_files(tracked_project):
174177
assert result["framework"] == "streamlit"
175178
assert result["app_name"] == "test-app"
176179
assert result["tool_version"] == "0.1.0"
177-
assert len(result["files"]) == 5
180+
assert len(result["files"]) == 6
178181
for file_hash in result["files"].values():
179182
assert file_hash.startswith("sha256:")
180183

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)