Skip to content

Commit

Permalink
Merge pull request #1 from getlarge/ci--check-worflow-behaviour
Browse files Browse the repository at this point in the history
ci : check worflow behaviour
  • Loading branch information
getlarge authored Jan 14, 2024
2 parents ae991f8 + 6404953 commit 4e5bf00
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 69 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
main:
runs-on: ubuntu-latest

# services:
# kratos:
# image: oryd/kratos:v1.0.0
# ports:
# - '44330:4433'
# - '44340:4434'

# keto:
# image: oryd/keto:v0.11.1
# ports:
# - '44660:4466'
# - '44670:4467'
services:
kratos:
image: ghcr.io/getlarge/nestjs-ory-integration/kratos:latest
ports:
- '44330:4433'
- '44340:4434'

keto:
image: ghcr.io/getlarge/nestjs-ory-integration/keto:latest
ports:
- '44660:4466'
- '44670:4467'

steps:
- uses: actions/checkout@v4
Expand All @@ -40,8 +40,12 @@ jobs:

- uses: nrwl/nx-set-shas@v4

# This line is needed for nx affected to work when CI is running on a PR
# - run: git branch --track main origin/main
- uses: 8BitJonny/gh-get-current-pr@2.2.0
id: current-pr

- if: steps.current-pr.outputs.number != 'null'
# This line is needed for nx affected to work when CI is running on a PR
run: git branch --track main origin/main

- run: npx nx format:check

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@nx/jest": "17.2.8",
"@nx/js": "17.2.8",
"@nx/nest": "17.2.8",
"@nx/node": "^17.2.8",
"@nx/node": "17.2.8",
"@swc-node/register": "~1.6.7",
"@swc/core": "~1.3.85",
"@types/jest": "^29.4.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/keto-client-wrapper/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
"options": {
"jestConfig": "packages/keto-client-wrapper/jest.config.ts"
}
},
"docker-push": {
"executor": "nx:run-commands",
"options": {
"command": "docker buildx build ./test --platform linux/amd64,linux/arm64 -t ghcr.io/getlarge/nestjs-ory-integration/keto --push",
"cwd": "packages/keto-client-wrapper"
}
}
},
"tags": []
Expand Down
8 changes: 8 additions & 0 deletions packages/keto-client-wrapper/test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM oryd/keto:v0.11.1

COPY ./keto.yaml /home/ory/keto.yaml
COPY ./namespaces.ts /home/ory/namespaces.ts

HEALTHCHECK --interval=3s --timeout=3s --start-period=2s --retries=3 CMD [ 'wget -nv --spider -t1 http://localhost:4466/health/ready || exit 1' ]

CMD ["serve", "--config", "/home/ory/keto.yaml"]
19 changes: 1 addition & 18 deletions packages/keto-client-wrapper/test/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,9 @@ version: '2.7'

services:
keto:
image: oryd/keto:v0.11.1
image: ghcr.io/getlarge/nestjs-ory-integration/keto:latest
ports:
- '44660:4466' # public
- '44670:4467' # admin
command: serve -c /home/ory/keto.yaml
restart: on-failure
healthcheck:
test:
[
'CMD-SHELL',
'wget -nv --spider -t1 http://localhost:4466/health/ready || exit 1',
]
interval: 3s
timeout: 3s
retries: 3
start_period: 2s
volumes:
- type: bind
source: ./keto.yaml
target: /home/ory/keto.yaml
- type: bind
source: ./namespaces.ts
target: /home/ory/namespaces.ts
16 changes: 10 additions & 6 deletions packages/keto-client-wrapper/test/keto-client-wrapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,19 @@ describe('Keto client wrapper E2E', () => {
};

beforeAll(() => {
execSync(`docker-compose -f ${dockerComposeFile} up -d --wait`, {
stdio: 'ignore',
});
if (!process.env['CI']) {
execSync(`docker-compose -f ${dockerComposeFile} up -d --wait`, {
stdio: 'ignore',
});
}
});

afterAll(() => {
execSync(`docker-compose -f ${dockerComposeFile} down`, {
stdio: 'ignore',
});
if (!process.env['CI']) {
execSync(`docker-compose -f ${dockerComposeFile} down`, {
stdio: 'ignore',
});
}
});

beforeEach(async () => {
Expand Down
7 changes: 7 additions & 0 deletions packages/kratos-client-wrapper/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
"options": {
"jestConfig": "packages/kratos-client-wrapper/jest.config.ts"
}
},
"docker-push": {
"executor": "nx:run-commands",
"options": {
"command": "docker buildx build ./test --platform linux/amd64,linux/arm64 -t ghcr.io/getlarge/nestjs-ory-integration/kratos --push",
"cwd": "packages/kratos-client-wrapper"
}
}
},
"tags": []
Expand Down
8 changes: 8 additions & 0 deletions packages/kratos-client-wrapper/test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM oryd/kratos:v1.0.0

COPY ./kratos.yaml /home/ory/kratos.yaml
COPY ./identity.schema.json /home/ory/identity.schema.json

HEALTHCHECK --interval=3s --timeout=3s --start-period=2s --retries=3 CMD [ 'wget -nv --spider -t1 http://localhost:4433/health/ready || exit 1' ]

CMD ["serve", "--config", "/home/ory/kratos.yaml", "--dev", "--watch-courier"]
23 changes: 1 addition & 22 deletions packages/kratos-client-wrapper/test/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,13 @@ networks:

services:
kratos:
image: oryd/kratos:v1.0.0
image: ghcr.io/getlarge/nestjs-ory-integration/kratos:latest
ports:
- '44330:4433' # public
- '44340:4434' # admin
networks:
- ory
restart: unless-stopped
command: serve -c /etc/config/kratos/kratos.yaml --dev --watch-courier
healthcheck:
test:
[
'CMD-SHELL',
'wget -nv --spider -t1 http://localhost:4433/health/ready || exit 1',
]
interval: 2s
timeout: 3s
retries: 3
start_period: 1s
volumes:
- type: bind
source: ./kratos.yaml
target: /etc/config/kratos/kratos.yaml
- type: bind
source: ./identity.schema.json
target: /etc/config/kratos/identity.schema.json
# for docker on linux
# extra_hosts:
# - "host.docker.internal:host-gateway"

mailslurper:
image: oryd/mailslurper:latest-smtps
Expand Down
16 changes: 10 additions & 6 deletions packages/kratos-client-wrapper/test/kratos-client-wrapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,19 @@ describe('Kratos client wrapper E2E', () => {
};

beforeAll(() => {
execSync(`docker-compose -f ${dockerComposeFile} up -d --wait`, {
stdio: 'ignore',
});
if (!process.env['CI']) {
execSync(`docker-compose -f ${dockerComposeFile} up -d --wait`, {
stdio: 'ignore',
});
}
});

afterAll(() => {
execSync(`docker-compose -f ${dockerComposeFile} down`, {
stdio: 'ignore',
});
if (!process.env['CI']) {
execSync(`docker-compose -f ${dockerComposeFile} down`, {
stdio: 'ignore',
});
}
});

beforeEach(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/kratos-client-wrapper/test/kratos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ identity:
default_schema_id: default
schemas:
- id: default
url: file:///etc/config/kratos/identity.schema.json
url: file:///home/ory/identity.schema.json
secrets:
cipher:
- 32-LONG-SECRET-NOT-SECURE-AT-ALL
Expand Down

0 comments on commit 4e5bf00

Please sign in to comment.