Skip to content

Commit

Permalink
Remove asdf installation make target and add it to the dependency list
Browse files Browse the repository at this point in the history
  • Loading branch information
stefaniuk committed Oct 3, 2023
1 parent d17ce5a commit a0eba14
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 63 deletions.
17 changes: 2 additions & 15 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
nodejs 18.18.0 # Always check AWS and Azure runtime support
python 3.11.5 # Always check AWS and Azure runtime support
poetry 1.6.1
yarn 1.22.19
# This file is for you! Edit it to implement your own Terraform make targets.

terraform 1.5.7
pre-commit 3.4.0

# asdf v0.13.1 0586b37d03031ae8c3110ea2b51cacaad46c7cdc

# ==============================================================================
# The section below is reserved for Docker image versions.

# alpine, SEE: https://hub.docker.com/_/alpine/tags
# docker/alpine 3.18.3@sha256:c5c5fda71656f28e49ac9c5416b3643eaa6a108a8093151d6d1afc9463be8e33

# nodejs, SEE: https://hub.docker.com/_/node/tags
# docker/node 18.17.1-alpine3.18@sha256:982b5b6f07cd9241c9ebb163829067deac8eaefc57cfa8f31927f4b18943d971

# python, SEE: https://hub.docker.com/_/python/tags
# docker/python 3.11.4-alpine3.18@sha256:0135ae6442d1269379860b361760ad2cf6ab7c403d21935a8015b48d5bf78a86

# terraform, SEE: https://hub.docker.com/r/hashicorp/terraform/tags
# docker/hashicorp/terraform 1.5.6@sha256:180a7efa983386a27b43657ed610e9deed9e6c3848d54f9ea9b6cb8a5c8c25f5

Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ clean:: # Clean-up project resources (main) @Operations
config:: # Configure development environment (main) @Configuration
# TODO: Use only 'make' targets that are specific to this project, e.g. you may not need to install Node.js
make \
nodejs-install \
python-install \
terraform-install

# ==============================================================================
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ Start with an overview or a brief description of what the project is about and w

Welcome to our repository template designed to streamline your project setup! This robust template provides a reliable starting point for your new projects, covering an essential tech stack and encouraging best practices in documenting.

This repository template aims to foster a user-friendly development environment by ensuring that every included file is concise and adequately self-documented. By adhering to this standard, we can promote increased clarity and maintainability throughout your project's lifecycle. Bundled within this template are resources that pave the way for seamless repository creation. Our supported tech stack includes:
This repository template aims to foster a user-friendly development environment by ensuring that every included file is concise and adequately self-documented. By adhering to this standard, we can promote increased clarity and maintainability throughout your project's lifecycle. Bundled within this template are resources that pave the way for seamless repository creation. Currently supported technologies are:

- Terraform
- Python
- Node.js
- Docker

Make use of this repository template to expedite your project setup and enhance your productivity right from the get-go. Enjoy the advantage of having a well-structured, self-documented project that reduces overhead and increases focus on what truly matters - coding!

