aboutsummaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/ci.yml
blob: de999efb5a0adc8c1e14688f577e9ca32365a3ac (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI Workflow
on:
  pull_request:
    branches:
    - master

jobs:

  linters:
    name: Linter Check
    runs-on: ubuntu-latest
    steps:
    - name: Set up Go
      uses: actions/setup-go@v1
      with:
        go-version: 1.13
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - name: Checkout
      uses: actions/checkout@v1
      with:
        fetch-depth: 3
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - name: Install linters
      run: |
        cd /tmp && go get -u golang.org/x/lint/golint
        sudo npm install -g jshint
      env:
        GO111MODULE: off
    - name: Run golint
      run: |
        export PATH=/home/runner/go/bin:$PATH
        make lint
    - name: Run jshint
      run: jshint ui/static/js/*.js

  unit-tests:
    name: Unit Tests
    runs-on: ${{ matrix.os }}
    strategy:
      max-parallel: 4
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
        go-version: [1.11, 1.12, 1.13]
    steps:
    - name: Set up Go
      uses: actions/setup-go@v1
      with:
        go-version: ${{ matrix.go-version }}
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - name: Checkout
      uses: actions/checkout@v1
      with:
        fetch-depth: 3
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - name: Run unit tests
      run: make test

  integration-tests:
    name: Integration Tests
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:9.5
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: postgres
        ports:
        - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
    steps:
    - name: Set up Go
      uses: actions/setup-go@v1
      with:
        go-version: 1.13
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - name: Checkout
      uses: actions/checkout@v1
      with:
        fetch-depth: 3
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - name: Install Postgres client
      run: sudo apt-get install -y postgresql-client
    - name: Run integration tests
      run: make integration-test
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        PGHOST: 127.0.0.1
        PGPASSWORD: postgres