Skip to content

Commit

Permalink
chore(ci/cd): improve build
Browse files Browse the repository at this point in the history
  • Loading branch information
markuslf committed Jan 28, 2025
1 parent 9d3ef0b commit bdbc6b5
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 21 deletions.
81 changes: 60 additions & 21 deletions .github/workflows/lf-windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ jobs:
build-windows:
runs-on: 'windows-latest'
needs: 'build-windows-get-list'
needs:
- 'build-windows-get-list'
strategy:
matrix:
check: '${{ fromJson(needs.build-windows-get-list.outputs.monitoring_plugin_list_json) }}'
Expand All @@ -66,27 +67,19 @@ jobs:
with:
egress-policy: 'audit'

- name: 'Add msbuild to PATH'
uses: 'microsoft/setup-msbuild@v2'
if: "runner.os == 'Windows'"

- name: 'Install WiX'
run: 'dotnet tool install --global wix'
if: "runner.os == 'Windows'"

- name: 'checkout the monitoring-plugins repo'
- name: 'Checkout the monitoring-plugins repo'
uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # v4.2.2
with:
# Relative path under $GITHUB_WORKSPACE to place the repository
path: 'monitoring-plugins'

- name: 'checkout the lib repo'
- name: 'Checkout the lib repo'
uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # v4.2.2
with:
repository: 'Linuxfabrik/lib'
path: 'lib'

- name: 'install python3.12'
- name: 'Install python3.12'
uses: 'actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38' # v5.4.0
with:
python-version: '3.12'
Expand Down Expand Up @@ -122,32 +115,78 @@ jobs:
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'
needs:
- 'build-windows'
steps:

- name: 'Harden Runner'
uses: 'step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e' # v2.10.4
with:
egress-policy: 'audit'

- name: 'download all artifacts'
- name: 'Download all artifacts'
uses: 'actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16' # v4.1.8
with:
path: 'C:\artifacts'

- name: 'prepare plugins for zipping'
- name: 'Prepare plugins for zipping'
shell: 'bash'
run: |
cd /c/artifacts
mkdir /c/output
mkdir /c/output-zip
for dir in */*/; do
echo "dir: $dir"
echo cp -rv $dir* /c/output/
cp -rv $dir* /c/output/
echo cp -rv $dir* /c/output-zip/
cp -rv $dir* /c/output-zip/
done
- name: 'Upload build output'
- name: 'Upload build output-zip'
uses: 'actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08' # v4.6.0
with:
name: 'linuxfabrik-monitoring-plugins.zip'
path: 'C:\output-zip\'


msi-windows:
runs-on: 'windows-latest'
needs:
- 'zip-windows'
steps:

- name: 'Add msbuild to PATH'
uses: 'microsoft/setup-msbuild@v2'

- name: 'Install WiX toolset'
run: 'dotnet tool install --global wix'

- name: 'Prepare plugins for packaging'
shell: 'bash'
run: |
cd /c/artifacts
mkdir /c/output-msi
for dir in */*/; do
echo "dir: $dir"
echo cp -rv $dir* /c/output-msi/
cp -rv $dir* /c/output-msi/
done
# -dr INSTALLFOLDER: Specifies the directory reference for the installation folder.
# -cg LFMP: Groups all harvested components under the LFMP ComponentGroup.
# -gg: Automatically generates GUIDs for the components.
# -srd: Suppresses the root directory from being included as a directory structure.
- name: 'Harvest files with Heat'
run: |
heat.exe dir /c/output-msi -dr INSTALLFOLDER -cg LFMP -gg -srd -out linuxfabrik-monitoring-plugins.wxs
shell: cmd

- name: 'Build MSI (compile .wxs into .wixobj, link .wixobj into an .msi)'
run: |
candle.exe ${{ github.workspace }}\monitoring-plugins\linuxfabrik-monitoring-plugins.wxs -out linuxfabrik-monitoring-plugins.wixobj
light.exe linuxfabrik-monitoring-plugins.wixobj -out C:\output-msi\linuxfabrik-monitoring-plugins.msi
working-directory: .

- name: 'Upload build output-msi'
uses: 'actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08' # v4.6.0
with:
name: 'monitoring-plugins-windows'
path: 'C:\output\'
name: 'linuxfabrik-monitoring-plugins.msi'
path: 'C:\output-msi\'
Empty file.

0 comments on commit bdbc6b5

Please sign in to comment.