Skip to content

Commit

Permalink
Cross-platform build using FAKE and Windows Installer with InnoSetup (#…
Browse files Browse the repository at this point in the history
…25)

* feat(setup): Initial installer using InnoSetup

* feat(setup): allow unchecking of CLI

* refactor: moved source code to src and added build project

* feat: Complete Build

* fix: move backup back (tests dont run though)

* chore: remove old files

* fix(build): skip tests

* feat(build): parallelize build

* chore: rename readme to README

* docs(build): document build in CONTRIBUTE.md

* ci: Use FAKE to build and test apps in workflows

* fix(ci): explicitly restore newer version of MSBuild.StructuredLogger

* fix(build): platform differences

* ci/dist must be created before Archive and Vim are run
  But if the target platform is Linux, then they were run together
* Linux executables do not have file extensions

* fix(build): dummy stage to ensure staging is finished before distributing

* fix(build): define Inno toolpath and defines

* fix(setup): No hard-coded paths

* fix(ci): explicitly pass version
  • Loading branch information
janssen-io authored Sep 6, 2024
1 parent d28e1d1 commit 9a02800
Show file tree
Hide file tree
Showing 122 changed files with 399 additions and 144 deletions.
52 changes: 12 additions & 40 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,53 +27,25 @@ jobs:
with:
dotnet-version: 8.x

- name: Test
run: dotnet test

