Skip to content

Commit 49f761f

Browse files
committed
Merge remote-tracking branch 'origin/dev' into release/3.0.0
2 parents f184f8b + 3808a40 commit 49f761f

File tree

9 files changed

+259
-0
lines changed

9 files changed

+259
-0
lines changed

.config/dotnet-tools.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"gitversion.tool": {
6+
"version": "6.0.2",
7+
"commands": ["dotnet-gitversion"],
8+
"rollForward": false
9+
}
10+
}
11+
}

.github/workflows/build.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
name: Build Archicad
7+
8+
on:
9+
push:
10+
branches: ["main", "dev", "release/*", "alan/*"] # Continuous delivery on every long-lived branch
11+
tags: ["v3.*"] # Manual delivery on every 3.x tag
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build:
18+
runs-on: windows-latest
19+
outputs:
20+
version: ${{ steps.set-version.outputs.version }}
21+
file_version: ${{ steps.set-info-version.outputs.file_version }}
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Add MSBuild to PATH
29+
uses: microsoft/setup-msbuild@v2
30+
31+
- name: ⚒️ Run GitVersion
32+
run: ./build.ps1 build-server-version
33+
34+
- name: Build
35+
run: ./build.ps1
36+
37+
- uses: actions/upload-artifact@v4
38+
with:
39+
name: output-${{ env.GitVersion_FullSemVer }}
40+
path: output/*.zip
41+
retention-days: 1
42+
43+
- id: set-version
44+
name: Set version to output
45+
run: echo "version=${{ env.GitVersion_FullSemVer }}" >> "$Env:GITHUB_OUTPUT"
46+
47+
- id: set-info-version
48+
name: Set file version to output
49+
run: echo "file_version=${{ env.GitVersion_AssemblySemVer}}" >> "$Env:GITHUB_OUTPUT" # version will be retrieved from tag?
50+
deploy-installers:
51+
runs-on: ubuntu-latest
52+
needs: build
53+
env:
54+
IS_TAG_BUILD: ${{ github.ref_type == 'tag' }}
55+
IS_RELEASE_BRANCH: true
56+
steps:
57+
- name: 🔫 Trigger Build Installers
58+
uses: ALEEF02/[email protected]
59+
continue-on-error: true
60+
with:
61+
workflow: build-cpp-installers
62+
repo: specklesystems/connector-installers
63+
token: ${{ secrets.CONNECTORS_GH_TOKEN }}
64+
inputs: '{ "run_id": "${{ github.run_id }}", "version": "${{ needs.build.outputs.version }}", "file_version": "${{needs.build.outputs.file_version}}", "public_release": ${{ env.IS_TAG_BUILD }}, "store_artifacts": ${{ env.IS_RELEASE_BRANCH }} }'
65+
ref: alan/update-archicad-installer
66+
wait-for-completion: true
67+
wait-for-completion-interval: 10s
68+
wait-for-completion-timeout: 10m
69+
display-workflow-run-url: true
70+
display-workflow-run-url-interval: 10s
71+
72+
- uses: geekyeggo/delete-artifact@v5
73+
with:
74+
name: output-*

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@
1414
*.bak
1515
*.log
1616
**/*_svg_source/
17+
18+
**/obj
19+
**/bin
20+
**/Thumbs.db
21+
**/output

GitVersion.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
workflow: GitFlow/v1
2+
next-version: 3.0.0
3+
branches:
4+
release:
5+
prevent-increment:
6+
when-current-commit-tagged: true

build.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$ErrorActionPreference = "Stop";
2+
3+
dotnet run --project ci-build/build.csproj -- $args

build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
dotnet run --project Build/Build.csproj -- "$@"

ci-build/Build.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<Configurations>Debug;Release;Local</Configurations>
8+
<ImplicitUsings>true</ImplicitUsings>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<PackageReference Include="Bullseye" Version="5.0.0" />
12+
<PackageReference Include="Glob" Version="1.1.9"/>
13+
<PackageReference Include="Microsoft.Build" Version="17.10.4"/>
14+
<PackageReference Include="SimpleExec" Version="12.0.0" />
15+
</ItemGroup>
16+
</Project>

ci-build/Consts.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace Build;
2+
3+
public static class Consts
4+
{
5+
public static readonly string[] SupportedVersions = new string[] { "27", "28"};
6+
public static readonly string[] Solutions = ["build_27/speckle-archicad.sln", "build_28/speckle-archicad.sln"];
7+
8+
public static readonly InstallerProject[] InstallerManifests =
9+
{
10+
new("archicad", [new("archicad27", "build/27/INT/Release", "*.apx"), new("archicad28", "build/28/INT/Release", "*.apx")])
11+
};
12+
}
13+
14+
public readonly record struct InstallerProject(string HostAppSlug, IReadOnlyList<InstallerAsset> Projects)
15+
{
16+
public override string ToString() => $"{HostAppSlug}";
17+
}
18+
19+
public readonly record struct InstallerAsset(string ConnectorVersion, string OutputPath, string GlobPattern = "*");

