aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/test.yml
blob: 9f84ef383aef2d93eb19ab2892184d1126c9ba66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: 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: sudo 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
    defaults:
      run:
        working-directory: frontend
    steps:
      - uses: actions/checkout@v2
      - name: Set up Node.js
        uses: actions/setup-node@v2
        with:
          node-version: 14.x
      - 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