- name: Build
- name: Get version number
id: version
shell: bash
run: |
# Define some variables for things we need
release_name="tql-${{ matrix.target }}"
version=$(cut -c 2- <<< "${{ github.ref_name }}")
echo "Building version > $version <"
# Build everything
dotnet publish TransactionQL.Plugins.ING/TransactionQL.Plugins.ING.fsproj \
-c Release --runtime "${{ matrix.target }}" -o "dist/ing" -p:Version=$version
dotnet publish TransactionQL.Plugins.Bunq/TransactionQL.Plugins.Bunq.fsproj \
-c Release --runtime "${{ matrix.target }}" -o "dist/bunq" -p:Version=$version
dotnet publish TransactionQL.Plugins.ASN/TransactionQL.Plugins.ASN.fsproj \
-c Release --runtime "${{ matrix.target }}" -o "dist/asn" -p:Version=$version
version=`echo "${{ github.ref_name }}" | cut -c 2-`
echo "Setting version to '$version'"
echo "VERSION=$version" >> $GITHUB_OUTPUT
dotnet publish TransactionQL.Console/TransactionQL.Console.fsproj \
-c Release --runtime "${{ matrix.target }}" -o "$release_name/console" \
-p:PublishSingleFile=true --no-self-contained -p:Version=$version
dotnet publish TransactionQL.DesktopApp/TransactionQL.DesktopApp.csproj \
-c Release --runtime "${{ matrix.target }}" -o "$release_name/desktop" \
-p:PublishSingleFile=true --no-self-contained -p:Version=$version
# Copy plugin DLLs
mkdir "$release_name/plugins"
cp "dist/asn/TransactionQL.Plugins.ASN.dll" "$release_name/plugins/asn.dll"
cp "dist/bunq/TransactionQL.Plugins.Bunq.dll" "$release_name/plugins/bunq.dll"
cp "dist/ing/TransactionQL.Plugins.ING.dll" "$release_name/plugins/ing.dll"
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
7z a -tzip "${release_name}.zip" "./${release_name}/*"
else
tar czvf "${release_name}.tar.gz" "$release_name"
fi
# Delete output directory
rm -r "$release_name"
- name: Build
run: >
dotnet run
--project ./src/TransactionQL.Build/TransactionQL.Build.fsproj
-e parallel-jobs=4
-e VERSION=${{ steps.version.outputs.VERSION }}
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "tql*"
files: "./ci/dist/*"
prerelease: ${{ contains(github.ref_name, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ jobs:
run: dotnet format --verify-no-changes --verbosity diagnostic

- name: Test
run: dotnet test
run: >
dotnet run
--project src/TransactionQL.Build/TransactionQL.Build.fsproj
-t Test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ TransactionQL.v3.ncrunchsolution
TransactionQL.lutconfig
todo
copy.sh
setup/*.exe
ci/

# User-specific files
*.suo
Expand Down
51 changes: 51 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Contributing

Feel free to open issues and merge requests!

## Building
The app can be build with FAKE (F#'s make) using the command:
`dotnet run --project src/TransactionQL.Build/TransactionQL.Build.fsproj`

This command supports the following parameters:

| Parameter | Description |
|---------------------------|-------------|
| `-e SkipTests=1` | Do not run the test suite |
| `-e VERSION=1.0.0` | Set the version of the assemblies and apps |
| `-e CONFIGURATION=DEBUG` | Compile the apps in Debug rather than Release |
| `-e parallel-jobs=n` | Use `n` workers to run the build in parallel |
| `-t <target>` | Run the specific target (e.g. `Test`) |

The default target (`Complete`) runs the entire build and copies the
artifacts to the `ci/dist` directory.

### Artifacts
One assembly per plugin. These assemblies are _not_ selfcontained and require
cli or gui to load them. The cli and gui do contain their necessary
dependencies.

The cli is built as a single executable that is published as a single file, but
not self contained. It still requires the .NET runtime to run.

The gui is built as a single executable alongside a few DLLs required for rendering.
It also requires the .NET runtime to run.

### Supported Targets

* **Clean:** Empties the `ci` directory to clean up after previous builds.
* **Restore:** Restores dependencies for the entire solution.
* **Test:** Runs all unit tests.
* **Publish:** Ensures that the `ci/build` folder exists.
* **Publish Plugins:** Builds and copies the plugin assemblies to `ci/build/plugins/`.
* **Publish CLI:** Builds and copies the CLI executable to `ci/build/console/`.
* **Publish GUI:** Builds and copies the GUI files to `ci/build/desktop/`.
* **Stage Artifacts:** Builds and copies just the required application files to `ci/staging/`.
* **Dist:** Ensures that the `ci/dist` folder exists.
* **Setup:** (Windows only) Creates a installer using InnoSetup.
* **Archive:** Bundles the application files into `ci/dist/tql-<platform>-x64.zip`.
* **Vim:** Copies the vim syntax highlighting file to `ci/dist/tql.vim`.
* **Complete:** Runs all of the above.

## Conventions

1. Code must be formatted using `dotnet format` before merging into `main`.
File renamed without changes.
38 changes: 21 additions & 17 deletions TransactionQL.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33502.453
MinimumVisualStudioVersion = 10.0.40219.1
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Parser", "TransactionQL.Parser\TransactionQL.Parser.fsproj", "{5E741343-6C90-480E-BA15-D7267A9482D4}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Parser", "src\TransactionQL.Parser\TransactionQL.Parser.fsproj", "{5E741343-6C90-480E-BA15-D7267A9482D4}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Parser.Tests", "TransactionQL.Parser.Tests\TransactionQL.Parser.Tests.fsproj", "{67D7EF7D-6D2E-4B04-9860-C3D7A7A3F970}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Parser.Tests", "src\TransactionQL.Parser.Tests\TransactionQL.Parser.Tests.fsproj", "{67D7EF7D-6D2E-4B04-9860-C3D7A7A3F970}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{722E35DF-E970-48AF-A7BA-5CF86EAF9670}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
azure-pipelines.yml = azure-pipelines.yml
publish.ps1 = publish.ps1
publish.sh = publish.sh
CONTRIBUTE.md = CONTRIBUTE.md
LICENSE.md = LICENSE.md
.github\workflows\publish.yml = .github\workflows\publish.yml
readme.md = readme.md
README.md = README.md
.github\workflows\test.yml = .github\workflows\test.yml
tql.vim = tql.vim
EndProjectSection
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Input", "TransactionQL.Input\TransactionQL.Input.fsproj", "{89E761CA-7D31-48BE-8B4D-1AC3A268A358}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Input", "src\TransactionQL.Input\TransactionQL.Input.fsproj", "{89E761CA-7D31-48BE-8B4D-1AC3A268A358}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Console", "TransactionQL.Console\TransactionQL.Console.fsproj", "{4A1E69DA-C6CC-48B8-88F3-B62B2AE34485}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Console", "src\TransactionQL.Console\TransactionQL.Console.fsproj", "{4A1E69DA-C6CC-48B8-88F3-B62B2AE34485}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Console.Tests", "TransactionQL.Console.Tests\TransactionQL.Console.Tests.fsproj", "{F43A5F1B-1EB4-45B7-9C79-92F3DD31EEE1}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Console.Tests", "src\TransactionQL.Console.Tests\TransactionQL.Console.Tests.fsproj", "{F43A5F1B-1EB4-45B7-9C79-92F3DD31EEE1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{B645AC52-7FA5-47ED-8162-E39B705813C6}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Plugins.Bunq", "TransactionQL.Plugins.Bunq\TransactionQL.Plugins.Bunq.fsproj", "{EA0A782C-D5BF-4DA6-9710-25FDE5123B79}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Plugins.Bunq", "src\TransactionQL.Plugins.Bunq\TransactionQL.Plugins.Bunq.fsproj", "{EA0A782C-D5BF-4DA6-9710-25FDE5123B79}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Plugins.ING", "TransactionQL.Plugins.ING\TransactionQL.Plugins.ING.fsproj", "{32027311-05E4-465B-9F5A-F5C59768B99A}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Plugins.ING", "src\TransactionQL.Plugins.ING\TransactionQL.Plugins.ING.fsproj", "{32027311-05E4-465B-9F5A-F5C59768B99A}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Plugins.ASN", "TransactionQL.Plugins.ASN\TransactionQL.Plugins.ASN.fsproj", "{F6F92978-83BF-4DB9-B513-2B8ABD22AC5F}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Plugins.ASN", "src\TransactionQL.Plugins.ASN\TransactionQL.Plugins.ASN.fsproj", "{F6F92978-83BF-4DB9-B513-2B8ABD22AC5F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransactionQL.DesktopApp", "TransactionQL.DesktopApp\TransactionQL.DesktopApp.csproj", "{54E23E7B-6F20-4A52-BACA-C2941ADC631F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransactionQL.DesktopApp", "src\TransactionQL.DesktopApp\TransactionQL.DesktopApp.csproj", "{54E23E7B-6F20-4A52-BACA-C2941ADC631F}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Shared", "TransactionQL.Shared\TransactionQL.Shared.fsproj", "{F341E003-6D84-443B-B373-83B640892072}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Shared", "src\TransactionQL.Shared\TransactionQL.Shared.fsproj", "{F341E003-6D84-443B-B373-83B640892072}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Application", "TransactionQL.Application\TransactionQL.Application.fsproj", "{D5623022-6630-4437-8C17-9FBF0A55C46C}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Application", "src\TransactionQL.Application\TransactionQL.Application.fsproj", "{D5623022-6630-4437-8C17-9FBF0A55C46C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransactionQL.DesktopApp.Tests", "TransactionQL.DesktopApp.Tests\TransactionQL.DesktopApp.Tests.csproj", "{75A0C712-1663-49A2-9A06-7B010B042873}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransactionQL.DesktopApp.Tests", "src\TransactionQL.DesktopApp.Tests\TransactionQL.DesktopApp.Tests.csproj", "{75A0C712-1663-49A2-9A06-7B010B042873}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TransactionQL.Build", "src\TransactionQL.Build\TransactionQL.Build.fsproj", "{4EE573F5-E881-430C-80AA-A71DEF20161D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -96,6 +96,10 @@ Global
{75A0C712-1663-49A2-9A06-7B010B042873}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75A0C712-1663-49A2-9A06-7B010B042873}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75A0C712-1663-49A2-9A06-7B010B042873}.Release|Any CPU.Build.0 = Release|Any CPU
{4EE573F5-E881-430C-80AA-A71DEF20161D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EE573F5-E881-430C-80AA-A71DEF20161D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EE573F5-E881-430C-80AA-A71DEF20161D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EE573F5-E881-430C-80AA-A71DEF20161D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
22 changes: 0 additions & 22 deletions azure-pipelines.yml

This file was deleted.

60 changes: 0 additions & 60 deletions publish.ps1

This file was deleted.

4 changes: 0 additions & 4 deletions publish.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/TransactionQL.Build/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"profiles": {
"TransactionQL.Build": {
"commandName": "Project",
"commandLineArgs": "-e parallel-jobs=4"
}
}
}
26 changes: 26 additions & 0 deletions src/TransactionQL.Build/TransactionQL.Build.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<None Include="tql.vim" />
<None Include="tql.iss" />
<Compile Include="build.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Fake.Core.Target" Version="6.1.1" />
<PackageReference Include="Fake.DotNet.Cli" Version="6.1.1" />
<PackageReference Include="Fake.Installer.InnoSetup" Version="6.1.1" />
<PackageReference Include="Fake.IO.Zip" Version="6.1.1" />
<PackageReference Include="MSBuild.StructuredLogger" Version="2.2.337" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="8.0.400" />
</ItemGroup>

</Project>
Loading

0 comments on commit 9a02800

Please sign in to comment.