Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve make config behaviour #133

Merged
merged 9 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 6 additions & 4 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
nodejs 18.17.1 # Always check AWS and Azure runtime support
python 3.11.4 # Always check AWS and Azure runtime support
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
terraform 1.5.6
pre-commit 3.3.3
terraform 1.5.7
pre-commit 3.4.0

# asdf v0.13.1 0586b37d03031ae8c3110ea2b51cacaad46c7cdc

# ==============================================================================
# The section below is reserved for Docker image versions.
Expand Down
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ Make use of this repository template to expedite your project setup and enhance
- [Table of Contents](#table-of-contents)
- [Setup](#setup)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Testing](#testing)
- [Architecture](#architecture)
- [Diagrams](#diagrams)
- [Configuration](#configuration)
- [Configuration](#configuration-1)
- [Contributing](#contributing)
- [Contacts](#contacts)
- [Licence](#licence)
Expand All @@ -44,12 +44,13 @@ cd nhs-england-tools/repository-template

### Prerequisites

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

- [GNU make](https://www.gnu.org/software/make/) **v3.82 or later: OS X users, take note below**
- [Docker](https://www.docker.com/)
- [GNU make](https://www.gnu.org/software/make/) 3.82 or later (macOS users, please see the note below).
- [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 OS X is earlier than this. You will need to upgrade it, or certain `make` tasks will fail. On OS X, you will need [homebrew](https://brew.sh/) installed, then to install `make`, like so:
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)"
Expand All @@ -59,20 +60,14 @@ 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.

### Installation
### Configuration

Install and configure toolchain dependencies
Installation and configuration of the toolchain dependencies

```shell
make config
```

If this repository is

```shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/org/repo/branch/install.sh)"
```

## Usage

After a successful installation, provide an informative example of how this project can be used. Additional code snippets, screenshots and demos work well in this space. You may also link to the other documentation resources, e.g. the [User Guide](./docs/user-guide.md) to demonstrate more use cases and to show more features.
Expand Down
3 changes: 2 additions & 1 deletion scripts/config/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ repos:
hooks:
- id: check-file-format
name: Check File Format
entry: check=staged-changes./scripts/githooks/check-file-format.sh
entry: ./scripts/githooks/check-file-format.sh
args: ["check=staged-changes"]
language: script
pass_filenames: false
- repo: local
Expand Down
17 changes: 13 additions & 4 deletions scripts/init.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,20 @@ githooks-run: # Run git hooks configured in this repository @Operations
--all-files

asdf-install: # Install asdf @Installation
if [ -d "${HOME}/.asdf" ]; then
( cd "${HOME}/.asdf"; git pull )
else
git clone --depth=1 https://github.com/asdf-vm/asdf.git "${HOME}/.asdf" ||:
asdf_version=$$(grep -E "#\s+asdf\s+v[0-9.]+\s+[a-fA-F0-9]{40}" .tool-versions | awk '{ print $$4 }')
stefaniuk marked this conversation as resolved.
Show resolved Hide resolved
if ! [ -d "${HOME}/.asdf" ] || ! [ -d "${HOME}/.asdf/.git" ]; then
rm -rf "${HOME}/.asdf"
stefaniuk marked this conversation as resolved.
Show resolved Hide resolved
git clone https://github.com/asdf-vm/asdf.git "${HOME}/.asdf" ||:
fi
cd "${HOME}/.asdf"
git checkout master
git pull
git checkout $$asdf_version
stefaniuk marked this conversation as resolved.
Show resolved Hide resolved
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]
Expand Down
1 change: 1 addition & 0 deletions scripts/terraform/terraform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ${VERBOSE}.SILENT: \
terraform-example-provision-aws-infrastructure \
terraform-fmt \
terraform-init \
terraform-install \
terraform-plan \
terraform-shellscript-lint \
terraform-validate \