From 7d3413946c9822a6ea8d7bcb5e834cf4bfeae42d Mon Sep 17 00:00:00 2001 From: Guillaume Fieni Date: Wed, 10 May 2023 11:09:46 +0200 Subject: [PATCH 1/6] ci: Remove deprecated release workflow --- .github/workflows/release_ci.yml | 120 ------------------------------- 1 file changed, 120 deletions(-) delete mode 100644 .github/workflows/release_ci.yml diff --git a/.github/workflows/release_ci.yml b/.github/workflows/release_ci.yml deleted file mode 100644 index 2b2bb2e..0000000 --- a/.github/workflows/release_ci.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: Release workflow - -on: - push: - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 -jobs: - check_version: - name: Check sensor version - runs-on: ubuntu-latest - outputs: - version: ${{ steps.step1.outputs.version }} - steps: - - uses: actions/checkout@v2 - - name: Check tag and sensor version - id: step1 - run: | - export VERSION=$(echo $GITHUB_REF | sed -e 's/refs\/tags\/v//g') - test $VERSION == $(grep Version control | cut -d ' ' -f 2) - echo "::set-output name=version::$VERSION" - build: - name: Build binary - needs: check_version - runs-on: ubuntu-latest - container: - image: powerapi/hwpc-sensor-build:latest - steps: - - uses: actions/checkout@v2 - - name: Create environement - run: | - mkdir build - cd build - GIT_TAG=$(git describe --tags --dirty 2>/dev/null || echo "unknown") - GIT_REV=$(git rev-parse HEAD 2>/dev/null || echo "unknown") - - name: Create Makefiles - run: | - cd build - cmake -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_C_CLANG_TIDY="clang-tidy" -DWITH_MONGODB="${MONGODB_SUPPORT}" .. - - name: Build sensor - run: | - cd build - make -j $(getconf _NPROCESSORS_ONLN) - - uses: actions/upload-artifact@v2 - with: - name: binary - path: build/hwpc-sensor - build_docker_image: - name: Build and push docker image - runs-on: ubuntu-latest - needs: [check_version, build] - steps: - - uses: actions/checkout@v2 - - name: Log in to Docker Hub - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - file: Dockerfile - tags: powerapi/hwpc-sensor:latest, powerapi/hwpc-sensor:${{needs.check_version.outputs.version}} - build_deb: - name: Build debian package - needs: [check_version, build] - runs-on: ubuntu-latest - container: - image: powerapi/hwpc-sensor-build:latest - env: - VERSION: ${{needs.check_version.outputs.version}} - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v2 - with: - name: binary - path: ~/bin/ - - name: Create package source - run: | - mkdir -p hwpc-sensor-$VERSION/DEBIAN - cp control hwpc-sensor-$VERSION/DEBIAN/ - mkdir -p hwpc-sensor-$VERSION/usr/bin/ - cp ~/bin/hwpc-sensor hwpc-sensor-$VERSION/usr/bin/hwpc-sensor - chmod +x hwpc-sensor-$VERSION/usr/bin/hwpc-sensor - dpkg-deb --build hwpc-sensor-$VERSION - - uses: actions/upload-artifact@v2 - with: - name: deb_package - path: hwpc-sensor-${{needs.check_version.outputs.version}}.deb - publish_release: - name: Publish release on github - runs-on: ubuntu-latest - needs: [check_version, build_deb] - env: - VERSION: ${{needs.check_version.outputs.version}} - steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v2 - with: - name: binary - path: ~/assets/ - - uses: actions/download-artifact@v2 - with: - name: deb_package - path: ~/assets/ - - name: Create Changelog - env: - CHANGELOG_CONTENT: ${{ steps.changelog.outputs.clean_changelog }} - run: | - sudo apt install -y npm - sudo npm install -g conventional-changelog-cli - conventional-changelog -p angular -r 2 | grep -v "^# \[\]" | sed 's/^#//g' > ~/final-changelog.md - cat ~/final-changelog.md - cat ~/final-changelog.md >> CHANGELOG.md - - name: Create Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release create v$VERSION -d -t v$VERSION -F ~/final-changelog.md ~/assets/* - From cc3b2e9af5228723ef92d928a7772530f10990dd Mon Sep 17 00:00:00 2001 From: Guillaume Fieni Date: Wed, 10 May 2023 14:12:31 +0200 Subject: [PATCH 2/6] ci: Add build/test Github actions workflow --- .github/workflows/build.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..855015c --- /dev/null +++ b/.github/workflows/build.yml @@ -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}} + From 36437df6ef4ae54e56d0f62f3b5b070152dbd6f2 Mon Sep 17 00:00:00 2001 From: Guillaume Fieni Date: Fri, 12 May 2023 07:41:28 +0200 Subject: [PATCH 3/6] ci: Add release Github actions workflow --- .github/workflows/release.yml | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..782bd5e --- /dev/null +++ b/.github/workflows/release.yml @@ -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 + From 15879aff69f527450f21bd37d1e3ac244b616a72 Mon Sep 17 00:00:00 2001 From: Guillaume Fieni Date: Fri, 12 May 2023 07:47:52 +0200 Subject: [PATCH 4/6] build: Remove unused Debian source package control file --- control | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 control diff --git a/control b/control deleted file mode 100644 index 1a6005b..0000000 --- a/control +++ /dev/null @@ -1,9 +0,0 @@ -Package: hwpc-sensor -Version: 1.1.2 -Section: custom -Priority: optional -Architecture: all -Essential: no -Maintainer: powerapi@inria.fr -Depends: libczmq4, libbson-1.0-0 -Description: Software agent (sensor) for monitoring Hardware Performance Counters on Linux From 61d23a3fe764784cd94b39e8d867b34c05a1f695 Mon Sep 17 00:00:00 2001 From: Guillaume Fieni Date: Tue, 16 May 2023 06:16:39 +0200 Subject: [PATCH 5/6] ci: Add git-chglog configuration files --- .github/chglog/CHANGELOG.tpl.md | 30 +++++++++++++++++++++++++ .github/chglog/config.yml | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100755 .github/chglog/CHANGELOG.tpl.md create mode 100755 .github/chglog/config.yml diff --git a/.github/chglog/CHANGELOG.tpl.md b/.github/chglog/CHANGELOG.tpl.md new file mode 100755 index 0000000..52cbcfd --- /dev/null +++ b/.github/chglog/CHANGELOG.tpl.md @@ -0,0 +1,30 @@ +{{ range .Versions }} + +## {{ 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 -}} diff --git a/.github/chglog/config.yml b/.github/chglog/config.yml new file mode 100755 index 0000000..2eb8ff9 --- /dev/null +++ b/.github/chglog/config.yml @@ -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 From 3964535b88e2b4b4a6a507049eabab4c226d6a49 Mon Sep 17 00:00:00 2001 From: Guillaume Fieni Date: Thu, 29 Jun 2023 17:41:24 +0200 Subject: [PATCH 6/6] ci: Add dependabot configuration file --- .github/dependabot.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1771cf1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + labels: + - "dependencies"