Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/GitHub actions #6

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
39 changes: 39 additions & 0 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Make

on:
push:
branches:
- "**"
pull_request:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- name: Build on Linux
if: runner.os == 'Linux'
shell: bash
run: bash -x make.sh build

- name: Build on Windows
if: runner.os == 'Windows'
shell: powershell
run: pwsh -File make.ps1 build
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ CopyCommander is a tool for windows/linux to use queued file-copy/moves from one

A manual can be found [here](src/how_to_use.txt)

If you do not have Lazarus you can directly download a precompiled binary from:

https://www.corpsman.de/klickcounter.php?url=download/copycommander.zip
If you do not have Lazarus you can directly download a precompiled binary [from](https://www.corpsman.de/klickcounter.php?url=download/copycommander.zip).

90 changes: 90 additions & 0 deletions make.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/usr/bin/env pwsh
##############################################################################################################

Function Show-Usage {
Return "
Usage: pwsh -File $($PSCommandPath) [OPTIONS]
Options:
build Build program
"
}

Function Request-File {
ForEach ($REPLY in $args) {
$params = @{
Uri = $REPLY
OutFile = (Split-Path -Path $REPLY -Leaf).Split('?')[0]
}
Invoke-WebRequest @params | Out-Null
Return $params.OutFile
}
}

Function Install-Program {
While ($Input.MoveNext()) {
Switch ((Split-Path -Path $Input.Current -Leaf).Split('.')[-1]) {
'msi' {
& msiexec /passive /package $Input.Current | Out-Host
}
'exe' {
& ".\$($Input.Current)" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Host
}
}
Remove-Item $Input.Current
}
}

Function Build-Project {
$VAR = @{
Cmd = 'lazbuild'
Url = 'https://netix.dl.sourceforge.net/project/lazarus/Lazarus%20Windows%2064%20bits/Lazarus%203.6/lazarus-3.6-fpc-3.2.2-win64.exe?viasf=1'
Path = "C:\Lazarus"
}
Try {
Get-Command $VAR.Cmd
} Catch {
Request-File $VAR.Url | Install-Program
$env:PATH+=";$($VAR.Path)"
Get-Command $VAR.Cmd
}
If ( Test-Path -Path 'use\components.txt' ) {
& git submodule update --recursive --init | Out-Host
& git submodule update --recursive --remote | Out-Host
Get-Content -Path 'use\components.txt' | ForEach-Object {
If ((-not (& lazbuild --verbose-pkgsearch $_ | Out-Null)) -and
(-not (& lazbuild --add-package $_ | Out-Null)) -and
(-not (Test-Path -Path 'use\components.txt'))) {
$OutFile = Request-File "https://packages.lazarus-ide.org/$($_).zip"
Expand-Archive -Path $OutFile -DestinationPath "use\$($_)" -Force
Remove-Item $OutFile
}
}
Get-ChildItem -Filter '*.lpk' -Recurse -File –Path 'use' | ForEach-Object {
& lazbuild --add-package-link $_ | Out-Host
}
}
Get-ChildItem -Filter '*.lpi' -Recurse -File –Path 'src' | ForEach-Object {
& lazbuild --no-write-project --recursive --build-mode=release $_ | Out-Host
}
}

Function Switch-Action {
$ErrorActionPreference = 'stop'
Set-PSDebug -Strict -Trace 1
Invoke-ScriptAnalyzer -EnableExit -Path $PSCommandPath
If ($args.count -gt 0) {
Switch ($args[0]) {
'build' {
Build-Project
}
Default {
Show-Usage
}
}
} Else {
Show-Usage
}
}

##############################################################################################################
Switch-Action @args | Out-Null
59 changes: 59 additions & 0 deletions make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash

function priv_clippit
(
cat <<EOF
Usage: bash ${0} [OPTIONS]
Options:
build Build program
EOF
)

function priv_lazbuild
(
if ! (which lazbuild); then
source '/etc/os-release'
case ${ID:?} in
debian | ubuntu)
sudo apt-get update
sudo apt-get install -y lazarus
;;
esac
fi
if [[ -f 'use/components.txt' ]]; then
git submodule update --init --recursive
git submodule update --recursive --remote
while read -r; do
if [[ -n "${REPLY}" ]] &&
! (lazbuild --verbose-pkgsearch "${REPLY}") &&
! (lazbuild --add-package "${REPLY}") &&
! [[ -f "use/${REPLY}" ]]; then
declare -A VAR=(
[url]="https://packages.lazarus-ide.org/${REPLY}.zip"
[out]=$(mktemp)
)
wget --output-document "${VAR[out]}" "${VAR[url]}" >/dev/null
unzip -o "${VAR[out]}" -d "use/${REPLY}"
rm --verbose "${VAR[out]}"
fi
done < 'use/components.txt'
find 'use' -type 'f' -name '*.lpk' -exec lazbuild --add-package-link {} +
fi
find 'src' -type 'f' -name '*.lpi' \
-exec lazbuild --no-write-project --recursive --no-write-project --build-mode=release {} + 1>&2
)

function priv_main
(
set -euo pipefail
if ((${#})); then
case ${1} in
build) priv_lazbuild ;;
*) priv_clippit ;;
esac
else
priv_clippit
fi
)

priv_main "${@}" >/dev/null
75 changes: 74 additions & 1 deletion src/CopyCommander2.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,81 @@
<DpiAware Value="True"/>
</XPManifest>
</General>
<BuildModes Count="1">
<BuildModes Count="3">
<Item1 Name="Default" Default="True"/>
<Item2 Name="Debug">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="CopyCommander2"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\Sample\DatenSteuerung"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
<UseHeaptrc Value="True"/>
<TrashVariables Value="True"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item2>
<Item3 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="CopyCommander2"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\Sample\DatenSteuerung"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<RunWithoutDebug Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item3>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
Expand Down
2 changes: 1 addition & 1 deletion src/CopyCommander2.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

Begin
RequireDerivedFormResource := True;
Application.Scaled := True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Expand Down