Skip to content

CLightningFastViewerWidget: magic constants extracted; minor layout i… #446

CLightningFastViewerWidget: magic constants extracted; minor layout i…

CLightningFastViewerWidget: magic constants extracted; minor layout i… #446

Workflow file for this run

name: CI
on: [push, pull_request, workflow_dispatch]
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .
# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release
jobs:
build:
name: Build & test on ${{ matrix.os }} with ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Sys info
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
$cpu = Get-CimInstance Win32_Processor
$mem = Get-CimInstance Win32_ComputerSystem
$cpu | ForEach-Object {
Write-Host "CPU: $($_.Name)"
Write-Host " Cores: $($_.NumberOfCores)"
Write-Host " Logical processors: $($_.NumberOfLogicalProcessors)"
Write-Host " Max clock (MHz): $($_.MaxClockSpeed)"
}
$totalRamGB = [Math]::Round($mem.TotalPhysicalMemory / 1GB, 2)
Write-Host "RAM: $totalRamGB GB"
- name: Sys info
if: "startsWith(matrix.os, 'mac')"
run: |
sysctl -a | grep cpu | grep hw
sysctl -a | grep brand_string
sysctl -n hw.machine
- name: Sys info
if: "startsWith(matrix.os, 'ubuntu')"
run: |
lscpu
- name: Github environment
run: echo '${{ toJSON(github) }}'
- name: Install Qt
if: "startsWith(matrix.os, 'windows')"
uses: jurplel/install-qt-action@v4
with:
version: '6.9.*'
target: desktop
arch: 'win64_msvc2022_64'
archives: 'qtbase icu qtsvg'
modules: 'qt5compat qtimageformats'
cache: 'true'
- name: Install Qt
if: "startsWith(matrix.os, 'ubuntu')"
uses: jurplel/install-qt-action@v4
with:
version: '6.9.*'
target: desktop
arch: 'linux_gcc_64'
archives: 'qtbase icu qtsvg'
modules: 'qt5compat qtimageformats'
cache: 'true'
- name: Install Qt
if: "startsWith(matrix.os, 'macos')"
uses: jurplel/install-qt-action@v4
with:
version: '6.9.*'
target: desktop
arch: 'clang_64'
archives: 'qtbase icu qtsvg'
modules: 'qt5compat qtimageformats'
cache: 'true'
- name: Windows - setup MSBuild
if: startsWith(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v2
- name: Windows - building main installer
if: startsWith(matrix.os, 'windows')
shell: cmd
run: |
%QT_ROOT_DIR%\bin\qmake.exe -v
set QTDIR64=%QT_ROOT_DIR%
cd installer\windows\
create_installer.bat
cd ..\..
xcopy /R /Y .\installer\windows\binaries\64\msvcr\* .\bin\release\x64\
xcopy /R /Y .\installer\windows\binaries\64\Qt\* .\bin\release\x64\
- name: Mac
if: startsWith(matrix.os, 'macos')
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
clang --version
./installer/mac/create_dmg.sh $QT_ROOT_DIR
- name: Linux
if: startsWith(matrix.os, 'ubuntu')
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
export QT_DEBUG_PLUGINS=1
sudo apt update -y; sudo apt install -qq gcc-12 g++-12 libglu1-mesa-dev libx11-xcb-dev '^libxcb*' '^libxkb*' libfuse2
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 50
g++ --version
export PATH=$QT_ROOT_DIR/bin/:$PATH
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/7/linuxdeployqt-7-x86_64.AppImage"
chmod a+x linuxdeployqt-7-x86_64.AppImage
unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
$QT_ROOT_DIR/bin/qmake -r CONFIG+=release
make -j
# Linux: building AppImage
cp ./qt-app/resources/icon.png ./bin/release/x64/
cp ./installer/linux/file_commander.desktop ./bin/release/x64/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${QT_ROOT_DIR}/lib/
sudo ldconfig
./linuxdeployqt-7-x86_64.AppImage ./bin/release/x64/FileCommander -appimage -unsupported-allow-new-glibc -bundle-non-qt-libs -qmake=$QT_ROOT_DIR/bin/qmake -extra-plugins=platforms/,iconengines/,imageformats/,tls/,networkinformation/,platformthemes/,wayland-decoration-client/,wayland-graphics-integration-client/,wayland-shell-integration -executable=./bin/release/x64/libplugin_filecomparison.so.1.0.0 -executable=./bin/release/x64/libplugin_imageviewer.so.1.0.0 -executable=./bin/release/x64/libplugin_textviewer.so.1.0.0
ls -Ac
mv ./File_Commander*.AppImage ./FileCommander.AppImage
- name: Test launch
if: startsWith(matrix.os, 'macos')
run: ./bin/release/x64/FileCommander.app/Contents/MacOS/FileCommander --test-launch
- name: Test launch
if: startsWith(matrix.os, 'ubuntu')
run: |
xvfb-run --auto-servernum ./bin/release/x64/FileCommander --test-launch
- name: Test launch
if: startsWith(matrix.os, 'widows')
run: |
.\bin\release\x64\FileCommander.exe --test-launch
- name: Building tests - Windows
if: startsWith(matrix.os, 'windows')
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
run: |
cd file-commander-core\core-tests\
dir
call "%programfiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 && "%QT_ROOT_DIR%\bin\qmake.exe" -tp vc -r
msbuild /t:Build /p:Configuration=Release;PlatformToolset=v143 core-tests.sln
cd ..\..
- name: Setup RAM Disk
if: startsWith(matrix.os, 'windows')
uses: chad-golden/setup-ramdisk@v1.0.1
with:
size-in-mb: 512 # Optional: Default is 2048
drive-letter: 'R' # Optional: Default is R
copy-workspace: false # Optional: Default is false
- name: Make temp folder on RAM disk
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
New-Item -Path R:\Temp -ItemType Directory -Force
echo "TEMP=R:\\Temp" >> $env:GITHUB_ENV
echo "TMP=R:\\Temp" >> $env:GITHUB_ENV
echo "TMPDIR=R:\\Temp" >> $env:GITHUB_ENV
- name: Running tests - Windows
if: startsWith(matrix.os, 'windows')
shell: powershell
run: |
.\bin\release\x64\fso_test.exe
.\bin\release\x64\fso_test_high_level.exe
$N=20
For ($i=1; $i -le $N; $i++) {
Write-Output "Iteration $i/$N"
$randomSeed = ((get-date -Uformat %s).remove(10, 1));
$randomSeed = $randomSeed.substring($randomSeed.Length - 8);
& .\bin\release\x64\operationperformer_test.exe --std-seed $randomSeed;
}
$randomSeed = ((get-date -Uformat %s).remove(10, 1));
$randomSeed = $randomSeed.substring($randomSeed.Length - 8);
& .\bin\release\x64\filecomparator_test.exe --std-seed $randomSeed;
- name: Building tests - Mac
if: startsWith(matrix.os, 'macos')
run: |
cd file-commander-core/core-tests
$QT_ROOT_DIR/bin/qmake -r CONFIG+=release
make -j
cd ../../
for f in $(find bin/release/x64/ -name *.app); do $QT_ROOT_DIR/bin/macdeployqt $f; done
- name: Running tests - Mac
if: startsWith(matrix.os, 'macos')
run: |
set -e; ./bin/release/x64/fso_test.app/Contents/MacOS/fso_test
set -e; ./bin/release/x64/fso_test_high_level.app/Contents/MacOS/fso_test_high_level
set -e; for i in `seq 1 20`; do echo "Iteration $i"; ./bin/release/x64/operationperformer_test.app/Contents/MacOS/operationperformer_test --std-seed $(date +%s); sleep 1; done
set -e; ./bin/release/x64/filecomparator_test.app/Contents/MacOS/filecomparator_test --std-seed $(date +%s)
- name: Building tests - Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
cd file-commander-core/core-tests
$QT_ROOT_DIR/bin/qmake -r CONFIG+=release
make -j
cd ../../
for f in $(find bin/release/x64/ -name *.app); do $QT_ROOT_DIR/bin/macdeployqt $f; done
./linuxdeployqt-7-x86_64.AppImage ./bin/release/x64/fso_test -unsupported-allow-new-glibc -bundle-non-qt-libs -extra-plugins=platforms/
./linuxdeployqt-7-x86_64.AppImage ./bin/release/x64/fso_test_high_level -unsupported-allow-new-glibc -bundle-non-qt-libs -extra-plugins=platforms/
./linuxdeployqt-7-x86_64.AppImage ./bin/release/x64/operationperformer_test -unsupported-allow-new-glibc -bundle-non-qt-libs -extra-plugins=platforms/
./linuxdeployqt-7-x86_64.AppImage ./bin/release/x64/filecomparator_test -unsupported-allow-new-glibc -bundle-non-qt-libs -extra-plugins=platforms/
- name: Running tests - Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
set -e; ./bin/release/x64/fso_test
set -e; ./bin/release/x64/fso_test_high_level
set -e; for i in `seq 1 20`; do echo "Iteration $i"; ./bin/release/x64/operationperformer_test --std-seed $(date +%s); sleep 1; done
set -e; ./bin/release/x64/filecomparator_test --std-seed $(date +%s)
- name: Archive DMG
if: success() && startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
name: FileCommander.dmg
path: FileCommander.dmg
- name: Archive AppImage
if: success() && startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v4
with:
name: FileCommander.AppImage
path: FileCommander.AppImage
- name: Archive Installer
if: success() && startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v4
with:
name: FileCommander.exe
path: installer/windows/FileCommander.exe
create-release:
needs: build
if: success() && startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
deployments: write
pull-requests: read
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # required to access full history and tags
fetch-tags: true
- name: Download EXE
uses: actions/download-artifact@v4
with:
name: FileCommander.exe
path: .
- name: Download DMG
uses: actions/download-artifact@v4
with:
name: FileCommander.dmg
path: .
- name: Download AppImage
uses: actions/download-artifact@v4
with:
name: FileCommander.AppImage
path: .
- name: Generate changelog (commits between previous tag and this tag)
id: changelog
shell: pwsh
env:
GITHUB_SERVER_URL: ${{ github.server_url }}
GITHUB_REPOSITORY: ${{ github.repository }}
CURRENT_REF: ${{ github.ref }}
run: |
$ErrorActionPreference = "Stop"
# Extract current tag name (strip refs/tags/)
$currentTag = $env:CURRENT_REF -replace '^refs/tags/', ''
# Ensure tags are present
git fetch --tags --prune
# Find previous tag (newest first, excluding current tag)
$tags = git tag --sort=-creatordate
$prevTag = $tags | Where-Object { $_ -ne $currentTag } | Select-Object -First 1
if ([string]::IsNullOrEmpty($prevTag)) {
$title = "Changes up to $currentTag"
$commits = git log `
$currentTag `
--pretty=format:"- %s ([%h]($($env:GITHUB_SERVER_URL)/$($env:GITHUB_REPOSITORY)/commit/%H))"
}
else {
# Resolve the commit the previous tag points to and exclude it explicitly
$prevCommit = git rev-list -n 1 $prevTag
$commits = git log `
$currentTag `
--not $prevCommit `
--pretty=format:"- %s ([%h]($($env:GITHUB_SERVER_URL)/$($env:GITHUB_REPOSITORY)/commit/%H))"
}
if ([string]::IsNullOrWhiteSpace($commits)) {
$commits = "(no commits)"
}
# Write multiline output for softprops/action-gh-release
"body<<EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
$commits | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
"EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
- name: Create Release
uses: softprops/action-gh-release@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
files: |
FileCommander.exe
FileCommander.dmg
FileCommander.AppImage
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref }}
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.body }}}