Skip to content

Commit 9c2ccda

Browse files
committed
LIME-1864 prefer esbuild over vite for lambda builds
- add example metrics - add example logging - remove vite config - remove makefile - enable experimental decorators in tsconfig - update deploy template to use `esbuild` build method - align GHA with FE
1 parent fbbae1a commit 9c2ccda

18 files changed

Lines changed: 909 additions & 718 deletions
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Node project setup
2+
description: Checkout and install dependencies
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Node setup
8+
uses: actions/setup-node@v6
9+
with:
10+
node-version-file: '.nvmrc'
11+
cache: 'npm'
12+
package-manager-cache: true
13+
14+
- name: Install dependencies
15+
run: npm ci
16+
shell: bash

.github/workflows/check-pr.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/pr-check.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: PR check
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- ready_for_review
9+
- synchronize
10+
11+
jobs:
12+
pre-commit:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Pre-commit checks
16+
uses: govuk-one-login/github-actions/code-quality/run-pre-commit@3b0015c58dd0e19e1572fda59dda4184df387d1e
17+
with:
18+
all-files: true
19+
20+
static-checks:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v6
27+
28+
- name: Setup Node
29+
uses: ./.github/actions/node-setup
30+
31+
- name: Lint
32+
run: npm run lint
33+
34+
- name: Format
35+
run: npm run format
36+
37+
- name: Type check
38+
run: npm run type-check
39+
40+
unit-tests:
41+
runs-on: ubuntu-latest
42+
permissions:
43+
contents: read
44+
needs: static-checks
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v6
48+
with:
49+
fetch-depth: 0 # required for sonar
50+
51+
- name: Setup Node
52+
uses: ./.github/actions/node-setup
53+
54+
- name: Unit tests
55+
run: npm run test:coverage
56+
57+
- name: Sonar scan # runs after unit tests in order to consume coverage report
58+
uses: SonarSource/sonarqube-scan-action@v7.0.0
59+
env:
60+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
61+
62+
merge-status:
63+
runs-on: ubuntu-latest
64+
needs: [pre-commit, static-checks, unit-tests]
65+
if: always()
66+
steps:
67+
- run: |
68+
failed=()
69+
[[ "${{ needs.pre-commit.result }}" != "success" ]] && failed+=("pre-commit")
70+
[[ "${{ needs.static-checks.result }}" != "success" ]] && failed+=("static-checks")
71+
[[ "${{ needs.unit-tests.result }}" != "success" ]] && failed+=("unit-tests")
72+
73+
if [[ ${#failed[@]} -gt 0 ]]; then
74+
echo "The following jobs failed: ${failed[*]}"
75+
exit 1
76+
fi

.github/workflows/run-sonar-scan.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/run-ts-style-check.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/run-unit-tests.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/run-vite-build-check.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
ignore-scripts=true
2+
save-exact=true

Makefile

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ See the Lime onboarding guide for detailed setup instructions.
3030
##### Install dependencies
3131
`npm ci`
3232

33-
### Build
34-
`npm run build`
35-
3633
### Testing
3734

3835
### Run all tests
@@ -63,14 +60,15 @@ To run manually on all files
6360
`npm run lint:fix`
6461

6562
### Formatting
63+
6664
`npm run format`
6765
`npm run format:fix`
6866

6967
## Local Development
7068

71-
The project uses Vite for building and Vitest for testing. All source code is in TypeScript and follows ESLint configuration with Prettier formatting.
69+
The project uses `esbuild` for building and `vitest` for unit testing. All source code is in TypeScript and follows ESLint configuration with Prettier formatting.
7270

73-
The custom Vite build uses a Makefile pattern referenced in `template.yaml` under each Lambda's `Metadata` section and handles TypeScript compilation and dependency bundling. When adding a new lambda the Makefile must be updated too.
71+
`esbuild` config is per handler, is managed in `template.yaml` under each Lambda's `Metadata` section and handles TypeScript compilation and dependency bundling.
7472

7573
### Deployment into Development environment
7674

@@ -90,7 +88,6 @@ To skip canaries such as when releasing urgent changes to production, set the la
9088
Note: To update LambdaDeploymentPreference, update the LambdaCanaryDeployment pipeline parameter in the [identity-common-infra repository](https://github.com/govuk-one-login/identity-common-infra/tree/main/terraform/lime/open-banking). To update the LambdaDeploymentPreference for a stack in dev using sam deploy, parameter override needs to be set in the [deploy script](./deploy.sh).
9189
`--parameter-overrides LambdaDeploymentPreference=<define-strategy> \`
9290

93-
9491
## Parameter prefix
9592

9693
This allows a deploying stack to use parameters of another stack.
@@ -104,7 +101,6 @@ Can also be used with the following limitations in development.
104101
- Existing stack parameters values if changed will trigger behaviour changes in the stack with the prefix enabled.
105102
- Existing stack if deleted will cause errors in the deployed stack.
106103

107-
108104
## Quality Gate Tags
109105

110106
All API tests should be tagged with `@QualityGateIntegrationTest`. If a test runs in our pipelines (ie in Build), and tests live features, we should tag them with `@QualityGateRegressionTest`.

0 commit comments

Comments
 (0)