Skip to content
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

Chores #396

Closed
wants to merge 5 commits into from
Closed
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
8 changes: 0 additions & 8 deletions .github/dependabot.yml

This file was deleted.

101 changes: 0 additions & 101 deletions .github/workflows/main.yml

This file was deleted.

45 changes: 15 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,23 @@ on:
workflow_run:
branches: [master]
types: [completed]
workflows: [CI]
workflows: [Validate]

jobs:
# Why do we need to build here as well as in the main CI pipeline? Because the actions/download-artifact action
# doesn't allow you to download artifacts from other workflows, despite GitHub pushing that as the recommended
# work-around for Dependabot permissions. See: https://github.com/actions/download-artifact/issues/60
build:
runs-on: ubuntu-latest
name: Build
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
node-version: 20
cache: yarn
- run: yarn install
- run: yarn build
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: build
path: lib
Expand All @@ -39,31 +32,23 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
uses: docker/setup-buildx-action@v3
- uses: actions/setup-node@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
node-version: 20
cache: yarn
- run: yarn install
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: build
path: lib
- name: Login to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: yarn semantic-release
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
password: ${{ secrets.DOCKERHUB_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Validate

on:
push:
branches: [master]
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
name: Lint
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- run: yarn install
- run: yarn lint

unit_test:
runs-on: ubuntu-latest
name: Unit Test
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- run: yarn install
- run: yarn test

smoke_test:
runs-on: ubuntu-latest
name: Smoke Test
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- run: yarn install
- run: scripts/smoke-test

integration_test:
runs-on: ubuntu-latest
name: Integration Test
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- run: yarn install
- run: yarn integration-test
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 18.12.0
nodejs 20.17.0
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine as builder
FROM node:20-alpine AS builder
WORKDIR /app

# dependencies
Expand All @@ -9,15 +9,15 @@ RUN yarn --frozen-lockfile
ADD src src

# bundle
RUN yarn esbuild src/bin/start.ts --outdir=lib --platform=node --target=node14 --bundle
RUN yarn esbuild src/bin/start.ts --outdir=lib --platform=node --target=node20 --bundle

FROM node:14-alpine
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/lib .

# bindings
EXPOSE 9229
ENV HOST 0.0.0.0
ENV PORT 9229
ENV HOST=0.0.0.0
ENV PORT=9229
VOLUME /app/.cognito
ENTRYPOINT ["node", "/app/start.js"]
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cognito Local

![CI](https://github.com/jagregory/cognito-local/workflows/CI/badge.svg)
![CI](https://github.com/lankalana/cognito-local/workflows/CI/badge.svg)

A _Good Enough_ offline emulator for [Amazon Cognito](https://aws.amazon.com/cognito/).

Expand Down Expand Up @@ -220,13 +220,13 @@ cognito-local how to connect to your local Lambda server:

### via Docker

docker run --publish 9229:9229 jagregory/cognito-local:latest
docker run --publish 9229:9229 lankalana/cognito-local:latest

Cognito Local will now be listening on `http://localhost:9229`.

To persist your database between runs, mount the `/app/.cognito` volume to your host machine:

docker run --publish 9229:9229 --volume $(pwd)/.cognito:/app/.cognito jagregory/cognito-local:latest
docker run --publish 9229:9229 --volume $(pwd)/.cognito:/app/.cognito lankalana/cognito-local:latest

### via Node

Expand All @@ -252,12 +252,12 @@ environment variable:
If you're running in Docker, you can also rebind the [published ports](https://docs.docker.com/config/containers/container-networking/#published-ports)
when you run:

`docker run -p4000:9229 jagregory/cognito-local`
`docker run -p4000:9229 lankalana/cognito-local`

Or combine the two approaches by [setting an environment variable](https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file)
when you run:

`docker run -p4000:4000 -e PORT=4000 jagregory/cognito-local`
`docker run -p4000:4000 -e PORT=4000 lankalana/cognito-local`

The same can be done in docker-compose with [environment variables](https://docs.docker.com/compose/environment-variables/#set-environment-variables-in-containers)
and [port binding](https://docs.docker.com/compose/networking/) in compose.
Expand Down
Loading
Loading