Skip to content

Commit

Permalink
feat: update configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Dec 4, 2023
1 parent d199586 commit 234f06d
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 27 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
52 changes: 25 additions & 27 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,58 @@
---
name: ci
name: test
on:
- push
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --enable-all --timeout=30m

test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21
- run: docker-compose up -d
go-version: "1.21"
- run: go test -v ./... -covermode=atomic -coverprofile=coverage.out
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v3.1.4
with:
files: coverage.out

docker:
name: docker
runs-on: ubuntu-latest
needs:
- lint
- test
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v3
id: meta
- uses: docker/bake-action@v4
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
TAG: ${{ github.ref_name }}
with:
images: ghcr.io/snapp-incubator/mqtt-blackbox-exporter
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/build-push-action@v2
push: true
files: 'build/package/docker-bake.json'
- uses: docker/bake-action@v4
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
with:
file: "build/package/Dockerfile"
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
files: 'build/package/docker-bake.json'
58 changes: 58 additions & 0 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: helm
on:
- push

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: set up helm
uses: azure/setup-helm@v3
with:
version: v3.13.0

- uses: actions/setup-python@v4
with:
python-version: 3.7

- name: set up chart-testing
uses: helm/[email protected]

- name: run chart-testing (lint)
run: ct lint --all

- name: create kind cluster
uses: helm/[email protected]

- name: run chart-testing (install)
run: ct install --all

release:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: checkout
uses: actions/checkout@v4

- name: set up helm
uses: azure/setup-helm@v3
with:
version: v3.13.0

- name: login to github container registry using helm
run: |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io/snapp-incubator/mqtt-blackbox-exporter --username ${{ github.repository_owner }} --password-stdin
- name: package mqtt-blackbox-exporter helm chart
run: |
version=${{ github.ref_name }}
helm package --version "${version##v}" --app-version "${version}" ./charts/mqtt-blackbox-exporter
- name: publish mqtt-blackbox-exporter chart to github container registry
run: |
version=${{ github.ref_name }}
helm push "soteria-${version##v}".tgz oci://ghcr.io/snapp-incubator/mqtt-blackbox-exporter-chart
22 changes: 22 additions & 0 deletions build/package/docker-bake.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"group": {
"default": {
"targets": [
"soteria"
]
}
},
"variable": {
"TAG": {
"default": "latest"
}
},
"target": {
"soteria": {
"dockerfile": "build/package/Dockerfile",
"tags": [
"ghcr.io/snapp-incubator/mqtt-blackbox-exporter:${TAG}"
]
}
}
}

0 comments on commit 234f06d

Please sign in to comment.