Skip to content

chore(ci): add GitHub workflow to build+format #173

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

Merged
merged 7 commits into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: ci

on:
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: corepack
run: npm i -g corepack
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "yarn"
- name: install
run: yarn
- name: format
run: yarn format
- name: build
run: |
yarn cdk synth
15 changes: 3 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,15 @@
],
"scripts": {
"cdk": "cd packages/infra && yarn cdk",
"build:backend": "cd packages/backend && yarn build",
"prepare:frontend": "node packages/scripts/populate-frontend-config.js",
"build:frontend": "cd packages/frontend && yarn build",
"start:frontend": "cd packages/frontend && yarn start"
"start:frontend": "cd packages/frontend && yarn start",
"format": "yarn prettier --check packages/**/*.{ts,js,md}",
"format:fix": "yarn prettier --write packages/**/*.{ts,js,md}"
},
"devDependencies": {
"esbuild": "^0.25.3",
"husky": "^4.2.3",
"lint-staged": "^10.1.2",
"prettier": "2.4.1"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,js,md}": "prettier --write"
},
"packageManager": "[email protected]"
}
10 changes: 7 additions & 3 deletions packages/frontend/public/worklets/recording-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ class RecordingProcessor extends AudioWorkletProcessor {
this.numberOfChannels = 0;

if (options && options.processorOptions) {
const { numberOfChannels, sampleRate, maxFrameCount } = options.processorOptions;
const { numberOfChannels, sampleRate, maxFrameCount } =
options.processorOptions;

this.sampleRate = sampleRate;
this.maxRecordingFrames = maxFrameCount;
this.numberOfChannels = numberOfChannels;
}

this._recordingBuffer = new Array(this.numberOfChannels).fill(new Float32Array(this.maxRecordingFrames));
this._recordingBuffer = new Array(this.numberOfChannels).fill(
new Float32Array(this.maxRecordingFrames)
);

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

// Copy data to recording buffer.
if (this.isRecording) {
this._recordingBuffer[channel][sample + this.recordedFrames] = currentSample;
this._recordingBuffer[channel][sample + this.recordedFrames] =
currentSample;
}

// Pass data directly to output, unchanged.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { fromCognitoIdentityPool } from "@aws-sdk/credential-provider-cognito-id
import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity";
import { IDENTITY_POOL_ID, REGION } from "../config";

const getStreamTranscriptionResponse = (AudioStream: AsyncIterable<AudioStream>) => {
const getStreamTranscriptionResponse = (
AudioStream: AsyncIterable<AudioStream>
) => {
const client = new TranscribeStreamingClient({
region: REGION,
credentials: fromCognitoIdentityPool({
Expand Down
18 changes: 13 additions & 5 deletions packages/scripts/populate-frontend-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ const { join } = require("path");
const { readFileSync, writeFileSync, unlinkSync } = require("fs");

(async () => {
const cdkOutputsFile = join(__dirname, `tmp.${Math.ceil(Math.random() * 10 ** 10)}.json`);
const cdkOutputsFile = join(
__dirname,
`tmp.${Math.ceil(Math.random() * 10 ** 10)}.json`
);
const configEnv = join(__dirname, "..", "frontend", ".env");

try {
const execProcess = exec(`yarn cdk deploy --outputs-file ${cdkOutputsFile}`, {
cwd: join(__dirname, "..", "infra"),
});
const execProcess = exec(
`yarn cdk deploy --outputs-file ${cdkOutputsFile}`,
{
cwd: join(__dirname, "..", "infra"),
}
);
execProcess.stdout.pipe(process.stdout);
execProcess.stderr.pipe(process.stderr);
await new Promise((resolve) => {
Expand All @@ -21,7 +27,9 @@ const { readFileSync, writeFileSync, unlinkSync } = require("fs");

// Populate frontend config with data from outputsFile
try {
const cdkOutput = JSON.parse(readFileSync(cdkOutputsFile))["aws-sdk-js-notes-app"];
const cdkOutput = JSON.parse(readFileSync(cdkOutputsFile))[
"aws-sdk-js-notes-app"
];
const config = {
VITE_FILES_BUCKET: cdkOutput.FilesBucket,
VITE_GATEWAY_URL: cdkOutput.GatewayUrl,
Expand Down
4 changes: 0 additions & 4 deletions prettier.config.js

This file was deleted.

Loading