Expand All @@ -24,9 +23,9 @@ Make use of this repository template to expedite your project setup and enhance
- [Configuration](#configuration)
- [Usage](#usage)
- [Testing](#testing)
- [Architecture](#architecture)
- [Design](#design)
- [Diagrams](#diagrams)
- [Configuration](#configuration-1)
- [Modularity](#modularity)
- [Contributing](#contributing)
- [Contacts](#contacts)
- [Licence](#licence)
Expand All @@ -46,19 +45,20 @@ cd nhs-england-tools/repository-template

The following software packages, or their equivalents, are expected to be installed:

- [Docker](https://www.docker.com/)
- [GNU make](https://www.gnu.org/software/make/) 3.82 or later (macOS users, please see the note below).
- [docker](https://www.docker.com/) container runtime or a compatible tool, e.g. [podman](https://podman.io/),
- [asdf](https://asdf-vm.com/) version manager,
- [GNU make](https://www.gnu.org/software/make/) 3.82 or later,
- [GNU coreutils](https://www.gnu.org/software/coreutils/) and [GNU binutils](https://www.gnu.org/software/binutils/) may be required to build dependencies like Python, which may need to be compiled during installation. For macOS users, this has been scripted and automated by the `dotfiles` project; please see this [script](https://github.com/nhs-england-tools/dotfiles/blob/main/assets/20-install-base-packages.macos.sh) for details.

Note that the version of GNU Make available by default on macOS is earlier than this. You will need to upgrade it or certain `make` tasks will fail. On macOS, you will need [homebrew](https://brew.sh/) installed, then to install `make`, like so:

```shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install make
```

You will then see instructions to fix your `$PATH` variable to make the newly installed version available.
If you are using [dotfiles](https://github.com/nhs-england-tools/dotfiles), this is all done for you.
> [!NOTE]<br>
> Note that the version of GNU make available by default on macOS is earlier than this. You will need to upgrade it or certain `make` tasks will fail. On macOS, you will need [homebrew](https://brew.sh/) installed, then to install `make`, like so:
>
> ```shell
> /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
> brew install make
> ```
>
> You will then see instructions to fix your `$PATH` variable to make the newly installed version available. If you are using [dotfiles](https://github.com/nhs-england-tools/dotfiles), this is all done for you.
### Configuration
Expand All @@ -76,15 +76,15 @@ After a successful installation, provide an informative example of how this proj

There are `make` tasks for you to configure to run your tests. Run `make test` to see how they work. You should be able to use the same entry points for local development as in your CI pipeline.

## Architecture
## Design

### Diagrams

The [C4 model](https://c4model.com/) is a simple and intuitive way to create software architecture diagrams that are clear, consistent, scalable and most importantly collaborative. This should result in documenting all the system interfaces, external dependencies and integration points.

![Repository Template](./docs/diagrams/Repository_Template_GitHub_Generic.png)

### Configuration
### Modularity

Most of the projects are built with customisability and extendability in mind. At a minimum, this can be achieved by implementing service level configuration options and settings. The intention of this section is to show how this can be used. If the system processes data, you could mention here for example how the input is prepared for testing - anonymised, synthetic or live data.

Expand Down
3 changes: 3 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO

- Decide what to do with the `Docker image versions` section in the `.tool-versions` file
28 changes: 0 additions & 28 deletions scripts/init.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ shellscript-lint-all: # Lint all shell scripts in this project, do not fail on e
file=$${file} scripts/shellscript-linter.sh ||:
done

nodejs-install: # Install Node.js @Installation
make _install-dependency name="nodejs"
make _install-dependency name="yarn" version=latest

python-install: # Install Python @Installation
make _install-dependency name="python"
make _install-dependency name="poetry" version=latest

githooks-config: # Trigger Git hooks on commit that are defined in this repository @Configuration
make _install-dependency name="pre-commit"
pre-commit install \
Expand All @@ -48,22 +40,6 @@ githooks-run: # Run git hooks configured in this repository @Operations
--config scripts/config/pre-commit.yaml \
--all-files

asdf-install: # Install asdf @Installation
asdf_version=$$(grep -E "#\s+asdf\s+v[0-9.]+\s+[a-fA-F0-9]{40}" .tool-versions | awk '{ print $$4 }')
if ! [ -d "${HOME}/.asdf" ]; then
git clone https://github.com/asdf-vm/asdf.git "${HOME}/.asdf" ||:
fi
cd "${HOME}/.asdf"
git checkout master
git pull
git checkout $$asdf_version
printf "\n\033[0m\033[93mPlease, add the following lines to your shell profile, either '~/.zshrc' or '~/.bashrc' file:\033[0m\n\n"
printf "\033[3m\033[93m PATH=\"\$$PATH:\$$HOME/.asdf/shims:\$$HOME/.asdf/bin\"\033[0m\n"
printf "\033[3m\033[93m source \"\$$HOME/.asdf/asdf.sh\"\033[0m\n"
printf "\033[3m\033[93m source \"\$$HOME/.asdf/completions/asdf.bash\"\033[0m\n\n"
printf "\033[0m\033[93mThen re-open your terminal and run this command again if required, i.e. if the next step of the script fails.\033[0m\n\n"
asdf plugin update --all

_install-dependency: # Install asdf dependency - mandatory: name=[listed in the '.tool-versions' file]; optional: version=[if not listed]
asdf plugin add ${name} ||:
asdf install ${name} $(or ${version},)
Expand All @@ -81,7 +57,6 @@ clean:: # Remove all generated and temporary files (common) @Operations

config:: # Configure development environment (common) @Configuration
make \
asdf-install \
githooks-config

help: # Print help @Others
Expand Down Expand Up @@ -166,15 +141,12 @@ HELP_SCRIPT = \

${VERBOSE}.SILENT: \
_install-dependency \
asdf-install \
clean \
config \
githooks-config \
githooks-run \
help \
list-variables \
nodejs-install \
python-install \
runner-act \
shellscript-lint-all \
version-create-effective-file \

0 comments on commit a0eba14

Please sign in to comment.