Skip to content

Commit cb44579

Browse files
committed
[AEA-0000] initial repo setup
1 parent 31d67f1 commit cb44579

32 files changed

+14700
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
FROM mcr.microsoft.com/devcontainers/base:ubuntu
2+
3+
RUN apt-get update \
4+
&& export DEBIAN_FRONTEND=noninteractive \
5+
&& apt-get -y dist-upgrade \
6+
&& apt-get -y install --no-install-recommends htop vim curl git build-essential \
7+
libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev libbz2-dev \
8+
zlib1g-dev unixodbc unixodbc-dev libsecret-1-0 libsecret-1-dev libsqlite3-dev \
9+
jq apt-transport-https ca-certificates gnupg-agent \
10+
software-properties-common bash-completion python3-pip make libbz2-dev \
11+
libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \
12+
xz-utils tk-dev liblzma-dev netcat libyaml-dev
13+
14+
# install aws stuff
15+
RUN wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" && \
16+
unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
17+
/tmp/aws-cli/aws/install && \
18+
rm tmp/awscliv2.zip && \
19+
rm -rf /tmp/aws-cli
20+
21+
USER vscode
22+
23+
# Install ASDF
24+
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3; \
25+
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc; \
26+
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc; \
27+
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc; \
28+
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc; \
29+
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc;
30+
31+
ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-prescription-tracker-ui/node_modules/.bin"
32+
33+
34+
# Install ASDF plugins
35+
RUN asdf plugin add python; \
36+
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \
37+
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \
38+
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git; \
39+
asdf plugin add direnv; \
40+
asdf plugin add actionlint; \
41+
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
42+
43+
44+
WORKDIR /workspaces/eps-prescription-tracker-ui
45+
ADD .tool-versions /workspaces/eps-prescription-tracker-ui/.tool-versions
46+
ADD .tool-versions /home/vscode/.tool-versions
47+
48+
RUN asdf install; \
49+
asdf reshim python; \
50+
asdf reshim poetry; \
51+
asdf reshim nodejs; \
52+
asdf direnv setup --shell bash --version 2.32.2;

.devcontainer/devcontainer.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
3+
{
4+
"name": "Ubuntu",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"build": {
7+
"dockerfile": "Dockerfile",
8+
"context": "..",
9+
"args": {}
10+
},
11+
"mounts": [
12+
"source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind",
13+
"source=${env:HOME}${env:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind",
14+
"source=${env:HOME}${env:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind",
15+
"source=${env:HOME}${env:USERPROFILE}/.npmrc,target=/home/vscode/.npmrc,type=bind"
16+
],
17+
"features": {
18+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
19+
"version": "latest",
20+
"moby": "true",
21+
"installDockerBuildx": "true"
22+
}
23+
},
24+
"customizations": {
25+
"vscode": {
26+
"extensions": [
27+
"AmazonWebServices.aws-toolkit-vscode",
28+
"redhat.vscode-yaml",
29+
"ms-python.python",
30+
"ms-python.flake8",
31+
"eamodio.gitlens",
32+
"github.vscode-pull-request-github",
33+
"orta.vscode-jest",
34+
"42crunch.vscode-openapi",
35+
"mermade.openapi-lint",
36+
"christian-kohler.npm-intellisense",
37+
"dbaeumer.vscode-eslint",
38+
"lfm.vscode-makefile-term",
39+
"GrapeCity.gc-excelviewer",
40+
"redhat.vscode-xml",
41+
"streetsidesoftware.code-spell-checker",
42+
"timonwong.shellcheck",
43+
"mkhl.direnv",
44+
"github.vscode-github-actions"
45+
],
46+
"settings": {
47+
"python.defaultInterpreterPath": "/workspaces/eps-prescription-tracker-ui/.venv/bin/python",
48+
"python.analysis.autoSearchPaths": true,
49+
"python.analysis.extraPaths": [],
50+
"python.testing.unittestEnabled": false,
51+
"python.testing.pytestEnabled": true,
52+
"pylint.enabled": false,
53+
"python.linting.flake8Enabled": true,
54+
"python.linting.enabled": true, // required to format on save
55+
"editor.formatOnPaste": false, // required
56+
"editor.formatOnType": false, // required
57+
"editor.formatOnSave": true, // optional
58+
"editor.formatOnSaveMode": "file",
59+
"cSpell.words": ["fhir", "Formik", "pino", "serialisation"],
60+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
61+
62+
}
63+
}
64+
},
65+
"postCreateCommand": "rm -f ~/.docker/config.json; git config --global --add safe.directory /workspaces/eps-vpc-resources; make install; direnv allow ."
66+
// "features": {},
67+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
68+
// "forwardPorts": [],
69+
// Use 'postCreateCommand' to run commands after the container is created.
70+
// "postCreateCommand": ""
71+
// Configure tool-specific properties.
72+
// "customizations": {},
73+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
74+
// "remoteUser": "root"
75+
}

