-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make docker works for playground, scrapix and meilisearch
- Loading branch information
Showing
86 changed files
with
6,540 additions
and
3,496 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,49 @@ | ||
#!/usr/bin/env bash | ||
# Use: ./wait-for-it.sh host:port [-t timeout] [-- command args] | ||
# From: https://github.com/vishnubob/wait-for-it | ||
|
||
WAITFORIT_cmdname=${0##*/} | ||
|
||
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } | ||
|
||
usage() | ||
{ | ||
cat << USAGE >&2 | ||
Usage: | ||
$WAITFORIT_cmdname host:port [-t timeout] [-- command args] | ||
-h HOST | --host=HOST Host or IP under test | ||
-p PORT | --port=PORT TCP port under test | ||
-t TIMEOUT | --timeout=TIMEOUT Timeout in seconds, zero for no timeout | ||
-- COMMAND ARGS Execute command with args after the test finishes | ||
USAGE | ||
exit 1 | ||
} | ||
|
||
wait_for() | ||
{ | ||
if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then | ||
echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" | ||
else | ||
echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" | ||
fi | ||
WAITFORIT_start_ts=$(date +%s) | ||
while : | ||
do | ||
if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then | ||
nc -z $WAITFORIT_HOST $WAITFORIT_PORT | ||
WAITFORIT_result=$? | ||
else | ||
(echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 | ||
WAITFORIT_result=$? | ||
fi | ||
if [[ $WAITFORIT_result -eq 0 ]]; then | ||
WAITFORIT_end_ts=$(date +%s) | ||
echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
return $WAITFORIT_result | ||
} | ||
|
||
# Rest of the script... |
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,39 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
cache: "yarn" | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Start test environment | ||
run: docker-compose -f docker-compose.test.yml up -d | ||
|
||
- name: Wait for services | ||
run: | | ||
.github/scripts/wait-for-it.sh localhost:7700 -t 60 | ||
.github/scripts/wait-for-it.sh localhost:3000 -t 60 | ||
.github/scripts/wait-for-it.sh localhost:8080 -t 60 | ||
- name: Run tests | ||
run: yarn test:integration | ||
|
||
- name: Cleanup | ||
run: docker-compose -f docker-compose.test.yml down |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json | ||
services: | ||
meilisearch: | ||
image: getmeili/meilisearch:latest | ||
environment: | ||
- MEILI_MASTER_KEY=masterKey | ||
ports: | ||
- "7700:7700" | ||
|
||
playground: | ||
build: | ||
context: ./playground | ||
dockerfile: Dockerfile | ||
ports: | ||
- "3000:3000" | ||
|
||
scraper: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
environment: | ||
- NODE_ENV=test | ||
- REDIS_URL=redis://redis:6379 | ||
ports: | ||
- "8080:8080" | ||
depends_on: | ||
- meilisearch | ||
- playground | ||
|
||
redis: | ||
image: redis:latest | ||
restart: always | ||
ports: | ||
- 6379:6379 | ||
|
||
volumes: | ||
meili_data: |
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 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
testMatch: ["**/tests/integration/**/*.test.ts"], | ||
setupFilesAfterEnv: ["<rootDir>/tests/setup.ts"], | ||
testTimeout: 30000, | ||
}; |
Oops, something went wrong.