Github actions (#3299)
* Move CI to github actions Signed-off-by: Jan Fajerski <jfajersk@redhat.com> * Skip email test in github action Signed-off-by: Jan Fajerski <jfajersk@redhat.com> * build before lint Signed-off-by: Jan Fajerski <jfajersk@redhat.com> --------- Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
This commit is contained in:
parent
5a462df83a
commit
b517645d95
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
name: CI
|
||||||
|
on: # yamllint disable-line rule:truthy
|
||||||
|
pull_request:
|
||||||
|
workflow_call:
|
||||||
|
jobs:
|
||||||
|
test_frontend:
|
||||||
|
name: Test alertmanager frontend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- run: make clean
|
||||||
|
- run: make all
|
||||||
|
working-directory: ./ui/app
|
||||||
|
- run: make assets
|
||||||
|
- run: make apiv2
|
||||||
|
- run: git diff --exit-code
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# Whenever the Go version is updated here, .promu.yml
|
||||||
|
# should also be updated.
|
||||||
|
container:
|
||||||
|
image: quay.io/prometheus/golang-builder:1.19-base
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: prometheus/promci@v0.0.2
|
||||||
|
- uses: ./.github/promci/actions/setup_environment
|
||||||
|
- run: make
|
|
@ -0,0 +1,27 @@
|
||||||
|
name: golangci-lint
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "go.sum"
|
||||||
|
- "go.mod"
|
||||||
|
- "**.go"
|
||||||
|
- "scripts/errcheck_excludes.txt"
|
||||||
|
- ".github/workflows/golangci-lint.yml"
|
||||||
|
- ".golangci.yml"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
golangci:
|
||||||
|
name: lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: install Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.19.x
|
||||||
|
- run: make build
|
||||||
|
- name: Lint
|
||||||
|
uses: golangci/golangci-lint-action@v3.4.0
|
||||||
|
with:
|
||||||
|
version: v1.51.2
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: mixin
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "doc/alertmanager-mixin/**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
mixin:
|
||||||
|
name: mixin-lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: install Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.19.x
|
||||||
|
# pin the mixtool version until https://github.com/monitoring-mixins/mixtool/issues/135 is merged.
|
||||||
|
- run: go install github.com/monitoring-mixins/mixtool/cmd/mixtool@2282201396b69055bb0f92f187049027a16d2130
|
||||||
|
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
|
||||||
|
- run: go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
|
||||||
|
- run: make -C doc/alertmanager-mixin lint
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
name: Publish
|
||||||
|
on: # yamllint disable-line rule:truthy
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
name: Run ci
|
||||||
|
uses: ./.github/workflows/ci.yml
|
||||||
|
|
||||||
|
publish_main:
|
||||||
|
name: Publish main branch artefacts
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: ci
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: prometheus/promci@v0.0.2
|
||||||
|
- uses: ./.github/promci/actions/publish_main
|
||||||
|
with:
|
||||||
|
docker_hub_login: ${{ secrets.docker_hub_login }}
|
||||||
|
docker_hub_password: ${{ secrets.docker_hub_password }}
|
||||||
|
quay_io_login: ${{ secrets.quay_io_login }}
|
||||||
|
quay_io_password: ${{ secrets.quay_io_password }}
|
|
@ -0,0 +1,25 @@
|
||||||
|
---
|
||||||
|
name: Release
|
||||||
|
on: # yamllint disable-line rule:truthy
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
name: Run ci
|
||||||
|
uses: ./.github/workflows/ci.yml
|
||||||
|
|
||||||
|
publish_release:
|
||||||
|
name: Publish release arfefacts
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: ci
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: prometheus/promci@v0.0.2
|
||||||
|
- uses: ./.github/promci/actions/publish_release
|
||||||
|
with:
|
||||||
|
docker_hub_login: ${{ secrets.docker_hub_login }}
|
||||||
|
docker_hub_password: ${{ secrets.docker_hub_password }}
|
||||||
|
quay_io_login: ${{ secrets.quay_io_login }}
|
||||||
|
quay_io_password: ${{ secrets.quay_io_password }}
|
||||||
|
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}
|
|
@ -20,3 +20,4 @@
|
||||||
!/.travis.yml
|
!/.travis.yml
|
||||||
!/.promu.yml
|
!/.promu.yml
|
||||||
!/api/v2/openapi.yaml
|
!/api/v2/openapi.yaml
|
||||||
|
!.github/workflows/*.yml
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -78,3 +78,11 @@ clean:
|
||||||
template/email.tmpl \
|
template/email.tmpl \
|
||||||
api/v2/models api/v2/restapi api/v2/client
|
api/v2/models api/v2/restapi api/v2/client
|
||||||
- @cd $(FRONTEND_DIR) && $(MAKE) clean
|
- @cd $(FRONTEND_DIR) && $(MAKE) clean
|
||||||
|
|
||||||
|
# In github actions we skip the email test for now. Service containers in github
|
||||||
|
# actions currently have a bug, see https://github.com/prometheus/alertmanager/pull/3299
|
||||||
|
# So define a test target, that skips the email test for now.
|
||||||
|
.PHONY: test
|
||||||
|
test: $(GOTEST_DIR)
|
||||||
|
@echo ">> running all tests, except notify/email"
|
||||||
|
$(GOTEST) $(test-flags) $(GOOPTS) `go list ./... | grep -v notify/email`
|
||||||
|
|
Loading…
Reference in New Issue