-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Earthly Local CI * change test timeout to jest config
- Loading branch information
1 parent
f8942eb
commit 6e163cc
Showing
24 changed files
with
239 additions
and
69 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,7 @@ | ||
--- | ||
'konfig-kill-port': patch | ||
'konfig-cli': patch | ||
'konfig-lib': patch | ||
--- | ||
|
||
Fix kill port in containers |
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 @@ | ||
/node_modules/ | ||
/dist/ |
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,35 @@ | ||
VERSION 0.7 | ||
FROM node:16-slim | ||
WORKDIR /konfig-dash | ||
|
||
build-konfig-dash: | ||
RUN apt-get update | ||
RUN apt-get install -y openssl # not present in node:16-slim but required by prisma | ||
# Copy everything we need to run `yarn` without copying the source code so that dependencies are cached | ||
COPY package.json yarn.lock .yarnrc.yml redwood.toml . | ||
COPY .yarn .yarn | ||
COPY api/package.json api/package.json | ||
COPY web/package.json web/package.json | ||
COPY packages/konfig-cli/package.json packages/konfig-cli/package.json | ||
COPY packages/konfig-kill-port/package.json packages/konfig-kill-port/package.json | ||
COPY packages/konfig-lib/package.json packages/konfig-lib/package.json | ||
COPY packages/konfig-openapi-spec/package.json packages/konfig-openapi-spec/package.json | ||
COPY packages/konfig-postman-to-openapi/package.json packages/konfig-postman-to-openapi/package.json | ||
COPY packages/konfig-release-it/package.json packages/konfig-release-it/package.json | ||
COPY packages/konfig-spectral-ruleset/package.json packages/konfig-spectral-ruleset/package.json | ||
COPY packages/konfig-swagger2openapi/package.json packages/konfig-swagger2openapi/package.json | ||
COPY packages/konfig-typescript-sdk/package.json packages/konfig-typescript-sdk/package.json | ||
COPY packages/konfig-zod-to-openapi/package.json packages/konfig-zod-to-openapi/package.json | ||
RUN --secret NPM_TOKEN yarn | ||
# Now that dependencies are installed, copy the source code and build | ||
COPY api api | ||
COPY web web | ||
COPY packages packages | ||
COPY bash-scripts/build.sh bash-scripts/build.sh | ||
RUN --secret NPM_TOKEN yarn build | ||
|
||
run-konfig-api: | ||
FROM +build-konfig-dash | ||
ENTRYPOINT ["yarn", "rw", "deploy", "render", "api"] | ||
EXPOSE 8911 | ||
SAVE IMAGE konfig-api:latest |
42 changes: 0 additions & 42 deletions
42
...ator/konfig-dash/api/db/dataMigrations/20221121050642-create-dummy-generate-config-row.ts
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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 @@ | ||
VERSION 0.7 | ||
FROM maven:3.8.6-jdk-11-slim | ||
WORKDIR /konfig-generator-api | ||
|
||
build-generator: | ||
COPY src src | ||
COPY pom.xml . | ||
RUN mvn -f pom.xml clean package | ||
SAVE ARTIFACT target/openapi-generator-api-1.0.0.jar | ||
|
||
run-generator: | ||
FROM openjdk:11-jre-slim | ||
COPY +build-generator/openapi-generator-api-1.0.0.jar /usr/local/lib/openapi-generator-api.jar | ||
EXPOSE 8080 | ||
ENTRYPOINT ["java","-jar","/usr/local/lib/openapi-generator-api.jar", "--add-opens=java.base/java.lang=ALL-UNNAMED", "--add-opens=java.base/java.util=ALL-UNNAMED"] | ||
SAVE IMAGE konfig-generator:latest |
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 @@ | ||
generate-id.txt |
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
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,50 @@ | ||
VERSION 0.7 | ||
FROM ../konfig-dash+build-konfig-dash | ||
WORKDIR /konfig-integration-tests | ||
|
||
konfig-test-dependencies: | ||
### NODE comes from base image | ||
### PYTHON | ||
ENV PYTHONDONTWRITEBYTECODE=1 # Don't write .pyc files, which are not needed in a container | ||
ENV PIP_DEFAULT_TIMEOUT=100 | ||
ENV POETRY_VERSION=1.5.1 | ||
|
||
RUN apt-get update | ||
# lsof required for killing mock server after test | ||
RUN apt-get install -y lsof python3 python3-pip | ||
RUN pip3 install poetry==$POETRY_VERSION | ||
# Clean up python installations | ||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
integration-tests: | ||
FROM +konfig-test-dependencies | ||
COPY package.json yarn.lock . | ||
RUN yarn | ||
COPY tsconfig.json jest.config.ts util.ts . | ||
COPY sdks sdks | ||
COPY tests tests | ||
ENTRYPOINT ["yarn", "test", "--no-cache"] # TODO: see if we can speed this up more | ||
SAVE IMAGE konfig-integration-tests:latest | ||
|
||
test: | ||
FROM earthly/dind:alpine | ||
COPY compose/.env . | ||
COPY compose/compose.yaml . | ||
WITH DOCKER \ | ||
--compose compose.yaml \ | ||
--load konfig-python-formatter:latest=../konfig-python-formatter-server-blackd+run-python-formatter \ | ||
--load konfig-generator:latest=../konfig-generator-api+run-generator \ | ||
--load konfig-api:latest=../konfig-dash+run-konfig-api \ | ||
--load konfig-integration-tests:latest=+integration-tests | ||
RUN --secret NPM_TOKEN docker run \ | ||
--network="konfig-network" \ | ||
-e "KONFIG_API_URL=http://konfig-api:8911" \ | ||
-e "NPM_TOKEN=${NPM_TOKEN}" \ | ||
konfig-integration-tests:latest | ||
END | ||
|
||
build-all: | ||
BUILD ../konfig-python-formatter-server-blackd+run-python-formatter | ||
BUILD ../konfig-generator-api+run-generator | ||
BUILD ../konfig-dash+run-konfig-api | ||
BUILD +integration-tests |
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 |
---|---|---|
@@ -1,11 +1,25 @@ | ||
# konfig-integration-tests | ||
|
||
- test SDK directories under `sdks/` | ||
- each map to test under `tests/` | ||
- see `util.ts` for implementation of tests | ||
- test SDK directories under `sdks/` | ||
- each map to test under `tests/` | ||
- see `util.ts` for implementation of tests | ||
|
||
## To run rests | ||
## To run tests | ||
|
||
1. `cd` into `konfig-integration-tests` | ||
2. Run `yarn` | ||
3. Run `yarn test` | ||
|
||
## To run tests using earthly (local) | ||
|
||
1. `cd` into `konfig-integration-tests` | ||
2. Ensure `EARTHLY_SECRETS` env var is set | ||
- EARTHLY_SECRETS: `NPM_TOKEN=xxx` | ||
- This is used during the container building phase for konfig-dash | ||
3. Ensure `compose/.env` file is present and contains the following: | ||
- `NPM_TOKEN`, `SESSION_SECRET`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` | ||
- Each line should be formatted as key=value | ||
- These are passed to docker compose and are used by while running containerized services | ||
4. Run `earthly -P +test` | ||
- `-P` runs earthly in privileged mode (required for earthly image) | ||
- `+test` is the name of the earthly target we are running |
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,48 @@ | ||
version: "3.8" | ||
services: | ||
konfig-api: | ||
image: konfig-api:latest | ||
environment: | ||
# prisma has trouble connecting to postgres from node:16 base image. Adding connect_timeout to url fixes it | ||
# https://stackoverflow.com/questions/68476229/m1-related-prisma-cant-reach-database-server-at-database5432 | ||
DATABASE_URL: postgresql://konfig:konfig@konfig-db:5432/konfig?connect_timeout=300 | ||
SKIP_INSTALL_DEPS: "true" | ||
NODE_VERSION: 16 | ||
GENERATOR_API_HOST_PORT: konfig-generator:8080 | ||
BLACKD_API_HOST_PORT: konfig-python-formatter:10000 | ||
NPM_TOKEN: ${NPM_TOKEN} | ||
SESSION_SECRET: ${SESSION_SECRET} | ||
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} | ||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} | ||
ports: | ||
- "8911:8911" | ||
depends_on: | ||
- konfig-db | ||
|
||
konfig-python-formatter: | ||
image: konfig-python-formatter:latest | ||
ports: | ||
- "10000:10000" | ||
|
||
konfig-generator: | ||
image: konfig-generator:latest | ||
environment: | ||
PORT: 8080 | ||
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} | ||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} | ||
ports: | ||
- "8080:8080" | ||
|
||
konfig-db: | ||
image: postgres | ||
restart: always | ||
environment: | ||
POSTGRES_USER: konfig | ||
POSTGRES_PASSWORD: konfig | ||
ports: | ||
- "5432:5432" | ||
|
||
networks: | ||
default: | ||
name: konfig-network | ||
attachable: true |
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
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
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
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
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
Oops, something went wrong.