summaryrefslogtreecommitdiffstats
path: root/.github/workflows/integration-tests.yml
blob: dff8112c568b87132725b21516176b90b9ae5163 (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
name: Integration Tests

on:
  push:
    branches:
      - master
  pull_request: {}
  schedule:
    - cron: '57 3 * * *'

jobs:
  integration-tests:
    strategy:
      fail-fast: false
      matrix:
        database:
          - name: mysql
            pretty_name: MySQL
          - name: pgsql
            pretty_name: PostgreSQL

    name: ${{ matrix.database.pretty_name }}
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: '^1.18'
      - name: Build Icinga DB
        run: go build ./cmd/icingadb
        env:
          CGO_ENABLED: 0
      - name: Build Integration Tests
        run: go test -o ../icingadb-test -c .
        working-directory: tests/
      - name: Run Integration Tests
        run: ./icingadb-test -icingatesting.debuglog debug.log -test.v
        env:
          ICINGADB_TESTS_DATABASE_TYPE: ${{ matrix.database.name }}
          ICINGA_TESTING_ICINGADB_BINARY: ${{ github.workspace }}/icingadb
          ICINGA_TESTING_ICINGADB_SCHEMA_MYSQL: ${{ github.workspace }}/schema/mysql/schema.sql
          ICINGA_TESTING_ICINGADB_SCHEMA_PGSQL: ${{ github.workspace }}/schema/pgsql/schema.sql
      - name: Compress Debug Log
        if: ${{ always() }}
        run: xz -9 debug.log
      - name: Upload Debug Log
        if: ${{ always() }}
        uses: actions/upload-artifact@v2
        with:
          name: ${{ matrix.database.name }}-debug.log.xz
          path: debug.log.xz
          retention-days: 1