Build cosmotop #133
Workflow file for this run
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: Build cosmotop | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
pull_request: | |
workflow_call: | |
inputs: | |
version: | |
required: true | |
type: string | |
jobs: | |
build: | |
name: Build cosmotop.com | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Load cosmocc version | |
run: | | |
version=$(cat .github/cosmocc_version.txt) | |
echo "cosmocc_version=${version}" >> "$GITHUB_ENV" | |
- name: Setup cosmocc | |
uses: bjia56/[email protected] | |
with: | |
version: ${{ env.cosmocc_version }} | |
- name: Build cosmotop.com | |
run: | | |
export CC=cosmocc | |
export CXX=cosmoc++ | |
cmake -B build -DTARGET=host ${{ inputs.version && '-DRELEASE=1' || '' }} | |
cmake --build build --parallel 4 | |
- name: Upload cosmotop.com | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cosmotop.com | |
path: ./build/cosmotop.com | |
- name: Upload debug artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cosmotop.debug | |
path: | | |
./build/cosmotop.com.dbg | |
./build/cosmotop.aarch64.elf | |
build_linux_plugin: | |
name: Build plugin Linux ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x86_64, aarch64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up zig | |
uses: mlugg/setup-zig@v1 | |
with: | |
version: 0.13.0 | |
- name: Build plugin | |
shell: bash | |
run: | | |
export CC="zig cc -target ${{ matrix.arch }}-linux-musl" | |
export CXX="zig c++ -target ${{ matrix.arch }}-linux-musl" | |
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }} | |
cmake --build build --parallel 4 | |
cp build/cosmotop-plugin.exe ./cosmotop-linux-${{ matrix.arch }}.exe | |
- name: Upload plugin | |
uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-linux-${{ matrix.arch }} | |
path: ./cosmotop-linux-${{ matrix.arch }}.exe | |
build_macos_plugin: | |
name: Build plugin MacOS ${{ matrix.arch }} | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runner: macos-13 | |
arch: x86_64 | |
- runner: macos-14 | |
arch: aarch64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build plugin | |
shell: bash | |
run: | | |
if [[ ${{ matrix.arch }} == "x86_64" ]]; then | |
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }} | |
cmake --build build --parallel 4 | |
cp build/cosmotop-plugin.exe ./cosmotop-macos-${{ matrix.arch }}.exe | |
else | |
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }} | |
cmake --build build --parallel 4 | |
cp build/libcosmotop-plugin.dylib ./cosmotop-macos-${{ matrix.arch }}.dylib | |
fi | |
- name: Upload plugin | |
uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-macos-${{ matrix.arch }} | |
path: ./cosmotop-macos-${{ matrix.arch }}.* | |
build_windows_plugin: | |
name: Build plugin Windows ${{ matrix.arch }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x86_64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build plugin | |
shell: bash | |
run: | | |
curl -L -o LHM-CPPdll-x64.zip https://github.com/aristocratos/LHM-CppExport/releases/download/CPPdll-v1/LHM-CPPdll-x64.zip | |
unzip LHM-CPPdll-x64.zip | |
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }} | |
mv external build/ | |
cmake --build build --parallel 4 --config Release | |
cp build/Release/cosmotop-plugin.dll ./cosmotop-windows-${{ matrix.arch }}.dll | |
- name: Upload plugin | |
uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-windows-${{ matrix.arch }} | |
path: ./cosmotop-windows-${{ matrix.arch }}.dll | |
build_freebsd_plugin: | |
name: Build plugin FreeBSD ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x86_64, aarch64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Start VM | |
uses: vmactions/freebsd-vm@v1 | |
with: | |
sync: nfs | |
arch: ${{ matrix.arch }} | |
release: "13.3" | |
prepare: | | |
pkg install -y cmake | |
- name: Build plugin | |
shell: freebsd {0} | |
run: | | |
cd ${{ github.workspace }} | |
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }} | |
cmake --build build --parallel 4 | |
cp build/libcosmotop-plugin.so ./cosmotop-freebsd-${{ matrix.arch }}.so | |
- name: Upload plugin | |
uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-freebsd-${{ matrix.arch }} | |
path: ./cosmotop-freebsd-${{ matrix.arch }}.so | |
build_netbsd_plugin: | |
name: Build plugin NetBSD ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x86_64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Start VM | |
uses: vmactions/netbsd-vm@v1 | |
with: | |
sync: nfs | |
arch: ${{ matrix.arch }} | |
release: "10.0" | |
prepare: | | |
/usr/sbin/pkg_add cmake clang | |
- name: Build plugin | |
shell: netbsd {0} | |
run: | | |
cd ${{ github.workspace }} | |
CC=clang CXX=clang++ cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }} | |
cmake --build build --parallel 4 | |
cp build/cosmotop-plugin.exe ./cosmotop-netbsd-${{ matrix.arch }}.exe | |
- name: Upload plugin | |
uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-netbsd-${{ matrix.arch }} | |
path: ./cosmotop-netbsd-${{ matrix.arch }}.exe | |
build_openbsd_plugin: | |
name: Build plugin OpenBSD ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x86_64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Start VM | |
uses: vmactions/openbsd-vm@v1 | |
with: | |
sync: nfs | |
arch: ${{ matrix.arch }} | |
release: "7.3" | |
prepare: | | |
pkg_add cmake | |
- name: Build plugin | |
shell: openbsd {0} | |
run: | | |
cd ${{ github.workspace }} | |
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }} | |
cmake --build build --parallel 4 | |
cp build/cosmotop-plugin.exe ./cosmotop-openbsd-${{ matrix.arch }}.exe | |
- name: Upload plugin | |
uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-openbsd-${{ matrix.arch }} | |
path: ./cosmotop-openbsd-${{ matrix.arch }}.exe | |
bundle: | |
name: Bundle plugins into cosmotop.exe | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- build_linux_plugin | |
- build_macos_plugin | |
- build_windows_plugin | |
- build_freebsd_plugin | |
- build_netbsd_plugin | |
- build_openbsd_plugin | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Load cosmocc version | |
run: | | |
version=$(cat .github/cosmocc_version.txt) | |
echo "cosmocc_version=${version}" >> "$GITHUB_ENV" | |
- name: Setup cosmocc | |
uses: bjia56/[email protected] | |
with: | |
version: ${{ env.cosmocc_version }} | |
- name: Download cosmotop.com | |
uses: actions/download-artifact@v4 | |
with: | |
name: cosmotop.com | |
path: . | |
- name: Download plugins | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: plugin-* | |
path: /tmp/cosmotop-plugin/ | |
merge-multiple: true | |
- name: Bundle | |
run: | | |
tree /tmp/cosmotop-plugin || true | |
sudo mkdir -p /zip/ | |
sudo cp -r ${{ github.workspace }}/themes /zip/ | |
sudo cp /tmp/cosmotop-plugin/cosmotop-linux-x86_64.exe /zip/ | |
sudo cp /tmp/cosmotop-plugin/cosmotop-linux-aarch64.exe /zip/ | |
sudo cp /tmp/cosmotop-plugin/cosmotop-macos-x86_64.exe /zip/ | |
sudo cp /tmp/cosmotop-plugin/cosmotop-macos-aarch64.dylib /zip/ | |
sudo cp /tmp/cosmotop-plugin/cosmotop-windows-x86_64.dll /zip/ | |
sudo cp /tmp/cosmotop-plugin/cosmotop-freebsd-x86_64.so /zip/ | |
sudo cp /tmp/cosmotop-plugin/cosmotop-freebsd-aarch64.so /zip/ | |
sudo cp /tmp/cosmotop-plugin/cosmotop-netbsd-x86_64.exe /zip/ | |
sudo cp /tmp/cosmotop-plugin/cosmotop-openbsd-x86_64.exe /zip/ | |
wget https://github.com/aristocratos/LHM-CppExport/releases/download/CPPdll-v1/LHM-CPPdll-x64.zip | |
unzip LHM-CPPdll-x64.zip | |
sudo mkdir -p /zip/windows | |
sudo cp external/*.dll /zip/windows/ | |
cd /zip | |
zip -r ${{ github.workspace }}/cosmotop.com * | |
cd ${{ github.workspace }} | |
mv cosmotop.com cosmotop.exe | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cosmotop.exe | |
path: ./cosmotop.exe | |
- name: Interactive debugging | |
uses: fawazahmed0/action-debug-vscode@v3 | |
if: ${{ always() && inputs.debug_link }} | |
check: | |
name: Check cosmotop.exe ${{ matrix.os }} ${{ matrix.arch }} | |
needs: bundle | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runner: macos-13 | |
arch: x86_64 | |
os: MacOS | |
- runner: macos-14 | |
arch: arm64 | |
os: MacOS | |
- runner: ubuntu-latest | |
arch: x86_64 | |
os: Linux | |
- runner: ubuntu-24.04-arm | |
arch: aarch64 | |
os: Linux | |
- runner: windows-latest | |
arch: x86_64 | |
os: Windows | |
- runner: ubuntu-latest | |
arch: x86_64 | |
os: FreeBSD | |
- runner: ubuntu-latest | |
arch: aarch64 | |
os: FreeBSD | |
- runner: ubuntu-latest | |
arch: x86_64 | |
os: NetBSD | |
- runner: ubuntu-latest | |
arch: x86_64 | |
os: OpenBSD | |
steps: | |
- name: Set up cosmocc | |
if: ${{ matrix.os == 'Linux' }} | |
uses: bjia56/[email protected] | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cosmotop.exe | |
path: . | |
- name: Mark executable | |
shell: bash | |
run: | | |
chmod +x cosmotop.exe | |
- name: Configure Windows | |
if: ${{ matrix.os == 'Windows' }} | |
shell: powershell | |
run: | | |
Remove-MpPreference -ExclusionPath (Get-MpPreference).ExclusionPath | |
Set-Service -Name wuauserv -StartupType Manual -Status Running | |
- name: Scan with Windows Defender | |
if: ${{ matrix.os == 'Windows' }} | |
shell: cmd | |
run: | | |
copy cosmotop.exe C: | |
"C:\Program Files\Windows Defender\MpCmdRun.exe" -SignatureUpdate | |
"C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File C:\cosmotop.exe | |
- name: Check cosmotop.exe | |
if: ${{ !contains(matrix.os, 'BSD') }} | |
shell: bash | |
run: | | |
./cosmotop.exe --version | |
- name: Start VM | |
if: ${{ matrix.os == 'FreeBSD' }} | |
uses: vmactions/freebsd-vm@v1 | |
with: | |
sync: nfs | |
arch: ${{ matrix.arch }} | |
- name: Start VM | |
if: ${{ matrix.os == 'NetBSD' }} | |
uses: vmactions/netbsd-vm@v1 | |
with: | |
sync: nfs | |
- name: Start VM | |
if: ${{ matrix.os == 'OpenBSD' }} | |
uses: vmactions/openbsd-vm@v1 | |
with: | |
sync: nfs | |
release: 7.3 | |
- name: Check cosmotop.exe | |
if: ${{ matrix.os == 'FreeBSD' }} | |
shell: freebsd {0} | |
run: | | |
cd ${{ github.workspace }} | |
./cosmotop.exe --version | |
- name: Check cosmotop.exe | |
if: ${{ matrix.os == 'NetBSD' }} | |
shell: netbsd {0} | |
run: | | |
cd ${{ github.workspace }} | |
./cosmotop.exe --version | |
- name: Check cosmotop.exe | |
if: ${{ matrix.os == 'OpenBSD' }} | |
shell: openbsd {0} | |
run: | | |
cd ${{ github.workspace }} | |
./cosmotop.exe --version |