diff --git a/.copier-answers.yml b/.copier-answers.yml index d25be093..fab9fa40 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.0.16 +_commit: v0.0.19 _src_path: gh:LabAutomationAndScreening/copier-base-template.git description: Copier template for creating Python libraries and executables python_ci_versions: @@ -9,6 +9,7 @@ python_version: 3.12.7 repo_name: copier-python-package-template repo_org_name: LabAutomationAndScreening ssh_port_number: 55874 +template_might_want_to_install_aws_ssm_port_forwarding_plugin: false template_uses_javascript: false template_uses_pulumi: false template_uses_python: true diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 0a78e182..ce301fcb 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.8' services: devcontainer: build: diff --git a/.devcontainer/install-ci-tooling.sh b/.devcontainer/install-ci-tooling.sh index e2cf24db..91284ea7 100644 --- a/.devcontainer/install-ci-tooling.sh +++ b/.devcontainer/install-ci-tooling.sh @@ -4,6 +4,8 @@ set -ex + + curl -LsSf https://astral.sh/uv/0.6.6/install.sh | sh uv --version # TODO: add uv autocompletion to the shell https://docs.astral.sh/uv/getting-started/installation/#shell-autocompletion diff --git a/.github/reusable_workflows/build-docker-image.yaml b/.github/reusable_workflows/build-docker-image.yaml new file mode 100644 index 00000000..58e92db4 --- /dev/null +++ b/.github/reusable_workflows/build-docker-image.yaml @@ -0,0 +1,54 @@ +name: Build Docker Image + +on: + workflow_call: + inputs: + repository: + description: 'Docker repository' + type: string + required: true + image_name: + description: 'Docker image name' + type: string + required: true + tag: + description: 'Docker image tag' + type: string + required: true + context: + description: 'Build context path' + type: string + required: false + default: './' + + +jobs: + build-image: + name: Build Docker Image + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v4.2.2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.10.0 + with: + version: v0.22.0 + + - name: Build Docker Image + uses: docker/build-push-action@v6.15.0 + with: + context: ${{ inputs.context }} + push: false + load: true # make the image available later for the `docker save` step + tags: ${{ inputs.repository }}/${{ inputs.image_name }}:${{ inputs.tag }} + + - name: Save Docker Image as tar + run: docker save -o ${{ inputs.image_name }}.tar ${{ inputs.repository }}/${{ inputs.image_name }}:${{ inputs.tag }} + + - name: Upload Docker Image Artifact + uses: actions/upload-artifact@v4.6.2 + with: + name: ${{ inputs.image_name }} + path: ${{ inputs.image_name }}.tar + if-no-files-found: error diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 087267c7..ba9ddcd9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -175,10 +175,11 @@ repos: hooks: - id: hadolint-docker name: Lint Dockerfiles + exclude: .*\.jinja$ description: Runs hadolint to lint Dockerfiles - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 99abe27a5a16f301d9e0a3828181399dfbf54ebd # frozen: v0.11.0 + rev: 25a8c8da6c24a3b9a1a536e2674683dd0eead5d6 # frozen: v0.11.2 hooks: - id: ruff name: ruff-src @@ -191,7 +192,7 @@ repos: - id: ruff-format - repo: https://github.com/pylint-dev/pylint - rev: 88543500c70e3aa303b6c0861e2a7a006673f6a8 + rev: 7ac5a4d4f77576df3a00e63f86ca86e0e1780b47 # frozen: v3.3.6 hooks: - id: pylint name: pylint diff --git a/extensions/context.py b/extensions/context.py index 58d7256e..b7833d30 100644 --- a/extensions/context.py +++ b/extensions/context.py @@ -34,12 +34,17 @@ def hook(self, context: dict[Any, Any]) -> dict[Any, Any]: context["fastapi_version"] = "0.115.11" context["uvicorn_version"] = "0.34.0" + context["nuxt_ui_version"] = "^3.0.0" + context["nuxt_version"] = "^3.16.0" + context["typescript_version"] = "^5.8.2" + context["gha_checkout"] = "v4.2.2" context["gha_setup_python"] = "v5.4.0" context["gha_cache"] = "v4.2.2" context["gha_upload_artifact"] = "v4.6.2" context["gha_download_artifact"] = "v4.2.1" context["gha_setup_buildx"] = "v3.10.0" + context["buildx_version"] = "v0.22.0" context["gha_docker_build_push"] = "v6.15.0" context["gha_configure_aws_credentials"] = "v4.1.0" context["gha_setup_node"] = "v4.3.0" diff --git a/pytest.ini b/pytest.ini index 7ee31078..74b83a9f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,7 +1,7 @@ [pytest] # Settings managed by the base template norecursedirs = node_modules .precommit_cache .npm_cache .pipenv_cache venv .venv .history -addopts = --cov=src --cov-report html --cov-report term-missing:skip-covered +addopts = --cov=src --cov-report html --cov-report term-missing:skip-covered --cov-config=./.coveragerc log_cli = 1 log_cli_level = INFO diff --git a/template/.devcontainer/devcontainer.json.jinja b/template/.devcontainer/devcontainer.json.jinja index 1eb5127a..97e9b4db 100644 --- a/template/.devcontainer/devcontainer.json.jinja +++ b/template/.devcontainer/devcontainer.json.jinja @@ -41,6 +41,7 @@ {% endraw %}{% if is_child_of_copier_base_template is not defined and template_uses_vuejs is defined and template_uses_vuejs is sameas(true) %}{% raw %} // VueJS "vue.volar@2.2.8", + "vitest.explorer@1.16.1", {% endraw %}{% endif %}{% raw %}{% endraw %}{% if is_child_of_copier_base_template is not defined and template_uses_javascript is defined and template_uses_javascript is sameas(true) %}{% raw %} // All javascript "dbaeumer.vscode-eslint@3.0.13", diff --git a/template/.devcontainer/docker-compose.yml.jinja b/template/.devcontainer/docker-compose.yml.jinja index 1edb2121..33d3d89c 100644 --- a/template/.devcontainer/docker-compose.yml.jinja +++ b/template/.devcontainer/docker-compose.yml.jinja @@ -1,5 +1,4 @@ -{% raw %}version: '3.8' -services: +{% raw %}services: devcontainer: build: context: . diff --git a/template/.devcontainer/install-ci-tooling.sh.jinja b/template/.devcontainer/install-ci-tooling.sh.jinja index 2b6a7286..6204d662 100644 --- a/template/.devcontainer/install-ci-tooling.sh.jinja +++ b/template/.devcontainer/install-ci-tooling.sh.jinja @@ -2,6 +2,13 @@ # can pass in the full major.minor.patch version of python as an optional argument set -ex +{% endraw %}{% if is_child_of_copier_base_template is not defined and install_aws_ssm_port_forwarding_plugin is defined and install_aws_ssm_port_forwarding_plugin is sameas(true) %}{% raw %} +# Based on https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-debian-and-ubuntu.html +# TODO: figure out how to pin this +curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o "/tmp/session-manager-plugin.deb" +sudo dpkg -i /tmp/session-manager-plugin.deb +session-manager-plugin --version{% endraw %}{% endif %}{% raw %} + {% endraw %}{% if template_uses_javascript is defined and template_uses_javascript is sameas(true) %}{% raw %} npm -v npm install -g pnpm@{% endraw %}{{ pnpm_version }}{% raw %} diff --git a/template/.pre-commit-config.yaml b/template/.pre-commit-config.yaml index 087267c7..ba9ddcd9 100644 --- a/template/.pre-commit-config.yaml +++ b/template/.pre-commit-config.yaml @@ -175,10 +175,11 @@ repos: hooks: - id: hadolint-docker name: Lint Dockerfiles + exclude: .*\.jinja$ description: Runs hadolint to lint Dockerfiles - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 99abe27a5a16f301d9e0a3828181399dfbf54ebd # frozen: v0.11.0 + rev: 25a8c8da6c24a3b9a1a536e2674683dd0eead5d6 # frozen: v0.11.2 hooks: - id: ruff name: ruff-src @@ -191,7 +192,7 @@ repos: - id: ruff-format - repo: https://github.com/pylint-dev/pylint - rev: 88543500c70e3aa303b6c0861e2a7a006673f6a8 + rev: 7ac5a4d4f77576df3a00e63f86ca86e0e1780b47 # frozen: v3.3.6 hooks: - id: pylint name: pylint diff --git a/template/pytest.ini b/template/pytest.ini index 7ee31078..74b83a9f 100644 --- a/template/pytest.ini +++ b/template/pytest.ini @@ -1,7 +1,7 @@ [pytest] # Settings managed by the base template norecursedirs = node_modules .precommit_cache .npm_cache .pipenv_cache venv .venv .history -addopts = --cov=src --cov-report html --cov-report term-missing:skip-covered +addopts = --cov=src --cov-report html --cov-report term-missing:skip-covered --cov-config=./.coveragerc log_cli = 1 log_cli_level = INFO diff --git a/tests/copier_data/data1.yaml b/tests/copier_data/data1.yaml index 238b37c3..c69e111e 100644 --- a/tests/copier_data/data1.yaml +++ b/tests/copier_data/data1.yaml @@ -7,6 +7,7 @@ ssh_port_number: 12345 use_windows_in_ci: false + python_package_registry: PyPI aws_identity_center_id: d-9145c20053 aws_org_home_region: us-west-2 diff --git a/tests/copier_data/data2.yaml b/tests/copier_data/data2.yaml index 2519117b..01adcde6 100644 --- a/tests/copier_data/data2.yaml +++ b/tests/copier_data/data2.yaml @@ -7,6 +7,7 @@ ssh_port_number: 54321 use_windows_in_ci: true + python_package_registry: AWS CodeArtifact aws_central_infrastructure_account_id: 012321432543 core_infra_base_access_profile_name: MyAccessRole