diff options
author | Emiliano Ciavatta | 2021-07-28 09:50:08 +0000 |
---|---|---|
committer | Emiliano Ciavatta | 2021-07-28 09:50:08 +0000 |
commit | bf6c04e4cc6438dea33a18a1c8bbdfce3876b86f (patch) | |
tree | b9e28e800e2f2282d67c85ed66aae3eca9d604e6 | |
parent | d10ef21ac4a8d7f865167d783885ed37abe5bd2d (diff) |
Update docker tests
-rw-r--r-- | .github/docker/Dockerfile | 18 | ||||
-rw-r--r-- | .github/docker/Dockerfile-backend | 18 | ||||
-rw-r--r-- | .github/docker/Dockerfile-frontend | 7 | ||||
-rw-r--r-- | .github/docker/docker-compose.yml | 12 | ||||
-rw-r--r-- | .github/workflows/test.yml | 6 | ||||
-rw-r--r-- | frontend/package.json | 5 |
6 files changed, 39 insertions, 27 deletions
diff --git a/.github/docker/Dockerfile b/.github/docker/Dockerfile deleted file mode 100644 index 1f9f72d..0000000 --- a/.github/docker/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM ubuntu:20.04 - -# Install tools and libraries -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -qq golang-1.14 pkg-config libpcap-dev libhyperscan-dev yarnpkg - -COPY ./ /caronte - -WORKDIR /caronte - -RUN ln -sf ../lib/go-1.14/bin/go /usr/bin/go && \ - go mod download && \ - go build && \ - cd frontend && \ - yarnpkg install && \ - yarnpkg build - -CMD go test -v -race -covermode=atomic diff --git a/.github/docker/Dockerfile-backend b/.github/docker/Dockerfile-backend new file mode 100644 index 0000000..06036e4 --- /dev/null +++ b/.github/docker/Dockerfile-backend @@ -0,0 +1,18 @@ +FROM golang:1.16 + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -qq \ + git \ + pkg-config \ + libpcap-dev \ + libhyperscan-dev + +WORKDIR /caronte + +COPY . ./ + +RUN export VERSION=$(git describe --tags --abbrev=0) && \ + go mod download && \ + go build -ldflags "-X main.Version=$VERSION" + +ENTRYPOINT go test -v -race -covermode=atomic diff --git a/.github/docker/Dockerfile-frontend b/.github/docker/Dockerfile-frontend new file mode 100644 index 0000000..5cd82b0 --- /dev/null +++ b/.github/docker/Dockerfile-frontend @@ -0,0 +1,7 @@ +FROM node:16 + +WORKDIR /caronte-frontend + +COPY ./frontend ./ + +RUN yarn install && yarn build diff --git a/.github/docker/docker-compose.yml b/.github/docker/docker-compose.yml index 393bb41..ddaf839 100644 --- a/.github/docker/docker-compose.yml +++ b/.github/docker/docker-compose.yml @@ -4,13 +4,19 @@ services: mongo: image: mongo:4.4 - test: + test-backend: build: context: ../../ - dockerfile: .github/docker/Dockerfile - image: caronte-test + dockerfile: .github/docker/Dockerfile-backend + image: caronte-test-backend depends_on: - mongo environment: MONGO_HOST: mongo MONGO_PORT: 27017 + + test-frontend: + build: + context: ../../ + dockerfile: .github/docker/Dockerfile-frontend + image: caronte-test-frontend diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9f84ef3..96d6a35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,7 +50,9 @@ jobs: run: docker-compose build test - name: Start MongoDB run: docker-compose up -d mongo - - name: Run tests - run: docker-compose run test + - name: Test docker backend + run: docker-compose run test-backend + - name: Test docker frontend + run: docker-compose run test-frontend - name: Destroy containers run: docker-compose down diff --git a/frontend/package.json b/frontend/package.json index 82acb18..2190ebf 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -53,8 +53,5 @@ "last 1 safari version" ] }, - "license": "GPL-3.0", - "resolutions": { - "object-path": "0.11.5" - } + "license": "GPL-3.0" } |