Update CHANGELOG.md #588
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
name: 'Compile the monitoring-plugins for Windows using Nuitka' | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: # yamllint disable-line rule:empty-values | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build-windows-get-list: | |
runs-on: 'ubuntu-latest' | |
outputs: | |
monitoring_plugin_list_json: '${{ steps.save-json.outputs.monitoring_plugin_list_json}}' | |
steps: | |
- name: 'checkout the monitoring-plugins repo' | |
uses: 'actions/checkout@v3' | |
- name: 'create list of windows checks' | |
run: | | |
for dir in check-plugins/*; do | |
check=$(basename $dir) | |
if [ -e $dir/.windows ]; then | |
echo $check >> /tmp/windows-checks | |
echo "'$check'," >> /tmp/windows-checks-ps-list | |
fi | |
done | |
- name: 'save the list as json' | |
id: 'save-json' | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "monitoring_plugin_list_json<<$EOF" >> "$GITHUB_OUTPUT" | |
cat /tmp/windows-checks | jq -R -s -c 'split("\n")[:-1]' >> "$GITHUB_OUTPUT" | |
echo "$EOF" >> "$GITHUB_OUTPUT" | |
build-windows: | |
runs-on: 'windows-latest' | |
needs: 'build-windows-get-list' | |
strategy: | |
matrix: | |
check: '${{ fromJson(needs.build-windows-get-list.outputs.monitoring_plugin_list_json) }}' | |
steps: | |
- name: 'checkout the monitoring-plugins repo' | |
uses: 'actions/checkout@v3' | |
with: | |
# Relative path under $GITHUB_WORKSPACE to place the repository | |
path: 'monitoring-plugins' | |
- name: 'checkout the lib repo' | |
uses: 'actions/checkout@v3' | |
with: | |
repository: 'Linuxfabrik/lib' | |
path: 'lib' | |
- name: 'install python3.10' | |
uses: 'actions/setup-python@v3' | |
with: | |
python-version: '3.10' # update as soon as nuitka supports latest python | |
- run: 'python.exe -m pip install --upgrade pip wheel setuptools' | |
# ordered-set is for nuitka: "Nuitka:WARNING: Using very slow fallback for ordered sets, please install 'ordered-set' or 'orderedset' PyPI packages for best Python compile time performance." | |
- run: 'pip install --upgrade ordered-set Nuitka Nuitka' | |
# install 3rd party libraries for all check plugins | |
- run: 'pip install --requirement ${{ github.workspace }}\monitoring-plugins\requirements.txt' | |
# info in case of errors | |
- run: 'pip list' | |
- run: 'python -m nuitka --assume-yes-for-downloads --mingw64 --follow-imports --include-plugin-directory="${{ github.workspace }}\lib" --output-dir=C:\nuitka-compile-temp --remove-output --standalone ${{ github.workspace }}\monitoring-plugins\check-plugins\${{ matrix.check }}\${{ matrix.check}}' | |
- name: 'Upload build output as artifact for later zipping' | |
uses: 'actions/upload-artifact@v3' | |
with: | |
name: 'nuitka-build-output-${{ matrix.check }}' | |
path: 'C:\nuitka-compile-temp\${{ matrix.check }}*' | |
zip-windows: | |
# we need to use windows here too, to be able to restore the cache (see https://github.com/marketplace/actions/cache#cache-version) | |
runs-on: 'windows-latest' | |
needs: 'build-windows' | |
steps: | |
- name: 'download all artifacts' | |
uses: 'actions/download-artifact@v3' | |
with: | |
path: 'C:\artifacts' | |
- name: 'prepare plugins for zipping' | |
shell: 'bash' | |
run: | | |
cd /c/artifacts | |
mkdir /c/output | |
for dir in */*/; do | |
echo "dir: $dir" | |
echo cp -rv $dir* /c/output/ | |
cp -rv $dir* /c/output/ | |
done | |
- name: 'upload the output as monitoring-plugins' | |
uses: 'actions/upload-artifact@v3' | |
with: | |
name: 'monitoring-plugins' | |
path: 'C:\output\' |