Skip to content

Commit 5c6f51d

Browse files
authored
Merge pull request #30 from powerapi-ng/ci-rework
Rework CI
2 parents 701fb43 + 3964535 commit 5c6f51d

File tree

7 files changed

+187
-129
lines changed

7 files changed

+187
-129
lines changed

.github/chglog/CHANGELOG.tpl.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{ range .Versions }}
2+
<a name="{{ .Tag.Name }}"></a>
3+
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
4+
5+
{{ range .CommitGroups -}}
6+
### {{ .Title }}
7+
8+
{{ range .Commits -}}
9+
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ upperFirst .Subject }}
10+
{{ end }}
11+
{{ end -}}
12+
13+
{{- if .RevertCommits -}}
14+
### Reverts
15+
16+
{{ range .RevertCommits -}}
17+
* {{ .Revert.Header }}
18+
{{ end }}
19+
{{ end -}}
20+
21+
{{- if .NoteGroups -}}
22+
{{ range .NoteGroups -}}
23+
### {{ .Title }}
24+
25+
{{ range .Notes }}
26+
{{ upperFirst .Body }}
27+
{{ end }}
28+
{{ end -}}
29+
{{ end -}}
30+
{{ end -}}

.github/chglog/config.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
style: github
2+
template: CHANGELOG.tpl.md
3+
info:
4+
title: CHANGELOG
5+
repository_url: https://github.com/powerapi-ng/hwpc-sensor
6+
options:
7+
commits:
8+
filters:
9+
Type:
10+
- feat
11+
- fix
12+
- perf
13+
- refactor
14+
- style
15+
- docs
16+
- test
17+
- build
18+
- ci
19+
- chore
20+
commit_groups:
21+
title_maps:
22+
feat: Features
23+
fix: Bug Fixes
24+
perf: Performance Improvements
25+
refactor: Code Refactoring
26+
docs: Documentation
27+
test: Tests
28+
build: Build System
29+
ci: Continuous Integration
30+
chore: Miscellaneous Chores
31+
header:
32+
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
33+
pattern_maps:
34+
- Type
35+
- Scope
36+
- Subject
37+
notes:
38+
keywords:
39+
- BREAKING CHANGE

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
labels:
9+
- "dependencies"

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
BUILD_TYPE: Debug
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
compiler: ["gcc", "clang"]
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Install dependencies
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y libczmq-dev libpfm4-dev libmongoc-dev
26+
27+
- name: Configure CMake
28+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=${{matrix.compiler}} -DCMAKE_C_CLANG_TIDY=clang-tidy
29+
30+
- name: Build
31+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
32+

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: [ 'v*.*.*' ]
6+
7+
jobs:
8+
github-release:
9+
name: Publish GitHub release
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
env:
14+
CHGLOG_VERSION: "0.15.4"
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Generate version changelog
22+
run: |
23+
set -euo pipefail
24+
export BASE_URL="https://github.com/git-chglog/git-chglog/releases/download"
25+
export FILENAME="git-chglog_${CHGLOG_VERSION}_linux_amd64.tar.gz"
26+
curl -fsSL "${BASE_URL}/v${CHGLOG_VERSION}/${FILENAME}" |sudo tar xz --no-same-owner -C /usr/local/bin git-chglog
27+
git-chglog --config .github/chglog/config.yml --output CHANGELOG.md "${GITHUB_REF_NAME}"
28+
29+
- name: Create GitHub release
30+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
31+
with:
32+
body_path: CHANGELOG.md
33+
34+
docker-image:
35+
runs-on: ubuntu-latest
36+
needs: github-release
37+
permissions:
38+
contents: read
39+
packages: write
40+
41+
steps:
42+
- name: Setup Docker buildx
43+
uses: docker/setup-buildx-action@16c0bc4a6e6ada2cfd8afd41d22d95379cf7c32a # v2.8.0
44+
45+
- name: Log in to Docker Hub registry
46+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
47+
with:
48+
registry: docker.io
49+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
50+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
51+
52+
- name: Log in to GitHub Container Registry
53+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
54+
with:
55+
registry: ghcr.io
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Extract Docker metadata
60+
id: meta
61+
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
62+
with:
63+
images: |
64+
docker.io/powerapi/hwpc-sensor
65+
ghcr.io/powerapi-ng/hwpc-sensor
66+
tags: |
67+
type=semver,pattern={{version}}
68+
69+
- name: Build and push Docker image
70+
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
71+
with:
72+
push: true
73+
tags: ${{ steps.meta.outputs.tags }}
74+
labels: ${{ steps.meta.outputs.labels }}
75+
build-args: |
76+
BUILD_TYPE=Release
77+

.github/workflows/release_ci.yml

Lines changed: 0 additions & 120 deletions
This file was deleted.

control

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)