From 520901864877b7be3115e4fa0ee6544c3de2476c Mon Sep 17 00:00:00 2001 From: Emiliano Ciavatta Date: Wed, 28 Jul 2021 10:17:39 +0200 Subject: Add github test workflow --- .github/docker/Dockerfile | 18 ++++++++++++++++++ .github/docker/docker-compose.yml | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .github/docker/Dockerfile create mode 100644 .github/docker/docker-compose.yml (limited to '.github/docker') diff --git a/.github/docker/Dockerfile b/.github/docker/Dockerfile new file mode 100644 index 0000000..1f9f72d --- /dev/null +++ b/.github/docker/Dockerfile @@ -0,0 +1,18 @@ +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/docker-compose.yml b/.github/docker/docker-compose.yml new file mode 100644 index 0000000..393bb41 --- /dev/null +++ b/.github/docker/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3.7" +services: + + mongo: + image: mongo:4.4 + + test: + build: + context: ../../ + dockerfile: .github/docker/Dockerfile + image: caronte-test + depends_on: + - mongo + environment: + MONGO_HOST: mongo + MONGO_PORT: 27017 -- cgit v1.2.3-70-g09d2 From bf6c04e4cc6438dea33a18a1c8bbdfce3876b86f Mon Sep 17 00:00:00 2001 From: Emiliano Ciavatta Date: Wed, 28 Jul 2021 11:50:08 +0200 Subject: Update docker tests --- .github/docker/Dockerfile | 18 ------------------ .github/docker/Dockerfile-backend | 18 ++++++++++++++++++ .github/docker/Dockerfile-frontend | 7 +++++++ .github/docker/docker-compose.yml | 12 +++++++++--- .github/workflows/test.yml | 6 ++++-- frontend/package.json | 5 +---- 6 files changed, 39 insertions(+), 27 deletions(-) delete mode 100644 .github/docker/Dockerfile create mode 100644 .github/docker/Dockerfile-backend create mode 100644 .github/docker/Dockerfile-frontend (limited to '.github/docker') 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" } -- cgit v1.2.3-70-g09d2 From 489ae5c7c65e7f60c3a0e5dc86b1e669e7bf67b5 Mon Sep 17 00:00:00 2001 From: Emiliano Ciavatta Date: Wed, 28 Jul 2021 13:00:36 +0200 Subject: Update test backend dockerfile --- .github/docker/Dockerfile-backend | 5 ++--- Dockerfile | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to '.github/docker') diff --git a/.github/docker/Dockerfile-backend b/.github/docker/Dockerfile-backend index 06036e4..82ed29f 100644 --- a/.github/docker/Dockerfile-backend +++ b/.github/docker/Dockerfile-backend @@ -11,8 +11,7 @@ WORKDIR /caronte COPY . ./ -RUN export VERSION=$(git describe --tags --abbrev=0) && \ - go mod download && \ - go build -ldflags "-X main.Version=$VERSION" +RUN go mod download && \ + go build ENTRYPOINT go test -v -race -covermode=atomic diff --git a/Dockerfile b/Dockerfile index 4fb71a3..0573a6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ WORKDIR /caronte-frontend COPY ./frontend ./ -RUN yarnpkg install && yarnpkg build --production=true +RUN yarn install && yarn build --production=true # LAST STAGE -- cgit v1.2.3-70-g09d2