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/workflows/test.yml | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/test.yml (limited to '.github/workflows') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f762ce2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,57 @@ +name: Build and Test + +on: [push, pull_request] + +jobs: + test_backend: + name: Build and test backend + runs-on: ubuntu-latest + services: + mongo: + image: mongo:4.4 + ports: + - 27017:27017 + steps: + - uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Install dependencies + run: apt-get install pkg-config libpcap-dev libhyperscan-dev + - name: Test backend + run: go test -v -race -coverprofile=coverage.txt -covermode=atomic + - name: Upload coverage + run: bash <(curl -s https://codecov.io/bash) + build_frontend: + name: Build frontend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 14.x + cache: 'yarn' + - run: cd frontend + - name: Install dependencies + run: yarn install + - name: Build frontend + run: yarn build + test_docker: + name: Build and test docker environment + runs-on: ubuntu-latest + env: + COMPOSE_FILE: .github/docker/docker-compose.yml + steps: + - uses: actions/checkout@v2 + - name: Pull docker images + run: docker-compose pull mongo + - name: Build docker images + run: docker-compose build test + - name: Start MongoDB + run: docker-compose up -d mongo + - name: Run tests + run: docker-compose run test + - name: Destroy containers + run: docker-compose down -- cgit v1.2.3-70-g09d2