Skip to content

Commit 2bd11e2

Browse files
Merge pull request #6 from theavege/add/github-actions
Add/GitHub actions
2 parents a1ff05a + 3c53e00 commit 2bd11e2

File tree

7 files changed

+271
-5
lines changed

7 files changed

+271
-5
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"

.github/workflows/make.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Make
3+
4+
on:
5+
push:
6+
branches:
7+
- "**"
8+
pull_request:
9+
branches:
10+
- master
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
runs-on: ${{ matrix.os }}
19+
timeout-minutes: 120
20+
strategy:
21+
matrix:
22+
os:
23+
- ubuntu-latest
24+
- windows-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
31+
- name: Build on Linux
32+
if: runner.os == 'Linux'
33+
shell: bash
34+
run: bash -x make.sh build
35+
36+
- name: Build on Windows
37+
if: runner.os == 'Windows'
38+
shell: powershell
39+
run: pwsh -File make.ps1 build

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ CopyCommander is a tool for windows/linux to use queued file-copy/moves from one
44

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

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

make.ps1

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/usr/bin/env pwsh
2+
##############################################################################################################
3+
4+
Function Show-Usage {
5+
Return "
6+
Usage: pwsh -File $($PSCommandPath) [OPTIONS]
7+
Options:
8+
build Build program
9+
"
10+
}
11+
12+
Function Request-File {
13+
ForEach ($REPLY in $args) {
14+
$params = @{
15+
Uri = $REPLY
16+
OutFile = (Split-Path -Path $REPLY -Leaf).Split('?')[0]
17+
}
18+
Invoke-WebRequest @params | Out-Null
19+
Return $params.OutFile
20+
}
21+
}
22+
23+
Function Install-Program {
24+
While ($Input.MoveNext()) {
25+
Switch ((Split-Path -Path $Input.Current -Leaf).Split('.')[-1]) {
26+
'msi' {
27+
& msiexec /passive /package $Input.Current | Out-Host
28+
}
29+
'exe' {
30+
& ".\$($Input.Current)" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Host
31+
}
32+
}
33+
Remove-Item $Input.Current
34+
}
35+
}
36+
37+
Function Build-Project {
38+
$VAR = @{
39+
Cmd = 'lazbuild'
40+
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'
41+
Path = "C:\Lazarus"
42+
}
43+
Try {
44+
Get-Command $VAR.Cmd
45+
} Catch {
46+
Request-File $VAR.Url | Install-Program
47+
$env:PATH+=";$($VAR.Path)"
48+
Get-Command $VAR.Cmd
49+
}
50+
If ( Test-Path -Path 'use\components.txt' ) {
51+
& git submodule update --recursive --init | Out-Host
52+
& git submodule update --recursive --remote | Out-Host
53+
Get-Content -Path 'use\components.txt' | ForEach-Object {
54+
If ((-not (& lazbuild --verbose-pkgsearch $_ | Out-Null)) -and
55+
(-not (& lazbuild --add-package $_ | Out-Null)) -and
56+
(-not (Test-Path -Path 'use\components.txt'))) {
57+
$OutFile = Request-File "https://packages.lazarus-ide.org/$($_).zip"
58+
Expand-Archive -Path $OutFile -DestinationPath "use\$($_)" -Force
59+
Remove-Item $OutFile
60+
}
61+
}
62+
Get-ChildItem -Filter '*.lpk' -Recurse -File –Path 'use' | ForEach-Object {
63+
& lazbuild --add-package-link $_ | Out-Host
64+
}
65+
}
66+
Get-ChildItem -Filter '*.lpi' -Recurse -File –Path 'src' | ForEach-Object {
67+
& lazbuild --no-write-project --recursive --build-mode=release $_ | Out-Host
68+
}
69+
}
70+
71+
Function Switch-Action {
72+
$ErrorActionPreference = 'stop'
73+
Set-PSDebug -Strict -Trace 1
74+
Invoke-ScriptAnalyzer -EnableExit -Path $PSCommandPath
75+
If ($args.count -gt 0) {
76+
Switch ($args[0]) {
77+
'build' {
78+
Build-Project
79+
}
80+
Default {
81+
Show-Usage
82+
}
83+
}
84+
} Else {
85+
Show-Usage
86+
}
87+
}
88+
89+
##############################################################################################################
90+
Switch-Action @args | Out-Null

