Skip to content

Commit 727a24c

Browse files
authored
chore(ci): add GitHub workflow to build+format (#173)
1 parent 63e29c2 commit 727a24c

File tree

7 files changed

+61
-762
lines changed

7 files changed

+61
-762
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: corepack
14+
run: npm i -g corepack
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 20.x
18+
cache: "yarn"
19+
- name: install
20+
run: yarn
21+
- name: format
22+
run: yarn format
23+
- name: build
24+
run: |
25+
yarn cdk synth

package.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,15 @@
77
],
88
"scripts": {
99
"cdk": "cd packages/infra && yarn cdk",
10-
"build:backend": "cd packages/backend && yarn build",
1110
"prepare:frontend": "node packages/scripts/populate-frontend-config.js",
1211
"build:frontend": "cd packages/frontend && yarn build",
13-
"start:frontend": "cd packages/frontend && yarn start"
12+
"start:frontend": "cd packages/frontend && yarn start",
13+
"format": "yarn prettier --check packages/**/*.{ts,js,md}",
14+
"format:fix": "yarn prettier --write packages/**/*.{ts,js,md}"
1415
},
1516
"devDependencies": {
1617
"esbuild": "^0.25.3",
17-
"husky": "^4.2.3",
18-
"lint-staged": "^10.1.2",
1918
"prettier": "2.4.1"
2019
},
21-
"husky": {
22-
"hooks": {
23-
"pre-commit": "lint-staged"
24-
}
25-
},
26-
"lint-staged": {
27-
"*.{ts,js,md}": "prettier --write"
28-
},
2920
"packageManager": "[email protected]"
3021
}

packages/frontend/public/worklets/recording-processor.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ class RecordingProcessor extends AudioWorkletProcessor {
99
this.numberOfChannels = 0;
1010

1111
if (options && options.processorOptions) {
12-
const { numberOfChannels, sampleRate, maxFrameCount } = options.processorOptions;
12+
const { numberOfChannels, sampleRate, maxFrameCount } =
13+
options.processorOptions;
1314

1415
this.sampleRate = sampleRate;
1516
this.maxRecordingFrames = maxFrameCount;
1617
this.numberOfChannels = numberOfChannels;
1718
}
1819

19-
this._recordingBuffer = new Array(this.numberOfChannels).fill(new Float32Array(this.maxRecordingFrames));
20+
this._recordingBuffer = new Array(this.numberOfChannels).fill(
21+
new Float32Array(this.maxRecordingFrames)
22+
);
2023

2124
this.recordedFrames = 0;
2225
this.isRecording = false;
@@ -39,7 +42,8 @@ class RecordingProcessor extends AudioWorkletProcessor {
3942

4043
// Copy data to recording buffer.
4144
if (this.isRecording) {
42-
this._recordingBuffer[channel][sample + this.recordedFrames] = currentSample;
45+
this._recordingBuffer[channel][sample + this.recordedFrames] =
46+
currentSample;
4347
}
4448

4549
// Pass data directly to output, unchanged.

packages/frontend/src/libs/getStreamTranscriptionResponse.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import { fromCognitoIdentityPool } from "@aws-sdk/credential-provider-cognito-id
77
import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity";
88
import { IDENTITY_POOL_ID, REGION } from "../config";
99

10-
const getStreamTranscriptionResponse = (AudioStream: AsyncIterable<AudioStream>) => {
10+
const getStreamTranscriptionResponse = (
11+
AudioStream: AsyncIterable<AudioStream>
12+
) => {
1113
const client = new TranscribeStreamingClient({
1214
region: REGION,
1315
credentials: fromCognitoIdentityPool({

packages/scripts/populate-frontend-config.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ const { join } = require("path");
33
const { readFileSync, writeFileSync, unlinkSync } = require("fs");
44

55
(async () => {
6-
const cdkOutputsFile = join(__dirname, `tmp.${Math.ceil(Math.random() * 10 ** 10)}.json`);
6+
const cdkOutputsFile = join(
7+
__dirname,
8+
`tmp.${Math.ceil(Math.random() * 10 ** 10)}.json`
9+
);
710
const configEnv = join(__dirname, "..", "frontend", ".env");
811

912
try {
10-
const execProcess = exec(`yarn cdk deploy --outputs-file ${cdkOutputsFile}`, {
11-
cwd: join(__dirname, "..", "infra"),
12-
});
13+
const execProcess = exec(
14+
`yarn cdk deploy --outputs-file ${cdkOutputsFile}`,
15+
{
16+
cwd: join(__dirname, "..", "infra"),
17+
}
18+
);
1319
execProcess.stdout.pipe(process.stdout);
1420
execProcess.stderr.pipe(process.stderr);
1521
await new Promise((resolve) => {
@@ -21,7 +27,9 @@ const { readFileSync, writeFileSync, unlinkSync } = require("fs");
2127

2228
// Populate frontend config with data from outputsFile
2329
try {
24-
const cdkOutput = JSON.parse(readFileSync(cdkOutputsFile))["aws-sdk-js-notes-app"];
30+
const cdkOutput = JSON.parse(readFileSync(cdkOutputsFile))[
31+
"aws-sdk-js-notes-app"
32+
];
2533
const config = {
2634
VITE_FILES_BUCKET: cdkOutput.FilesBucket,
2735
VITE_GATEWAY_URL: cdkOutput.GatewayUrl,

prettier.config.js

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

0 commit comments

Comments
 (0)