Skip to content

Commit c326b52

Browse files
Merge pull request #1 from theavege/add/github-actions
add github-actions
2 parents b3238b6 + d7d5d60 commit c326b52

21 files changed

+338
-2
lines changed

.github/dependabot.yml

+7
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

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

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/backup/
2+
**/lib/
3+
use/*/
4+
src/*/*.lps
5+
src/*/*.res

make.ps1

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
Use = 'use'
40+
Cmd = 'lazbuild'
41+
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'
42+
Path = "C:\Lazarus"
43+
}
44+
Try {
45+
Get-Command $VAR.Cmd
46+
} Catch {
47+
Request-File $VAR.Url | Install-Program
48+
$env:PATH+=";$($VAR.Path)"
49+
Get-Command $VAR.Cmd
50+
}
51+
If (Test-Path -Path $($VAR.Use)) {
52+
& git submodule update --init --recursive --force --remote | Out-Host
53+
$COMPONENTS = "$($VAR.Use)\components.txt"
54+
If (Test-Path -Path $COMPONENTS) {
55+
Get-Content -Path $COMPONENTS | ForEach-Object {
56+
If ((! (& $VAR.Cmd --verbose-pkgsearch $_ | Out-Null)) &&
57+
(! (& $VAR.Cmd --add-package $_ | Out-Null)) &&
58+
(! (Test-Path -Path "$($VAR.Use)\$($_)"))) {
59+
$OutFile = Request-File "https://packages.lazarus-ide.org/$($_).zip"
60+
Expand-Archive -Path $OutFile -DestinationPath "$($VAR.Use)\$($_)" -Force
61+
Remove-Item $OutFile
62+
}
63+
}
64+
}
65+
Get-ChildItem -Filter '*.lpk' -Recurse -File –Path 'use' | ForEach-Object {
66+
& $VAR.Cmd --add-package-link $_ | Out-Host
67+
}
68+
}
69+
Get-ChildItem -Filter '*.lpi' -Recurse -File –Path 'src' | ForEach-Object {
70+
& $VAR.Cmd --no-write-project --recursive --build-mode=release $_ | Out-Host
71+
}
72+
}
73+
74+
Function Switch-Action {
75+
$ErrorActionPreference = 'stop'
76+
Set-PSDebug -Strict -Trace 1
77+
Invoke-ScriptAnalyzer -EnableExit -Path $PSCommandPath
78+
If ($args.count -gt 0) {
79+
Switch ($args[0]) {
80+
'build' {
81+
Build-Project
82+
}
83+
Default {
84+
Show-Usage
85+
}
86+
}
87+
} Else {
88+
Show-Usage
89+
}
90+
}
91+
92+
##############################################################################################################
93+
Switch-Action @args | Out-Null

make.sh

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
declare -r COMPONENTS='use/components.txt'
24+
if [[ -d "${COMPONENTS%%/*}" ]]; then
25+
git submodule update --init --recursive --force --remote
26+
if [[ -f "${COMPONENTS}" ]]; then
27+
while read -r; do
28+
if [[ -n "${REPLY}" ]] &&
29+
! (lazbuild --verbose-pkgsearch "${REPLY}") &&
30+
! (lazbuild --add-package "${REPLY}") &&
31+
! [[ -d "${COMPONENTS%%/*}/${REPLY}" ]]; then
32+
declare -A VAR=(
33+
[url]="https://packages.lazarus-ide.org/${REPLY}.zip"
34+
[out]=$(mktemp)
35+
)
36+
wget --output-document "${VAR[out]}" "${VAR[url]}" >/dev/null
37+
unzip -o "${VAR[out]}" -d "${COMPONENTS%%/*}/${REPLY}"
38+
rm --verbose "${VAR[out]}"
39+
fi
40+
done < "${COMPONENTS}"
41+
fi
42+
find "${COMPONENTS%%/*}" -type 'f' -name '*.lpk' -exec \
43+
lazbuild --add-package-link {} +
44+
fi
45+
find 'src' -type 'f' -name '*.lpi' -exec \
46+
lazbuild --no-write-project --recursive --no-write-project --build-mode=release {} + 1>&2
47+
)
48+
49+
function priv_main
50+
(
51+
set -euo pipefail
52+
if ((${#})); then
53+
case ${1} in
54+
build) priv_lazbuild ;;
55+
*) priv_clippit ;;
56+
esac
57+
else
58+
priv_clippit
59+
fi
60+
)
61+
62+
priv_main "${@}" >/dev/null

npoll/npoll.lpi renamed to src/npoll/npoll.lpi

+65-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<Flags>
88
<MainUnitHasCreateFormStatements Value="False"/>
99
<MainUnitHasTitleStatement Value="False"/>
10+
<MainUnitHasScaledStatement Value="False"/>
1011
<CompatibilityMode Value="True"/>
1112
</Flags>
1213
<SessionStorage Value="InProjectDir"/>
@@ -17,8 +18,71 @@
1718
<i18n>
1819
<EnableI18N LFM="False"/>
1920
</i18n>
20-
<BuildModes Count="1">
21+
<BuildModes Count="3">
2122
<Item1 Name="Default" Default="True"/>
23+
<Item2 Name="Debug">
24+
<CompilerOptions>
25+
<Version Value="11"/>
26+
<PathDelim Value="\"/>
27+
<Target>
28+
<Filename Value="npoll"/>
29+
</Target>
30+
<SearchPaths>
31+
<IncludeFiles Value="$(ProjOutDir);.."/>
32+
<OtherUnitFiles Value="..\..\..\DatenSteuerung;.."/>
33+
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
34+
</SearchPaths>
35+
<Parsing>
36+
<SyntaxOptions>
37+
<IncludeAssertionCode Value="True"/>
38+
</SyntaxOptions>
39+
</Parsing>
40+
<CodeGeneration>
41+
<Checks>
42+
<IOChecks Value="True"/>
43+
<RangeChecks Value="True"/>
44+
<OverflowChecks Value="True"/>
45+
<StackChecks Value="True"/>
46+
</Checks>
47+
<VerifyObjMethodCallValidity Value="True"/>
48+
</CodeGeneration>
49+
<Linking>
50+
<Debugging>
51+
<DebugInfoType Value="dsDwarf3"/>
52+
<UseHeaptrc Value="True"/>
53+
<TrashVariables Value="True"/>
54+
<UseExternalDbgSyms Value="True"/>
55+
</Debugging>
56+
</Linking>
57+
</CompilerOptions>
58+
</Item2>
59+
<Item3 Name="Release">
60+
<CompilerOptions>
61+
<Version Value="11"/>
62+
<PathDelim Value="\"/>
63+
<Target>
64+
<Filename Value="npoll"/>
65+
</Target>
66+
<SearchPaths>
67+
<IncludeFiles Value="$(ProjOutDir);.."/>
68+
<OtherUnitFiles Value="..\..\..\DatenSteuerung;.."/>
69+
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
70+
</SearchPaths>
71+
<CodeGeneration>
72+
<SmartLinkUnit Value="True"/>
73+
<Optimizations>
74+
<OptimizationLevel Value="3"/>
75+
</Optimizations>
76+
</CodeGeneration>
77+
<Linking>
78+
<Debugging>
79+
<GenerateDebugInfo Value="False"/>
80+
<RunWithoutDebug Value="True"/>
81+
</Debugging>
82+
<LinkSmart Value="True"/>
83+
</Linking>
84+
</CompilerOptions>
85+
</Item3>
2286
</BuildModes>
2387
<PublishOptions>
2488
<Version Value="2"/>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

npush/npush.lpi renamed to src/npush/npush.lpi

+65-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<Flags>
88
<MainUnitHasCreateFormStatements Value="False"/>
99
<MainUnitHasTitleStatement Value="False"/>
10+
<MainUnitHasScaledStatement Value="False"/>
1011
<CompatibilityMode Value="True"/>
1112
</Flags>
1213
<SessionStorage Value="InProjectDir"/>
@@ -17,8 +18,71 @@
1718
<i18n>
1819
<EnableI18N LFM="False"/>
1920
</i18n>
20-
<BuildModes Count="1">
21+
<BuildModes Count="3">
2122
<Item1 Name="Default" Default="True"/>
23+
<Item2 Name="Debug">
24+
<CompilerOptions>
25+
<Version Value="11"/>
26+
<PathDelim Value="\"/>
27+
<Target>
28+
<Filename Value="npush"/>
29+
</Target>
30+
<SearchPaths>
31+
<IncludeFiles Value="$(ProjOutDir);.."/>
32+
<OtherUnitFiles Value="..\..\..\DatenSteuerung;..\..;.."/>
33+
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
34+
</SearchPaths>
35+
<Parsing>
36+
<SyntaxOptions>
37+
<IncludeAssertionCode Value="True"/>
38+
</SyntaxOptions>
39+
</Parsing>
40+
<CodeGeneration>
41+
<Checks>
42+
<IOChecks Value="True"/>
43+
<RangeChecks Value="True"/>
44+
<OverflowChecks Value="True"/>
45+
<StackChecks Value="True"/>
46+
</Checks>
47+
<VerifyObjMethodCallValidity Value="True"/>
48+
</CodeGeneration>
49+
<Linking>
50+
<Debugging>
51+
<DebugInfoType Value="dsDwarf3"/>
52+
<UseHeaptrc Value="True"/>
53+
<TrashVariables Value="True"/>
54+
<UseExternalDbgSyms Value="True"/>
55+
</Debugging>
56+
</Linking>
57+
</CompilerOptions>
58+
</Item2>
59+
<Item3 Name="Release">
60+
<CompilerOptions>
61+
<Version Value="11"/>
62+
<PathDelim Value="\"/>
63+
<Target>
64+
<Filename Value="npush"/>
65+
</Target>
66+
<SearchPaths>
67+
<IncludeFiles Value="$(ProjOutDir);.."/>
68+
<OtherUnitFiles Value="..\..\..\DatenSteuerung;..\..;.."/>
69+
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
70+
</SearchPaths>
71+
<CodeGeneration>
72+
<SmartLinkUnit Value="True"/>
73+
<Optimizations>
74+
<OptimizationLevel Value="3"/>
75+
</Optimizations>
76+
</CodeGeneration>
77+
<Linking>
78+
<Debugging>
79+
<GenerateDebugInfo Value="False"/>
80+
<RunWithoutDebug Value="True"/>
81+
</Debugging>
82+
<LinkSmart Value="True"/>
83+
</Linking>
84+
</CompilerOptions>
85+
</Item3>
2286
</BuildModes>
2387
<PublishOptions>
2488
<Version Value="2"/>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

use/components.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LNet

0 commit comments

Comments
 (0)