├── .github └── workflows │ └── workflow.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md └── src ├── frmmainunit.lfm ├── frmmainunit.pas ├── lazaruswithgithubactions.ico ├── lazaruswithgithubactions.lpi ├── lazaruswithgithubactions.lpr └── resourceunit.pas /.github/workflows/workflow.yml: -------------------------------------------------------------------------------- 1 | name: build-test 2 | 3 | on: 4 | pull_request: 5 | push: 6 | paths-ignore: [ "README.md" ] 7 | branches: [ "master", "releases/*" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ${{ matrix.operating-system }} 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | operating-system: [ubuntu-latest, windows-latest, macos-latest] 16 | lazarus-versions: ["dist", "stable", "3.4", "2.2.6"] 17 | 18 | steps: 19 | - name: Cechout source code 20 | uses: actions/checkout@v4 21 | 22 | - name: Install Lazarus 23 | uses: gcarreno/setup-lazarus@master 24 | with: 25 | lazarus-version: ${{ matrix.lazarus-versions }} 26 | include-packages: "Synapse 40.1" 27 | with-cache: false 28 | 29 | - name: Build the Main Application (Windows) 30 | if: ${{ matrix.operating-system == 'windows-latest' }} 31 | run: lazbuild -B --bm=Release "src/lazaruswithgithubactions.lpi" 32 | 33 | - name: Build the Main Application (Ubuntu) 34 | if: ${{ matrix.operating-system == 'ubuntu-latest' }} 35 | run: lazbuild -B --bm=Release "src/lazaruswithgithubactions.lpi" 36 | # echo Installing Qt5 Dev 37 | # sudo apt update 38 | # sudo apt install libqt5pas-dev -y 39 | # echo Building with Qt5 40 | # lazbuild -B --bm=Release --ws=qt5 "src/lazaruswithgithubactions.lpi" 41 | 42 | - name: Build the Main Application (macOS) 43 | if: ${{ matrix.operating-system == 'macos-latest' }} 44 | run: lazbuild -B --bm=Release --ws=cocoa "src/lazaruswithgithubactions.lpi" 45 | 46 | - name: Build the Unit Tests Application 47 | run: lazbuild -B --bm=Release "tests/testconsoleapplication.lpi" 48 | 49 | - name: Run the Unit Tests Application 50 | run: bin/testconsoleapplication "--all" "--format=plain" 51 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | I'm very happy that anyone wants to contribute! 4 | 5 | At the moment the only guideline is for commit messages. 6 | 7 | ## Commit Messages 8 | 9 | (Originally from the [Udacity Git Commit Message Style Guide](https://udacity.github.io/git-styleguide/index.html)) 10 | 11 | ### Message Structure 12 | 13 | A commit messages consists of three distinct parts separated by a blank line: the title, an optional body and an optional footer. The layout looks like this: 14 | 15 | ``` 16 | type: subject 17 | 18 | body 19 | 20 | footer 21 | ``` 22 | 23 | The title consists of the type of the message and subject. 24 | 25 | ### The Type 26 | 27 | The type is contained within the title and can be one of these types: 28 | 29 | * feat: a new feature 30 | * fix: a bug fix 31 | * docs: changes to documentation 32 | * style: formatting, missing semi colons, etc; no code change 33 | * refactor: refactoring production code 34 | * test: adding tests, refactoring test; no production code change 35 | * chore: updating build tasks, package manager configs, etc; no production code change 36 | 37 | ### The Subject 38 | 39 | Subjects should be no greater than 50 characters, should begin with a capital letter and do not end with a period. 40 | 41 | Use an imperative tone to describe what a commit does, rather than what it did. For example, use change; not changed or changes. 42 | The Body 43 | 44 | Not all commits are complex enough to warrant a body, therefore it is optional and only used when a commit requires a bit of explanation and context. Use the body to explain the what and why of a commit, not the how. 45 | 46 | When writing a body, the blank line between the title and the body is required and you should limit the length of each line to no more than 72 characters. 47 | 48 | ### The Footer 49 | 50 | The footer is optional and is used to reference issue tracker IDs. 51 | 52 | ### Example Commit Message 53 | 54 | ``` 55 | feat: Summarize changes in around 50 characters or less 56 | 57 | More detailed explanatory text, if necessary. Wrap it to about 72 58 | characters or so. In some contexts, the first line is treated as the 59 | subject of the commit and the rest of the text as the body. The 60 | blank line separating the summary from the body is critical (unless 61 | you omit the body entirely); various tools like `log`, `shortlog` 62 | and `rebase` can get confused if you run the two together. 63 | 64 | Explain the problem that this commit is solving. Focus on why you 65 | are making this change as opposed to how (the code explains that). 66 | Are there side effects or other unintuitive consequenses of this 67 | change? Here's the place to explain them. 68 | 69 | Further paragraphs come after blank lines. 70 | 71 | - Bullet points are okay, too 72 | 73 | - Typically a hyphen or asterisk is used for the bullet, preceded 74 | by a single space, with blank lines in between, but conventions 75 | vary here 76 | 77 | If you use an issue tracker, put references to them at the bottom, 78 | like this: 79 | 80 | Resolves: #123 81 | See also: #456, #789 82 | ``` 83 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Gustavo Carreno 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lazarus-with-github-actions 2 | 3 | [![Actions Status](https://github.com/gcarreno/lazarus-with-github-actions/workflows/build-test/badge.svg)](https://github.com/gcarreno/lazarus-with-github-actions/actions) 4 | 5 | Testing grounds for the GitHub action [setup-lazarus](https://github.com/gcarreno/setup-lazarus) 6 | 7 | **Note**: For supported Lazarus versions and the associated FPC version consult the link above. 8 | 9 | ![setup-lazarus logo](https://github.com/gcarreno/setup-lazarus/blob/master/images/setup-lazarus-logo.png) 10 | 11 | ## VERY IMPORTANT NOTICE 12 | 13 | > When build for the `Qt5` widgetset, the combination of `stable`/`v3.0` and `ubuntu-latest`/`ubuntu-22.04` is going to fail. 14 | > 15 | > This is why this example is failing when attempting the mentioned combination of widgetset, Lazarus version and Ubuntu version. 16 | > 17 | > This is due to the fact that `libqt5pas` is outdated and does not support the new code delivered by Lazarus 3.0. 18 | > 19 | > This is a problem related to the Ubuntu distribution's repositories and the version of `libqt5pas` they carry, used by the GitHub runners. 20 | > 21 | > According to the maintainer of said `libqt5pas`, in [this answer](https://forum.lazarus.freepascal.org/index.php/topic,65619.msg500216.html#msg500216), one solution is to have the workflow script download and install a newer version. 22 | > 23 | > The newer version can be obtained here: https://github.com/davidbannon/libqt5pas/releases 24 | > 25 | > Thank you for your patience, continued support and please accept my deepest apologies for this inconvenience. 26 | 27 | ## Example usage 28 | 29 | ```yaml 30 | steps: 31 | - uses: actions/checkout@v4 32 | - uses: gcarreno/setup-lazarus@v3 33 | with: 34 | lazarus-version: "dist" 35 | include-packages: "Synapse 40.1" 36 | with-cache: true 37 | - run: lazbuild YourTestProject.lpi 38 | - run: YourTestProject 39 | ``` 40 | 41 | ## Matrix example usage 42 | 43 | ```yaml 44 | name: build 45 | 46 | on: 47 | pull_request: 48 | push: 49 | paths-ignore: 50 | - "README.md" 51 | branches: 52 | - master 53 | - releases/* 54 | 55 | jobs: 56 | build: 57 | runs-on: ${{ matrix.operating-system }} 58 | strategy: 59 | matrix: 60 | operating-system: [ubuntu-18.04,ubuntu-latest] 61 | lazarus-versions: [dist, stable, 2.0.12, 2.0.10] 62 | steps: 63 | - uses: actions/checkout@v4 64 | - name: Install Lazarus 65 | uses: gcarreno/setup-lazarus@v3 66 | with: 67 | lazarus-version: ${{ matrix.lazarus-versions }} 68 | include-packages: "Synapse 40.1" 69 | with-cache: true 70 | - name: Build the Main Application (Windows) 71 | if: ${{ matrix.operating-system == 'windows-latest' }} 72 | run: lazbuild -B --bm=Release "src/lazaruswithgithubactions.lpi" 73 | - name: Build the Main Application (Ubuntu) 74 | if: ${{ matrix.operating-system == 'ubuntu-latest' }} 75 | run: | 76 | echo Building with GTK2 77 | lazbuild -B --bm=Release "src/lazaruswithgithubactions.lpi" 78 | echo Installing Qt5 Dev 79 | sudo apt update 80 | sudo apt install libqt5pas-dev -y 81 | echo Building with Qt5 82 | lazbuild -B --bm=Release --ws=qt5 "src/lazaruswithgithubactions.lpi" 83 | - name: Build the Main Application (macOS) 84 | if: ${{ matrix.operating-system == 'macos-latest' }} 85 | run: lazbuild -B --bm=Release --ws=cocoa "src/lazaruswithgithubactions.lpi" 86 | - name: Build the Unit Tests Application 87 | run: lazbuild -B --bm=Release "tests/testconsoleapplication.lpi" 88 | - name: Run the Unit Tests Application 89 | run: bin/testconsoleapplication "--all" "--format=plain" 90 | ``` 91 | -------------------------------------------------------------------------------- /src/frmmainunit.lfm: -------------------------------------------------------------------------------- 1 | object frmMain: TfrmMain 2 | Left = 377 3 | Height = 358 4 | Top = 182 5 | Width = 589 6 | Caption = 'Lazarus with GitHub Actions' 7 | ClientHeight = 358 8 | ClientWidth = 589 9 | OnCreate = FormCreate 10 | Position = poScreenCenter 11 | object Panel1: TPanel 12 | Left = 0 13 | Height = 80 14 | Top = 0 15 | Width = 589 16 | Align = alTop 17 | Caption = 'Panel1' 18 | TabOrder = 0 19 | end 20 | object Panel2: TPanel 21 | Left = 0 22 | Height = 50 23 | Top = 308 24 | Width = 589 25 | Align = alBottom 26 | ClientHeight = 50 27 | ClientWidth = 589 28 | TabOrder = 1 29 | object Button1: TButton 30 | Left = 16 31 | Height = 33 32 | Top = 8 33 | Width = 174 34 | AutoSize = True 35 | Caption = 'Trigger HTTP Client GET' 36 | OnClick = Button1Click 37 | TabOrder = 0 38 | end 39 | end 40 | object Memo1: TMemo 41 | Left = 0 42 | Height = 228 43 | Top = 80 44 | Width = 589 45 | Align = alClient 46 | ReadOnly = True 47 | ScrollBars = ssAutoVertical 48 | TabOrder = 2 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /src/frmmainunit.pas: -------------------------------------------------------------------------------- 1 | unit frmMainUnit; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | interface 6 | 7 | uses 8 | Classes 9 | , SysUtils 10 | , Forms 11 | , Controls 12 | , Graphics 13 | , Dialogs 14 | , ExtCtrls 15 | , StdCtrls 16 | , httpsend 17 | , ResourceUnit 18 | ; 19 | 20 | type 21 | 22 | { TfrmMain } 23 | TfrmMain = class(TForm) 24 | Memo1: TMemo; 25 | Panel1: TPanel; 26 | Panel2: TPanel; 27 | Button1: TButton; 28 | procedure Button1Click(Sender: TObject); 29 | procedure FormCreate(Sender: TObject); 30 | private 31 | 32 | public 33 | 34 | end; 35 | 36 | var 37 | frmMain: TfrmMain; 38 | 39 | implementation 40 | 41 | {$R *.lfm} 42 | 43 | { TfrmMain } 44 | 45 | procedure TfrmMain.FormCreate(Sender: TObject); 46 | begin 47 | Panel1.Caption:= rsTitle; 48 | end; 49 | 50 | procedure TfrmMain.Button1Click(Sender: TObject); 51 | var 52 | http: THTTPSend; 53 | begin 54 | try 55 | Button1.Enabled:= False; 56 | Memo1.Append(rsGet); 57 | Application.ProcessMessages; 58 | http:= THTTPSend.Create; 59 | try 60 | http.HTTPMethod('GET', 'http://packages.lazarus-ide.org/packagelist.json'); 61 | Memo1.Append(rsGetDone); 62 | except 63 | on e: Exception do 64 | begin 65 | Memo1.Append(rsGetNotDone); 66 | ShowMessage(e.Message); 67 | end; 68 | end; 69 | finally 70 | http.Free; 71 | Application.ProcessMessages; 72 | Button1.Enabled:= True 73 | end; 74 | end; 75 | 76 | end. 77 | 78 | -------------------------------------------------------------------------------- /src/lazaruswithgithubactions.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gcarreno/lazarus-with-github-actions/5f2e650edbbfdf78d9b0365d28987b75622984f1/src/lazaruswithgithubactions.ico -------------------------------------------------------------------------------- /src/lazaruswithgithubactions.lpi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <Scaled Value="True"/> 10 | <ResourceType Value="res"/> 11 | <UseXPManifest Value="True"/> 12 | <XPManifest> 13 | <DpiAware Value="True"/> 14 | </XPManifest> 15 | <Icon Value="0"/> 16 | </General> 17 | <BuildModes Count="3"> 18 | <Item1 Name="Default" Default="True"/> 19 | <Item2 Name="Debug"> 20 | <CompilerOptions> 21 | <Version Value="11"/> 22 | <Target> 23 | <Filename Value="../bin/lazaruswithgithubactions"/> 24 | </Target> 25 | <SearchPaths> 26 | <IncludeFiles Value="$(ProjOutDir)"/> 27 | <UnitOutputDirectory Value="../bin/lib/$(TargetCPU)-$(TargetOS)"/> 28 | </SearchPaths> 29 | <Parsing> 30 | <SyntaxOptions> 31 | <IncludeAssertionCode Value="True"/> 32 | </SyntaxOptions> 33 | </Parsing> 34 | <CodeGeneration> 35 | <Checks> 36 | <IOChecks Value="True"/> 37 | <RangeChecks Value="True"/> 38 | <OverflowChecks Value="True"/> 39 | <StackChecks Value="True"/> 40 | </Checks> 41 | <VerifyObjMethodCallValidity Value="True"/> 42 | </CodeGeneration> 43 | <Linking> 44 | <Debugging> 45 | <DebugInfoType Value="dsDwarf2Set"/> 46 | <UseHeaptrc Value="True"/> 47 | <TrashVariables Value="True"/> 48 | <UseExternalDbgSyms Value="True"/> 49 | </Debugging> 50 | <Options> 51 | <Win32> 52 | <GraphicApplication Value="True"/> 53 | </Win32> 54 | </Options> 55 | </Linking> 56 | </CompilerOptions> 57 | </Item2> 58 | <Item3 Name="Release"> 59 | <CompilerOptions> 60 | <Version Value="11"/> 61 | <Target> 62 | <Filename Value="../bin/lazaruswithgithubactions"/> 63 | </Target> 64 | <SearchPaths> 65 | <IncludeFiles Value="$(ProjOutDir)"/> 66 | <UnitOutputDirectory Value="../bin/lib/$(TargetCPU)-$(TargetOS)"/> 67 | </SearchPaths> 68 | <CodeGeneration> 69 | <SmartLinkUnit Value="True"/> 70 | <Optimizations> 71 | <OptimizationLevel Value="3"/> 72 | </Optimizations> 73 | </CodeGeneration> 74 | <Linking> 75 | <Debugging> 76 | <GenerateDebugInfo Value="False"/> 77 | </Debugging> 78 | <LinkSmart Value="True"/> 79 | <Options> 80 | <Win32> 81 | <GraphicApplication Value="True"/> 82 | </Win32> 83 | </Options> 84 | </Linking> 85 | </CompilerOptions> 86 | </Item3> 87 | </BuildModes> 88 | <PublishOptions> 89 | <Version Value="2"/> 90 | <UseFileFilters Value="True"/> 91 | </PublishOptions> 92 | <RunParams> 93 | <FormatVersion Value="2"/> 94 | <Modes Count="0"/> 95 | </RunParams> 96 | <RequiredPackages Count="2"> 97 | <Item1> 98 | <PackageName Value="laz_synapse"/> 99 | </Item1> 100 | <Item2> 101 | <PackageName Value="LCL"/> 102 | </Item2> 103 | </RequiredPackages> 104 | <Units Count="3"> 105 | <Unit0> 106 | <Filename Value="lazaruswithgithubactions.lpr"/> 107 | <IsPartOfProject Value="True"/> 108 | <UnitName Value="LazarusWithGitHubActions"/> 109 | </Unit0> 110 | <Unit1> 111 | <Filename Value="frmmainunit.pas"/> 112 | <IsPartOfProject Value="True"/> 113 | <ComponentName Value="frmMain"/> 114 | <HasResources Value="True"/> 115 | <ResourceBaseClass Value="Form"/> 116 | <UnitName Value="frmMainUnit"/> 117 | </Unit1> 118 | <Unit2> 119 | <Filename Value="resourceunit.pas"/> 120 | <IsPartOfProject Value="True"/> 121 | <UnitName Value="ResourceUnit"/> 122 | </Unit2> 123 | </Units> 124 | </ProjectOptions> 125 | <CompilerOptions> 126 | <Version Value="11"/> 127 | <Target> 128 | <Filename Value="../bin/lazaruswithgithubactions"/> 129 | </Target> 130 | <SearchPaths> 131 | <IncludeFiles Value="$(ProjOutDir)"/> 132 | <UnitOutputDirectory Value="../bin/lib/$(TargetCPU)-$(TargetOS)"/> 133 | </SearchPaths> 134 | <Linking> 135 | <Options> 136 | <Win32> 137 | <GraphicApplication Value="True"/> 138 | </Win32> 139 | </Options> 140 | </Linking> 141 | </CompilerOptions> 142 | <Debugging> 143 | <Exceptions Count="3"> 144 | <Item1> 145 | <Name Value="EAbort"/> 146 | </Item1> 147 | <Item2> 148 | <Name Value="ECodetoolError"/> 149 | </Item2> 150 | <Item3> 151 | <Name Value="EFOpenError"/> 152 | </Item3> 153 | </Exceptions> 154 | </Debugging> 155 | </CONFIG> 156 | -------------------------------------------------------------------------------- /src/lazaruswithgithubactions.lpr: -------------------------------------------------------------------------------- 1 | program LazarusWithGitHubActions; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | {$IFDEF UNIX} 7 | cthreads, 8 | {$ENDIF} 9 | Interfaces, // this includes the LCL widgetset 10 | Forms, frmMainUnit 11 | { you can add units after this }; 12 | 13 | {$R *.res} 14 | 15 | begin 16 | RequireDerivedFormResource:=True; 17 | {$IF FPC_FULLVERSION >= 30004} 18 | Application.Scaled:=True; 19 | {$ENDIF} 20 | Application.Initialize; 21 | Application.CreateForm(TfrmMain, frmMain); 22 | Application.Run; 23 | end. 24 | 25 | -------------------------------------------------------------------------------- /src/resourceunit.pas: -------------------------------------------------------------------------------- 1 | unit ResourceUnit; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | interface 6 | 7 | resourcestring 8 | rsTitle = 'Github actions with Lazarus'; 9 | rsGet = 'Retrieving packagelist.json'; 10 | rsGetDone = 'Retrieval succesful'; 11 | rsGetNotDone = 'Retrieval NOT succesful'; 12 | 13 | 14 | implementation 15 | 16 | end. 17 | --------------------------------------------------------------------------------