summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:40:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:40:59 +0000
commitbc4e624732bd51c0dd1e9529cf228e8c23127732 (patch)
treed95dab8960e9d02d3b95f8653074ad2e54ca207c /.github
parentInitial commit. (diff)
downloadicingadb-bc4e624732bd51c0dd1e9529cf228e8c23127732.tar.xz
icingadb-bc4e624732bd51c0dd1e9529cf228e8c23127732.zip
Adding upstream version 1.1.1.upstream/1.1.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.github')
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md37
-rw-r--r--.github/ISSUE_TEMPLATE/config.yml5
-rw-r--r--.github/ISSUE_TEMPLATE/release.md19
-rw-r--r--.github/dependabot.yml12
-rw-r--r--.github/workflows/compliance.yml21
-rwxr-xr-x.github/workflows/compliance/anonymize-license.pl11
-rwxr-xr-x.github/workflows/compliance/check-licenses.sh72
-rwxr-xr-x.github/workflows/compliance/ls-deps.pl24
-rw-r--r--.github/workflows/docker.yml33
-rw-r--r--.github/workflows/go.yml109
-rw-r--r--.github/workflows/integration-tests.yml56
-rw-r--r--.github/workflows/sql.yml59
12 files changed, 458 insertions, 0 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..706315d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,37 @@
+---
+name: Bug Report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+## Describe the bug
+
+A clear and concise description of what the bug is.
+
+## To Reproduce
+
+Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include configuration, logs, etc. to reproduce, if relevant.
+
+1.
+2.
+3.
+4.
+
+## Expected behavior
+
+A clear and concise description of what you expected to happen.
+
+## Your Environment
+
+Include as many relevant details about the environment you experienced the problem in
+
+* Icinga DB version:
+* Icinga 2 version:
+* Operating System and version:
+
+## Additional context
+
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..d93658f
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,5 @@
+blank_issues_enabled: true
+contact_links:
+ - name: Ask a question
+ url: https://community.icinga.com/c/icinga-db/14
+ about: Ask a question in our community forum
diff --git a/.github/ISSUE_TEMPLATE/release.md b/.github/ISSUE_TEMPLATE/release.md
new file mode 100644
index 0000000..f5625ba
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/release.md
@@ -0,0 +1,19 @@
+---
+name: '[INTERNAL] Release'
+about: Release a version
+title: 'Release Version v$version'
+labels: ''
+assignees: ''
+
+---
+
+# Release Workflow
+
+- [ ] Check that the `.mailmap` and `AUTHORS` files are up to date
+- [ ] Update `internal/version.go`
+- [ ] Update `CHANGELOG.md`
+- [ ] Create and push a signed tag for the version
+- [ ] Build packages
+- [ ] Create release on GitHub
+- [ ] Update public docs
+- [ ] Announce release
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..3395774
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,12 @@
+version: 2
+updates:
+- package-ecosystem: gomod
+ directory: "/"
+ schedule:
+ interval: weekly
+ time: '10:00'
+ open-pull-requests-limit: 10
+ reviewers:
+ - Al2Klimov
+ - julianbrost
+ - lippserd
diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml
new file mode 100644
index 0000000..f808f38
--- /dev/null
+++ b/.github/workflows/compliance.yml
@@ -0,0 +1,21 @@
+name: Compliance
+on:
+ push:
+ branches:
+ - main
+ - 'support/*'
+ pull_request: {}
+
+jobs:
+ licenses:
+ runs-on: ubuntu-latest
+ steps:
+ - run: sudo apt install -y moreutils
+
+ - uses: actions/setup-go@v4
+ with:
+ go-version: 1.x
+
+ - uses: actions/checkout@v2
+
+ - run: .github/workflows/compliance/check-licenses.sh
diff --git a/.github/workflows/compliance/anonymize-license.pl b/.github/workflows/compliance/anonymize-license.pl
new file mode 100755
index 0000000..573eba6
--- /dev/null
+++ b/.github/workflows/compliance/anonymize-license.pl
@@ -0,0 +1,11 @@
+#!/usr/bin/perl -pi
+
+use warnings;
+use strict;
+use autodie qw(:all);
+
+if (/^ ?(?:\w+ )?Copyright / || /^All rights reserved\.$/ || /^(?:The )?\S+ License(?: \(.+?\))?$/ || /^$/) {
+ $_ = ""
+}
+
+s/Google Inc\./the copyright holder/g
diff --git a/.github/workflows/compliance/check-licenses.sh b/.github/workflows/compliance/check-licenses.sh
new file mode 100755
index 0000000..63ff76f
--- /dev/null
+++ b/.github/workflows/compliance/check-licenses.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+set -eo pipefail
+
+find_license_file() {
+ MOD_NAME="$1"
+ LICENSE_DIR="vendor/$MOD_NAME"
+ LICENSE_FILES=({,../}{,UN}LICENSE{,.txt,.md})
+
+ for LICENSE_FILE in "${LICENSE_FILES[@]}"; do
+ LICENSE_FILE="${LICENSE_DIR}/$LICENSE_FILE"
+
+ if [ -e "$LICENSE_FILE" ]; then
+ echo "$LICENSE_FILE"
+ return
+ fi
+ done
+
+ echo "Module ${MOD_NAME}: license file missing in ${LICENSE_DIR}. Tried:" "${LICENSE_FILES[@]}" >&2
+ false
+}
+
+list_all_deps() {
+ for MAIN_MOD in ./cmd/*; do
+ go list -deps "$MAIN_MOD"
+ done
+}
+
+COMPATIBLE_LINE=$(($LINENO + 2))
+
+COMPATIBLE=(
+ # public domain
+ 3cee2c43614ad4572d9d594c81b9348cf45ed5ac # vendor/github.com/vbauerster/mpb/v6/UNLICENSE
+ # MIT
+ 66d504eb2f162b9cbf11b07506eeed90c6edabe1 # vendor/github.com/cespare/xxhash/v2/LICENSE.txt
+ 1513ff663e946fdcadb630bed670d253b8b22e1e # vendor/github.com/davecgh/go-spew/spew/../LICENSE
+ 90a1030e6314df9a898e5bfbdb4c6176d0a1f81c # vendor/github.com/jmoiron/sqlx/LICENSE
+ # BSD-2
+ 8762249b76928cb6995b98a95a9396c5aaf104f3 # vendor/github.com/go-redis/redis/v8/LICENSE
+ d550c89174b585d03dc67203952b38372b4ce254 # vendor/github.com/pkg/errors/LICENSE
+ # BSD-3
+ b23b967bba92ea3c5ccde9962027cd70400865eb # vendor/github.com/google/uuid/LICENSE
+ 604b38b184689a3db06a0617216d52a95aea10d8 # vendor/github.com/pmezard/go-difflib/difflib/../LICENSE
+ # MPLv2
+ 0a2b84dd9b124c4d95dd24418c3e84fd870cc0ac # vendor/github.com/go-sql-driver/mysql/LICENSE
+)
+
+MY_DIR="$(dirname "$0")"
+
+go mod vendor
+
+for MOD_NAME in $(list_all_deps | "${MY_DIR}/ls-deps.pl"); do
+ LICENSE_FILE="$(find_license_file "$MOD_NAME")"
+
+ "${MY_DIR}/anonymize-license.pl" "$LICENSE_FILE"
+ tr -d ., <"$LICENSE_FILE" | tr \\n\\t ' ' | sponge "$LICENSE_FILE"
+ perl -p0 -i -e 's/ +/ /g; s/ +$//; $_ = lc' "$LICENSE_FILE"
+
+ for SHA1 in "${COMPATIBLE[@]}"; do
+ if sha1sum -c <<<"$SHA1 $LICENSE_FILE" >/dev/null 2>&1; then
+ continue 2
+ fi
+ done
+
+ echo "Module ${MOD_NAME}: unknown license. Run 'go mod vendor' (or see below), verify by yourself whether" \
+ "$LICENSE_FILE is GPLv2 compatible and (if yes) update the license text hashes list at ${0}:$COMPATIBLE_LINE" \
+ "and eventually .github/workflows/compliance/anonymize-license.pl:7" >&2
+
+ sha1sum "$LICENSE_FILE"
+ head "$LICENSE_FILE"
+ false
+done
diff --git a/.github/workflows/compliance/ls-deps.pl b/.github/workflows/compliance/ls-deps.pl
new file mode 100755
index 0000000..a7a033a
--- /dev/null
+++ b/.github/workflows/compliance/ls-deps.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use autodie qw(:all);
+
+my @mods = <>;
+chomp @mods;
+s~^vendor/~~ for @mods;
+
+@mods = grep m~^[^./]+\.~, @mods;
+@mods = grep !m~^golang\.org/x(?:/|$)~, @mods;
+@mods = grep !m~^github\.com/icinga/icingadb(?:/|$)~, @mods;
+@mods = sort @mods;
+
+my $lastMod = undef;
+
+for (@mods) {
+ # prefixed with last mod (e.g. "go.uber.org/zap/buffer" after "go.uber.org/zap"), so redundant
+ next if defined($lastMod) && /$lastMod/;
+
+ $lastMod = '^' . quotemeta("$_/");
+ print "$_\n"
+}
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 0000000..9291c75
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,33 @@
+name: Docker image
+
+on:
+ pull_request: {}
+ push:
+ branches:
+ - main
+ - 'support/*'
+ release:
+ types:
+ - published
+
+jobs:
+ docker-release:
+ if: github.event_name == 'release'
+ concurrency: docker-release
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Docker image
+ uses: Icinga/docker-icingadb@master
+ with:
+ dockerhub-token: '${{ secrets.DOCKER_HUB_PERSONAL_TOKEN }}'
+
+ docker:
+ if: github.event_name != 'release'
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Docker image
+ uses: Icinga/docker-icingadb@master
+ with:
+ dockerhub-token: '${{ secrets.DOCKER_HUB_PERSONAL_TOKEN }}'
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
new file mode 100644
index 0000000..f18f8db
--- /dev/null
+++ b/.github/workflows/go.yml
@@ -0,0 +1,109 @@
+name: Go
+on:
+ push:
+ branches:
+ - main
+ - 'support/*'
+ pull_request: {}
+
+jobs:
+ build-test:
+
+ strategy:
+ matrix:
+ os: [ macos-latest, ubuntu-latest ]
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-go@v4
+ with:
+ go-version: 1.x
+
+ - run: go build -gcflags="-m" ./...
+
+ - run: go test -v -race ./...
+
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-go@v4
+ with:
+ go-version: 1.x
+
+ - uses: dominikh/staticcheck-action@29e9b80fb8de0521ba4ed3fdf68fed5bbe82a2d2 # v1.1.0
+ with:
+ install-go: false
+
+ vet:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-go@v4
+ with:
+ go-version: 1.x
+
+ - run: go vet ./...
+
+ fmt:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-go@v4
+ with:
+ go-version: 1.x
+
+ - name: Run gofmt -d .
+ run: |
+ fmtvar="$(gofmt -d .)"
+ echo "$fmtvar"
+ test -z "$fmtvar"
+
+ modtidy:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-go@v4
+ with:
+ go-version: 1.x
+
+ - name: Run go mod tidy
+ run: |
+ go mod tidy
+ gitdiff="$(git diff -U0)"
+ echo "$gitdiff"
+ test -z "$gitdiff"
+
+ vendor-diff:
+ if: github.event_name == 'pull_request'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/setup-go@v4
+ with:
+ go-version: 1.x
+
+ - name: Checkout base commit
+ uses: actions/checkout@v3
+ with:
+ path: a
+ ref: ${{ github.base_ref }}
+ - name: Download dependencies of base commit
+ run: go mod vendor
+ working-directory: a
+
+ - name: Checkout PR
+ uses: actions/checkout@v3
+ with:
+ path: b
+ - name: Download dependencies of PR
+ run: go mod vendor
+ working-directory: b
+
+ - name: Diff of dependencies
+ run: diff -ur --color=always a/vendor b/vendor || true
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
new file mode 100644
index 0000000..812b118
--- /dev/null
+++ b/.github/workflows/integration-tests.yml
@@ -0,0 +1,56 @@
+name: Integration Tests
+
+on:
+ push:
+ branches:
+ - main
+ - 'support/*'
+ 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@v4
+ with:
+ go-version: 1.x
+ - 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
diff --git a/.github/workflows/sql.yml b/.github/workflows/sql.yml
new file mode 100644
index 0000000..9314545
--- /dev/null
+++ b/.github/workflows/sql.yml
@@ -0,0 +1,59 @@
+name: SQL
+
+on:
+ push:
+ branches:
+ - main
+ - 'support/*'
+ pull_request: {}
+
+jobs:
+ sql:
+ name: ${{ matrix.database.name }}
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ database:
+ - {type: MYSQL, name: MySQL 5.5, image: "icinga/icingadb-mysql:5.5"}
+ - {type: MYSQL, name: MySQL 5.6, image: "icinga/icingadb-mysql:5.6"}
+ - {type: MYSQL, name: MySQL 5.7, image: "mysql:5.7"}
+ - {type: MYSQL, name: MySQL latest, image: "mysql:latest"}
+ - {type: MYSQL, name: MariaDB 10.1, image: "mariadb:10.1"}
+ - {type: MYSQL, name: MariaDB 10.2, image: "mariadb:10.2"}
+ - {type: MYSQL, name: MariaDB 10.3, image: "mariadb:10.3"}
+ - {type: MYSQL, name: MariaDB 10.4, image: "mariadb:10.4"}
+ - {type: MYSQL, name: MariaDB 10.5, image: "mariadb:10.5"}
+ - {type: MYSQL, name: MariaDB 10.6, image: "mariadb:10.6"}
+ - {type: MYSQL, name: MariaDB 10.7, image: "mariadb:10.7"}
+ - {type: MYSQL, name: MariaDB latest, image: "mariadb:latest"}
+ - {type: PGSQL, name: PostgreSQL 9.6, image: "postgres:9.6"}
+ - {type: PGSQL, name: PostgreSQL 10, image: "postgres:10"}
+ - {type: PGSQL, name: PostgreSQL 11, image: "postgres:11"}
+ - {type: PGSQL, name: PostgreSQL 12, image: "postgres:12"}
+ - {type: PGSQL, name: PostgreSQL 13, image: "postgres:13"}
+ - {type: PGSQL, name: PostgreSQL latest, image: "postgres:latest"}
+
+ steps:
+ - name: Setup Go
+ uses: actions/setup-go@v4
+ with:
+ go-version: 1.x
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Download dependencies
+ run: go get -v -t -d ./...
+ working-directory: tests/
+
+ - name: Run tests
+ env:
+ ICINGADB_TESTS_DATABASE_TYPE: ${{ matrix.database.type }}
+ ICINGA_TESTING_${{ matrix.database.type }}_IMAGE: ${{ matrix.database.image }}
+ ICINGA_TESTING_ICINGADB_SCHEMA_MYSQL: ${{ github.workspace }}/schema/mysql/schema.sql
+ ICINGA_TESTING_ICINGADB_SCHEMA_PGSQL: ${{ github.workspace }}/schema/pgsql/schema.sql
+ timeout-minutes: 10
+ run: go test -v -timeout 5m ./sql
+ working-directory: tests/