-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.env | ||
.github | ||
build | ||
Dockerfile | ||
docker-compose.yml | ||
node_modules | ||
tmp | ||
*.log | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,3 +131,7 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# lambda build | ||
build/ | ||
build.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.dockerignore | ||
.editorconfig | ||
.env | ||
.eslintrc.yml | ||
.git | ||
.github | ||
.gitignore | ||
.lambdaignore | ||
.prettierignore | ||
.prettierrc.yml | ||
.tool-versions | ||
buildspec.yml | ||
docker-compose.yml | ||
Dockerfile | ||
env-example | ||
/build* | ||
runner.js | ||
/tmp | ||
tsconfig.json | ||
*.test.js | ||
*.log | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Ignore artifacts: | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM public.ecr.aws/lambda/nodejs:20 | ||
|
||
LABEL maintainer="PRX <[email protected]>" | ||
LABEL org.prx.spire.publish.s3="LAMBDA_ZIP" | ||
|
||
WORKDIR /app | ||
|
||
ENTRYPOINT [ "yarn", "run" ] | ||
CMD [ "test" ] | ||
|
||
RUN yum install -y rsync zip tar xz && yum clean all && rm -rf /var/cache/yum | ||
ADD yarn.lock ./ | ||
ADD package.json ./ | ||
RUN yarn install | ||
ADD . . | ||
RUN yarn run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: 0.2 | ||
env: | ||
variables: | ||
PRX_SPIRE_S3_PKG_PARAMETERS: LAMBDA_ZIP=/prx/stag/Spire/Dovetail-CDN_Usage/pkg/s3-object-key | ||
PRX_S3_ARCHIVE_BUILD_PATH: /app/build.zip | ||
exported-variables: | ||
- PRX_SPIRE_S3_PKG_PARAMETERS | ||
- LAMBDA_ZIP | ||
phases: | ||
build: | ||
commands: | ||
- docker-compose build | ||
- docker-compose run test | ||
post_build: | ||
commands: | ||
- curl -sO "https://raw.githubusercontent.com/PRX/Infrastructure/main/ci/utility/post_build.sh" | ||
- chmod +x post_build.sh | ||
- . ./post_build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: "2" | ||
services: | ||
test: | ||
build: . | ||
image: dovetailcdnusage | ||
command: test | ||
volumes: | ||
- ./index.js:/app/index.js | ||
- ./index.test.js:/app/index.test.js | ||
- ./lib:/app/lib | ||
- ./package.json:/app/package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const log = require("lambda-log"); | ||
const index = require("./index"); | ||
|
||
describe("index", () => { | ||
describe("handler", () => { | ||
it("validates dates", async () => { | ||
jest.spyOn(log, "error").mockImplementation(() => null); | ||
|
||
expect(index.handler({ day: "n/a" })).rejects.toThrow(/invalid date/i); | ||
|
||
expect(log.error).toHaveBeenCalledTimes(1); | ||
expect(log.error.mock.calls[0][0]).toMatch(/error running rollups/); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters