This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lauric Desauw
committed
Oct 12, 2021
1 parent
c085699
commit 147e0d5
Showing
13 changed files
with
1,008 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[flake8] | ||
max-line-length = 160 | ||
ignore = W504, F401 | ||
exclude = powerapi/test_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
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_pypi: | ||
name: Push package on pypi | ||
runs-on: ubuntu-latest | ||
env: | ||
PYPI_PASS: ${{ secrets.PYPI_PASS }} | ||
needs: check_release | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Prepare environement | ||
run: pip install -U pip twine | ||
- name: Init .pypirc | ||
run: | | ||
echo -e "[pypi]" >> ~/.pypirc | ||
echo -e "username = powerapi" >> ~/.pypirc | ||
echo -e "password = $PYPI_PASS" >> ~/.pypirc | ||
- name: Generate package | ||
run: | | ||
python3 -m venv venv | ||
. venv/bin/activate | ||
python3 -m pip install wheel | ||
python3 setup.py sdist bdist_wheel | ||
- name: Upload to pypi | ||
run: twine upload dist/* | ||
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/procfs-sensor:latest, powerapi/procfs-sensor:${{needs.check_version.outputs.version}} | ||
build_deb: | ||
name: Build debian package | ||
needs: [check_version, build] | ||
runs-on: ubuntu-latest | ||
container: | ||
image: powerapi/procfs-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 procfs-sensor-$VERSION/DEBIAN | ||
cp control procfs-sensor-$VERSION/DEBIAN/ | ||
mkdir -p procfs-sensor-$VERSION/usr/bin/ | ||
cp ~/bin/procfs-sensor procfs-sensor-$VERSION/usr/bin/procfs-sensor | ||
chmod +x procfs-sensor-$VERSION/usr/bin/procfs-sensor | ||
dpkg-deb --build procfs-sensor-$VERSION | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: deb_package | ||
path: procfs-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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
### Emacs ### | ||
*~ | ||
\#*\# | ||
/.emacs.desktop | ||
/.emacs.desktop.lock | ||
*.elc | ||
auto-save-list | ||
tramp | ||
.\#* | ||
|
||
# Org-mode | ||
.org-id-locations | ||
*_archive | ||
|
||
# flymake-mode | ||
*_flymake.* | ||
|
||
# eshell files | ||
/eshell/history | ||
/eshell/lastdir | ||
|
||
# elpa packages | ||
/elpa/ | ||
|
||
# reftex files | ||
*.rel | ||
|
||
# AUCTeX auto folder | ||
/auto/ | ||
|
||
# cask packages | ||
.cask/ | ||
dist/ | ||
|
||
# Flycheck | ||
flycheck_*.el | ||
|
||
# server auth directory | ||
/server/ | ||
|
||
# projectiles files | ||
.projectile | ||
|
||
# directory configuration | ||
.dir-locals.el | ||
|
||
# network security | ||
/network-security.data | ||
|
||
### Vim ### | ||
# Swap | ||
[._]*.s[a-v][a-z] | ||
[._]*.sw[a-p] | ||
[._]s[a-rt-v][a-z] | ||
[._]ss[a-gi-z] | ||
[._]sw[a-p] | ||
|
||
# Session | ||
Session.vim | ||
|
||
# Temporary | ||
.netrwhist | ||
# Auto-generated tag files | ||
tags | ||
# Persistent undo | ||
[._]*.un~ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/ |
Oops, something went wrong.