ci-build/Program.cs

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
using System.IO.Compression;
2+
using Build;
3+
using GlobExpressions;
4+
using static Bullseye.Targets;
5+
using static SimpleExec.Command;
6+
7+
const string CLEAN = "clean";
8+
const string BUILD = "build";
9+
const string ZIP = "zip";
10+
const string RESTORE_TOOLS = "restore-tools";
11+
const string BUILD_SERVER_VERSION = "build-server-version";
12+
const string RUN_CMAKE = "build-cmake";
13+
14+
Target(
15+
CLEAN,
16+
ForEach("**/output"),
17+
dir =>
18+
{
19+
IEnumerable<string> GetDirectories(string d)
20+
{
21+
return Glob.Directories(".", d);
22+
}
23+
24+
void RemoveDirectory(string d)
25+
{
26+
if (Directory.Exists(d))
27+
{
28+
Console.WriteLine(d);
29+
Directory.Delete(d, true);
30+
}
31+
}
32+
33+
foreach (var d in GetDirectories(dir))
34+
{
35+
RemoveDirectory(d);
36+
}
37+
}
38+
);
39+
40+
Target(
41+
RESTORE_TOOLS,
42+
() =>
43+
{
44+
Run("dotnet", "tool restore");
45+
}
46+
);
47+
48+
Target(
49+
BUILD_SERVER_VERSION,
50+
DependsOn(RESTORE_TOOLS),
51+
() =>
52+
{
53+
Run("dotnet", "tool run dotnet-gitversion /output json /output buildserver");
54+
}
55+
);
56+
57+
Target(RUN_CMAKE, Consts.SupportedVersions, s =>
58+
{
59+
Run("cmake", $"-G \"Visual Studio 17 2022\" -T v142 -A \"x64\" -DAC_ADDON_LANGUAGE=\"INT\" -DAC_API_DEVKIT_DIR=\"Libs\\acapi{s}\" -B build\\{s} -DCMAKE_BUILD_TYPE=Release");
60+
});
61+
62+
Target(
63+
BUILD,
64+
DependsOn(RUN_CMAKE),
65+
Consts.SupportedVersions,
66+
s =>
67+
{
68+
var version = Environment.GetEnvironmentVariable("GitVersion_FullSemVer") ?? "3.0.0-localBuild";
69+
var fileVersion = Environment.GetEnvironmentVariable("GitVersion_AssemblySemFileVer") ?? "3.0.0.9999";
70+
Console.WriteLine($"Version: {version} & {fileVersion}");
71+
Run("msbuild", $"./build/{s}/archicad-speckle.sln /p:Configuration=Release /p:Version={version} /p:FileVersion={fileVersion}");
72+
}
73+
);
74+
75+
Target(
76+
ZIP,
77+
DependsOn(BUILD),
78+
Consts.InstallerManifests,
79+
x =>
80+
{
81+
var outputDir = Path.Combine(".", "output");
82+
var slugDir = Path.Combine(outputDir, x.HostAppSlug);
83+
84+
Directory.CreateDirectory(outputDir);
85+
Directory.CreateDirectory(slugDir);
86+
87+
foreach (var asset in x.Projects)
88+
{
89+
var fullPath = Path.Combine(".", asset.OutputPath);
90+
if (!Directory.Exists(fullPath))
91+
{
92+
throw new InvalidOperationException("Could not find: " + fullPath);
93+
}
94+
95+
var assetName = asset.ConnectorVersion;
96+
var connectorDir = Path.Combine(slugDir, assetName);
97+
Directory.CreateDirectory(connectorDir);
98+
foreach (var directory in Directory.EnumerateDirectories(fullPath, asset.GlobPattern, SearchOption.AllDirectories))
99+
{
100+
Directory.CreateDirectory(directory.Replace(fullPath, connectorDir));
101+
}
102+
103+
foreach (var file in Directory.EnumerateFiles(fullPath, asset.GlobPattern, SearchOption.AllDirectories))
104+
{
105+
Console.WriteLine(file);
106+
var destFileName = file.Replace(fullPath, connectorDir);
107+
File.Copy(file, destFileName, true);
108+
}
109+
}
110+
111+
var outputPath = Path.Combine(outputDir, $"{x.HostAppSlug}.zip");
112+
File.Delete(outputPath);
113+
Console.WriteLine($"Zipping: '{slugDir}' to '{outputPath}'");
114+
ZipFile.CreateFromDirectory(slugDir, outputPath);
115+
// Directory.Delete(slugDir, true);
116+
}
117+
);
118+
119+
Target("default", DependsOn(ZIP), () => Console.WriteLine("Done!"));
120+
121+
await RunTargetsAndExitAsync(args).ConfigureAwait(true);

0 commit comments

Comments
 (0)