Skip to content

Commit

Permalink
chore: set up build and test CI (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
sam authored Jan 18, 2023
1 parent a3b29e2 commit 3e5e439
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Setup
description: "Setup Project"
runs:
using: "composite"
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 6.32.9

- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"

- uses: pnpm/action-setup@v2.2.4
with:
version: 7.13.5

- run: pnpm install --frozen-lockfile
shell: bash

- name: Ensure no changes
run: git diff --exit-code
shell: bash

- name: "Generate"
run: pnpm gen
shell: bash

- name: Build
run: pnpm build
env:
NODE_OPTIONS: --max-old-space-size=6144
shell: bash
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: build
on:
pull_request: {}
workflow_call: {}
jobs:
build:
runs-on: ubuntu-latest
concurrency: build
env:
CI: "true"
CLEAN_UP_STACK: "1"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- name: Run tests
run: pnpm test
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const AWS: SDK = new Proxy({} as any, {
});

export class AWSError extends Error {
readonly type: string;
readonly type?: string;
constructor(error: any) {
super(typeof error?.message === "string" ? error.message : error.__type);
this.type = error.__type;
Expand Down
6 changes: 5 additions & 1 deletion test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ async function createTable() {
await create();
}
} catch (err: any) {
if (err.__type.endsWith("ResourceNotFoundException")) {
console.error(err);
if (
err instanceof AWSError &&
err.type?.endsWith("ResourceNotFoundException")
) {
await create();
} else {
throw err;
Expand Down

0 comments on commit 3e5e439

Please sign in to comment.