.github/dependabot.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#########################################################################
2+
# Dependabot configuration file
3+
#########################################################################
4+
5+
version: 2
6+
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
# Workflow files stored in the
10+
# default location of `.github/workflows`
11+
directory: "/"
12+
schedule:
13+
interval: "daily"
14+
commit-message:
15+
prefix: "Upgrade: [dependabot] - "
16+
17+
###################################
18+
# NPM workspace ##################
19+
###################################
20+
- package-ecosystem: "npm"
21+
directory: "/"
22+
schedule:
23+
interval: "daily"
24+
versioning-strategy: increase
25+
commit-message:
26+
prefix: "Upgrade: [dependabot] - "
27+
28+
###################################
29+
# Poetry #########################
30+
###################################
31+
- package-ecosystem: "pip"
32+
directory: "/"
33+
schedule:
34+
interval: "daily"
35+
versioning-strategy: increase
36+
commit-message:
37+
prefix: "Upgrade: [dependabot] - "

.github/pull_request_template.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## Summary
2+
3+
**Remove items from this list if they are not relevant. Remove this line once this has been done**
4+
5+
- Routine Change
6+
- :exclamation: Breaking Change
7+
- :robot: Operational or Infrastructure Change
8+
- :sparkles: New Feature
9+
- :warning: Potential issues that might be caused by this change
10+
11+
### Details
12+
13+
Add any summary information of what is in the change. **Remove this line if you have nothing to add.**
14+
15+
## Pull Request Naming
16+
17+
Pull requests should be named using the following format:
18+
19+
```text
20+
Tag: [AEA-NNNN] - Short description
21+
```
22+
23+
Tag can be one of:
24+
25+
- `Fix` - for a bug fix. (Patch release)
26+
- `Update` - either for a backwards-compatible enhancement or for a rule change that adds reported problems. (Patch release)
27+
- `New` - implemented a new feature. (Minor release)
28+
- `Breaking` - for a backwards-incompatible enhancement or feature. (Major release)
29+
- `Docs` - changes to documentation only. (Patch release)
30+
- `Build` - changes to build process only. (No release)
31+
- `Upgrade` - for a dependency upgrade. (Patch release)
32+
- `Chore` - for refactoring, adding tests, etc. (anything that isn't user-facing). (Patch release)
33+
34+
If the current release is x.y.z then
35+
- a patch release increases z by 1
36+
- a minor release increases y by 1
37+
- a major release increases x by 1
38+
39+
Correct tagging is necessary for our automated versioning and release process.
40+
41+
The description of your pull request will be used as the commit message for the merge, and also be included in the changelog. Please ensure that your title is sufficiently descriptive.
42+
43+
### Rerunning Checks
44+
45+
If you need to rename your pull request, you can restart the checks by either:
46+
47+
- Closing and reopening the pull request
48+
- pushing an empty commit
49+
```bash
50+
git commit --allow-empty -m 'trigger build'
51+
git push
52+
```
53+
- Amend your last commit and force push to the branch
54+
```bash
55+
git commit --amend --no-edit
56+
git push --force
57+
```
58+
59+
Rerunning the checks from within the pull request will not use the updated title.

.github/workflows/ci.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: merge to main workflow
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
env:
8+
BRANCH_NAME: ${{ github.event.ref.BRANCH_NAME }}
9+
10+
jobs:
11+
quality_checks:
12+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
13+
secrets:
14+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
15+
16+
get_commit_id:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
commit_id: ${{ steps.commit_id.outputs.commit_id }}
20+
steps:
21+
- name: Get Commit ID
22+
id: commit_id
23+
run: |
24+
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
25+
26+
tag_release:
27+
needs: quality_checks
28+
runs-on: ubuntu-latest
29+
outputs:
30+
version_tag: ${{ steps.output_version_tag.outputs.VERSION_TAG }}
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
with:
35+
ref: ${{ env.BRANCH_NAME }}
36+
fetch-depth: 0
37+
38+
# using git commit sha for version of action to ensure we have stable version
39+
- name: Install asdf
40+
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
41+
with:
42+
asdf_branch: v0.14.1
43+
44+
- name: Cache asdf
45+
uses: actions/cache@v4
46+
with:
47+
path: |
48+
~/.asdf
49+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
50+
restore-keys: |
51+
${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
52+
53+
- name: Install asdf dependencies in .tool-versions
54+
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
55+
with:
56+
asdf_branch: v0.14.1
57+
env:
58+
PYTHON_CONFIGURE_OPTS: --enable-shared
59+
60+
- name: Install Dependencies
61+
run: make install
62+
63+
- name: Set VERSION_TAG env var to be short git SHA and get next tag varsion
64+
id: output_version_tag
65+
run: |
66+
VERSION_TAG=$(git rev-parse --short HEAD)
67+
npx semantic-release --dry-run > semantic-release-output.log
68+
NEXT_VERSION=$(grep -i 'The next release version is' semantic-release-output.log | sed -E 's/.* ([[:digit:].]+)$/\1/')
69+
if [ -z "${NEXT_VERSION}" ]
70+
then
71+
echo "Could not get next tag. Here is the log from semantic-release"
72+
cat semantic-release-output.log
73+
exit 1
74+
fi
75+
tagFormat=$(node -e "const config=require('./release.config.js'); console.log(config.tagFormat)")
76+
if [ "${tagFormat}" = "null" ]
77+
then
78+
tagFormat="v\${version}"
79+
fi
80+
# disabling shellcheck as replace does not work
81+
# shellcheck disable=SC2001
82+
NEW_VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/")
83+
echo "## VERSION TAG : ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
84+
echo "## NEXT TAG WILL BE : ${NEW_VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
85+
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT"
86+
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV"
87+
env:
88+
GITHUB_TOKEN: ${{ github.token }}
89+
90+
# package_code:
91+
# needs: [tag_release, get_commit_id]
92+
# uses: ./.github/workflows/cdk_package_code.yml
93+
# with:
94+
# VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
95+
# COMMIT_ID: ${{needs.get_commit_id.outputs.commit_id}}
96+
97+
# release_dev:
98+
# needs: [tag_release, package_code, get_commit_id]
99+
# uses: ./.github/workflows/release_all_stacks.yml
100+
# with:
101+
# SERVICE_NAME: cpt-ui
102+
# TARGET_ENVIRONMENT: dev
103+
# VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
104+
# COMMIT_ID: ${{needs.get_commit_id.outputs.commit_id}}
105+
# secrets:
106+
# CDK_PULL_IMAGE_ROLE: ${{ secrets.DEV_CDK_PULL_IMAGE_ROLE }}
107+
# CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
108+
109+
# create_release_notes:
110+
# needs: [tag_release, package_code, get_commit_id, release_dev]
111+
# uses: ./.github/workflows/create_release_notes.yml
112+
# with:
113+
# VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
114+
# CREATE_INT_RELEASE_NOTES: true
115+
# CREATE_INT_RC_RELEASE_NOTES: false
116+
# CREATE_PROD_RELEASE_NOTES: true
117+
# MARK_JIRA_RELEASED: false
118+
# secrets:
119+
# DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
120+
# DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
121+
# INT_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.INT_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
122+
# PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
123+
124+
125+
# release_qa:
126+
# needs: [tag_release, release_dev, package_code, get_commit_id]
127+
# uses: ./.github/workflows/release_all_stacks.yml
128+
# with:
129+
# SERVICE_NAME: cpt-ui
130+
# TARGET_ENVIRONMENT: qa
131+
# VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
132+
# COMMIT_ID: ${{needs.get_commit_id.outputs.commit_id}}
133+
# secrets:
134+
# CDK_PULL_IMAGE_ROLE: ${{ secrets.QA_CDK_PULL_IMAGE_ROLE }}
135+
# CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.QA_CLOUD_FORMATION_DEPLOY_ROLE }}

0 commit comments

Comments
 (0)