Skip to content

Commit

Permalink
ci: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Jul 16, 2023
1 parent e7c485c commit b58dc73
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Start docker-compose
run: docker-compose up -d

- name: Install dependencies
run: npm install

- name: Run tests
run: npm test
run: npm run test:docker

lint:
uses: adonisjs/.github/.github/workflows/lint.yml@main
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:20-alpine as build-deps

RUN apk update && apk upgrade && \
apk add --update git && \
apk add --update openssh && \
apk add --update bash && \
apk add --update wget

ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
RUN chmod +x /wait

WORKDIR /usr/src/app

COPY package*.json ./
RUN npm install

COPY . .
22 changes: 22 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3.4'
services:
tests:
image: adonis-redis
network_mode: host
build:
context: .
environment:
REDIS_HOST: 0.0.0.0
REDIS_PORT: 7007
REDIS_CLUSTER_PORTS: '7000,7001,7002'
WAIT_HOSTS: 0.0.0.0:7000, 0.0.0.0:7001, 0.0.0.0:7002, 0.0.0.0:7003, 0.0.0.0:7004, 0.0.0.0:7005, 0.0.0.0:7006, 0.0.0.0:7007
depends_on:
- redis
command: sh -c "/wait && FORCE_COLOR=true npm run test"
redis:
network_mode: host
image: grokzen/redis-cluster
environment:
REDIS_CLUSTER_IP: 0.0.0.0
IP: 0.0.0.0
STANDALONE: 'true'
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"scripts": {
"pretest": "npm run lint",
"test": "c8 npm run quick:test",
"test:docker": "docker-compose -f docker-compose.ci.yml run --rm tests",
"quick:test": "node --enable-source-maps --loader=ts-node/esm ./bin/test.ts",
"clean": "del-cli build",
"copy:templates": "copyfiles \"stubs/**/**/*.stub\" build",
Expand Down

0 comments on commit b58dc73

Please sign in to comment.