make.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
3+
function priv_clippit
4+
(
5+
cat <<EOF
6+
Usage: bash ${0} [OPTIONS]
7+
Options:
8+
build Build program
9+
EOF
10+
)
11+
12+
function priv_lazbuild
13+
(
14+
if ! (which lazbuild); then
15+
source '/etc/os-release'
16+
case ${ID:?} in
17+
debian | ubuntu)
18+
sudo apt-get update
19+
sudo apt-get install -y lazarus
20+
;;
21+
esac
22+
fi
23+
if [[ -f 'use/components.txt' ]]; then
24+
git submodule update --init --recursive
25+
git submodule update --recursive --remote
26+
while read -r; do
27+
if [[ -n "${REPLY}" ]] &&
28+
! (lazbuild --verbose-pkgsearch "${REPLY}") &&
29+
! (lazbuild --add-package "${REPLY}") &&
30+
! [[ -f "use/${REPLY}" ]]; then
31+
declare -A VAR=(
32+
[url]="https://packages.lazarus-ide.org/${REPLY}.zip"
33+
[out]=$(mktemp)
34+
)
35+
wget --output-document "${VAR[out]}" "${VAR[url]}" >/dev/null
36+
unzip -o "${VAR[out]}" -d "use/${REPLY}"
37+
rm --verbose "${VAR[out]}"
38+
fi
39+
done < 'use/components.txt'
40+
find 'use' -type 'f' -name '*.lpk' -exec lazbuild --add-package-link {} +
41+
fi
42+
find 'src' -type 'f' -name '*.lpi' \
43+
-exec lazbuild --no-write-project --recursive --no-write-project --build-mode=release {} + 1>&2
44+
)
45+
46+
function priv_main
47+
(
48+
set -euo pipefail
49+
if ((${#})); then
50+
case ${1} in
51+
build) priv_lazbuild ;;
52+
*) priv_clippit ;;
53+
esac
54+
else
55+
priv_clippit
56+
fi
57+
)
58+
59+
priv_main "${@}" >/dev/null

src/CopyCommander2.lpi

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,81 @@
1616
<DpiAware Value="True"/>
1717
</XPManifest>
1818
</General>
19-
<BuildModes Count="1">
19+
<BuildModes Count="3">
2020
<Item1 Name="Default" Default="True"/>
21+
<Item2 Name="Debug">
22+
<CompilerOptions>
23+
<Version Value="11"/>
24+
<PathDelim Value="\"/>
25+
<Target>
26+
<Filename Value="CopyCommander2"/>
27+
</Target>
28+
<SearchPaths>
29+
<IncludeFiles Value="$(ProjOutDir)"/>
30+
<OtherUnitFiles Value="..\Sample\DatenSteuerung"/>
31+
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
32+
</SearchPaths>
33+
<Parsing>
34+
<SyntaxOptions>
35+
<IncludeAssertionCode Value="True"/>
36+
</SyntaxOptions>
37+
</Parsing>
38+
<CodeGeneration>
39+
<Checks>
40+
<IOChecks Value="True"/>
41+
<RangeChecks Value="True"/>
42+
<OverflowChecks Value="True"/>
43+
<StackChecks Value="True"/>
44+
</Checks>
45+
<VerifyObjMethodCallValidity Value="True"/>
46+
</CodeGeneration>
47+
<Linking>
48+
<Debugging>
49+
<DebugInfoType Value="dsDwarf3"/>
50+
<UseHeaptrc Value="True"/>
51+
<TrashVariables Value="True"/>
52+
<UseExternalDbgSyms Value="True"/>
53+
</Debugging>
54+
<Options>
55+
<Win32>
56+
<GraphicApplication Value="True"/>
57+
</Win32>
58+
</Options>
59+
</Linking>
60+
</CompilerOptions>
61+
</Item2>
62+
<Item3 Name="Release">
63+
<CompilerOptions>
64+
<Version Value="11"/>
65+
<PathDelim Value="\"/>
66+
<Target>
67+
<Filename Value="CopyCommander2"/>
68+
</Target>
69+
<SearchPaths>
70+
<IncludeFiles Value="$(ProjOutDir)"/>
71+
<OtherUnitFiles Value="..\Sample\DatenSteuerung"/>
72+
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
73+
</SearchPaths>
74+
<CodeGeneration>
75+
<SmartLinkUnit Value="True"/>
76+
<Optimizations>
77+
<OptimizationLevel Value="3"/>
78+
</Optimizations>
79+
</CodeGeneration>
80+
<Linking>
81+
<Debugging>
82+
<GenerateDebugInfo Value="False"/>
83+
<RunWithoutDebug Value="True"/>
84+
</Debugging>
85+
<LinkSmart Value="True"/>
86+
<Options>
87+
<Win32>
88+
<GraphicApplication Value="True"/>
89+
</Win32>
90+
</Options>
91+
</Linking>
92+
</CompilerOptions>
93+
</Item3>
2194
</BuildModes>
2295
<PublishOptions>
2396
<Version Value="2"/>

src/CopyCommander2.lpr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
Begin
3333
RequireDerivedFormResource := True;
34-
Application.Scaled := True;
34+
Application.Scaled:=True;
3535
Application.Initialize;
3636
Application.CreateForm(TForm1, Form1);
3737
Application.CreateForm(TForm2, Form2);

0 commit comments

Comments
 (0)