Skip to content

Commit

Permalink
Merge pull request #30 from powerapi-ng/ci-rework
Browse files Browse the repository at this point in the history
Rework CI
  • Loading branch information
gfieni authored Jun 29, 2023
2 parents 701fb43 + 3964535 commit 5c6f51d
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 129 deletions.
30 changes: 30 additions & 0 deletions .github/chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})

{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ upperFirst .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ upperFirst .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
39 changes: 39 additions & 0 deletions .github/chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/powerapi-ng/hwpc-sensor
options:
commits:
filters:
Type:
- feat
- fix
- perf
- refactor
- style
- docs
- test
- build
- ci
- chore
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
docs: Documentation
test: Tests
build: Build System
ci: Continuous Integration
chore: Miscellaneous Chores
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "dependencies"
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
BUILD_TYPE: Debug

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: ["gcc", "clang"]

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libczmq-dev libpfm4-dev libmongoc-dev
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=${{matrix.compiler}} -DCMAKE_C_CLANG_TIDY=clang-tidy

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release

on:
push:
tags: [ 'v*.*.*' ]

jobs:
github-release:
name: Publish GitHub release
runs-on: ubuntu-latest
permissions:
contents: write
env:
CHGLOG_VERSION: "0.15.4"

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Generate version changelog
run: |
set -euo pipefail
export BASE_URL="https://github.com/git-chglog/git-chglog/releases/download"
export FILENAME="git-chglog_${CHGLOG_VERSION}_linux_amd64.tar.gz"
curl -fsSL "${BASE_URL}/v${CHGLOG_VERSION}/${FILENAME}" |sudo tar xz --no-same-owner -C /usr/local/bin git-chglog
git-chglog --config .github/chglog/config.yml --output CHANGELOG.md "${GITHUB_REF_NAME}"
- name: Create GitHub release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
with:
body_path: CHANGELOG.md

docker-image:
runs-on: ubuntu-latest
needs: github-release
permissions:
contents: read
packages: write

steps:
- name: Setup Docker buildx
uses: docker/setup-buildx-action@16c0bc4a6e6ada2cfd8afd41d22d95379cf7c32a # v2.8.0

- name: Log in to Docker Hub registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: docker.io
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Log in to GitHub Container Registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
with:
images: |
docker.io/powerapi/hwpc-sensor
ghcr.io/powerapi-ng/hwpc-sensor
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_TYPE=Release
120 changes: 0 additions & 120 deletions .github/workflows/release_ci.yml

This file was deleted.

9 changes: 0 additions & 9 deletions control

This file was deleted.

0 comments on commit 5c6f51d

Please sign in to comment.