Skip to content

Commit 5d2f499

Browse files
Initial Commit
0 parents  commit 5d2f499

32 files changed

Lines changed: 1892 additions & 0 deletions
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: setup-env
2+
description: Setup Environment
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup .NET
8+
uses: actions/setup-dotnet@v4
9+
with:
10+
dotnet-version: '10.0.x'
11+
12+
- name: Install packaging tools
13+
shell: bash
14+
run: |
15+
sudo apt-get install -y rpm
16+
17+
- name: Print .NET version and SDKs
18+
shell: bash
19+
run: |
20+
dotnet --version
21+
dotnet --list-sdks

.github/workflows/build-nuget.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build .NET tool
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Environment
20+
uses: ./.github/actions/setup-env
21+
22+
- name: Build Artifacts
23+
run: dotnet pack ./Shipyard/Shipyard.csproj --configuration Release --output "./artifacts"
24+
25+
- name: Push to NuGet
26+
env:
27+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
28+
run: dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key $NUGET_API_KEY

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: .NET Build
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
pull_request:
8+
branches:
9+
- '*'
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
name: Build & Test
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
steps:
19+
- name: Checkout Repo
20+
uses: actions/checkout@v6
21+
22+
- name: Setup Environment
23+
uses: ./.github/actions/setup-env
24+
25+
- name: Build
26+
run: dotnet build --configuration Debug --no-incremental
27+
28+
- name: Test
29+
run: dotnet run ./Shipyard/Shipyard.csproj -- --config ./Shipyard.Demo/shipyard.json --output ./publish

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
bin/
2+
obj/
3+
/packages/
4+
riderModule.iml
5+
/_ReSharper.Caches/
6+
*.user
7+
.idea/
8+
*opencover.xml
9+
coverage.xml
10+
TestResults/
11+
/publish/
12+
codeql-pack.lock.yml

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"ms-dotnettools.csharp",
4+
"ms-dotnettools.vscode-dotnet-runtime",
5+
"github.vscode-github-actions"
6+
]
7+
}

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "coreclr",
6+
"name": "Debug - Shipyard.Demo",
7+
"request": "launch",
8+
"preLaunchTask": "build",
9+
"program": "${workspaceFolder}/Shipyard/bin/Debug/net10.0/shipyard",
10+
"args": ["--config", "${workspaceFolder}/Shipyard.Demo/shipyard.json", "--output", "${workspaceFolder}/publish"],
11+
"cwd": "${workspaceFolder}",
12+
"console": "internalConsole",
13+
"stopAtEntry": false
14+
}
15+
]
16+
}

.vscode/tasks.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "process",
6+
"label": "build",
7+
"command": "dotnet",
8+
"args": [
9+
"build",
10+
"/property:GenerateFullPaths=true",
11+
"/consoleloggerparameters:NoSummary"
12+
]
13+
}
14+
]
15+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Nickolas Gupton
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.

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Shipyard
2+
3+
Project to build and package .NET applications on Linux.
4+
5+
Current focus:
6+
- RPM Packages
7+
8+
Future Goals:
9+
- DEB Packages
10+
- Flatpaks
11+
- Snaps
12+
- AppImage
13+
- tarball
14+
15+
## Architecture
16+
- Project build configuration should live in a single file, ideally one that can easily be checked into source control right along side the source code.
17+
- Going with a JSON config for now, yaml might be nice to add support for later for folks that prefer it.
18+
- Each project should only need 1 build configuration, even if they want to build for multiple platforms (x86_64, aarch64).
19+
- Each package that is output should have its own package config, these package configs should only contain that package types specific configuration. (eg. if building both DEB and RPM packages for the same platform they shouldn't both need to specify the platform).
20+
- When possible, the Shipyard should use standard packaging tools and fit neatly into the ecosystem, without overstepping where it doesn't need to. (eg. Use rpmbuild to build RPM packages instead of reinventing the wheel).
21+
- The main application flow I forsee with this is:
22+
1. User runs `shipyard --config path/to/shipyard.json --output path/to/output/dir`
23+
2. Shipyard reads and deserializes the configuration file into ProjectConfig.
24+
3. Shipyard validates the configuration.
25+
- If invalid, it outputs errors and exits.
26+
- This should include validating that required fields for the selected package formats are present.
27+
- This should also include verifying that the target project exists and can be built with the specified settings.
28+
4. Shipyard does a dotnet publish of the target project to the $"{output}/publish-{arch}{(selfContained ? string.Empty : "-sc")}" directory.
29+
-- `dotnet publish ./Example/Example.csproj --output ./publish-x86_64 --configuration Release --framework net10.0 --runtime linux-x64 --no-self-contained --verbosity minimal` or similar
30+
5. Shipyard uses the Packagers to create the packages for each of the package type configs in the ProjectConfig.
31+
- This allows, for example, building both x86_64 and aarch64 RPMs and DEBs (4 packages total in this example) at the same time.
32+
6. Shipyard outputs the generated packages to the the $"{output}" directory.
33+
- Hopefully ending up with a filesystem that looks something like this with the example above:
34+
- $"{output}/publish-x64"
35+
- $"{output}/publish-arm64"
36+
- $"{output}/Project-1.0.0-1.arm64.deb"
37+
- $"{output}/Project-1.0.0-1.arm64.rpm"
38+
- $"{output}/Project-1.0.0-1.x64.deb"
39+
- $"{output}/Project-1.0.0-1.x64.rpm"
40+

Shipyard.Demo/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <summary>
2+
/// Small example application to test Shipyard functionality.
3+
/// </summary>
4+
5+
// See https://aka.ms/new-console-template for more information
6+
Console.WriteLine("Hello, World!");

0 commit comments

Comments
 (0)