Skip to content

Commit 2d64bf0

Browse files
committed
Added CI
1 parent abca353 commit 2d64bf0

File tree

7 files changed

+101
-5
lines changed

7 files changed

+101
-5
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
workflow_dispatch:
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup .NET Core
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: '8.0.x'
22+
23+
- name: Build
24+
run: dotnet build --configuration Release
25+
26+
- name: Run tests
27+
run: dotnet test
28+
29+
- name: Generate NuGet
30+
run: |
31+
cd src/
32+
dotnet pack -o package /p:Version=$(date "+%-Y.%-m.%-d")
33+
34+
- uses: actions/upload-artifact@v4.3.6
35+
with:
36+
name: nugets
37+
path: src/package/*.nupkg

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy to production (Nugets)
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
publish_nuget:
6+
description: "Publish Devolutions.XTS.NET"
7+
required: true
8+
type: boolean
9+
10+
publish_dry_run:
11+
description: "Dry Run Mode"
12+
required: true
13+
type: boolean
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
environment: publish
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Check out devolutions/actions
22+
uses: actions/checkout@v4
23+
with:
24+
path: ./.github/workflows
25+
ref: v1
26+
repository: Devolutions/actions
27+
token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }}
28+
29+
- name: Install toolbox
30+
uses: ./.github/workflows/toolbox-install
31+
with:
32+
github_token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }}
33+
34+
- name: Download Nugets Artifact
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
CI: true
38+
run: |
39+
dv github download-artifact nugets . XTS.NET
40+
41+
- name: Extract Artifacts
42+
run: |
43+
7z x nugets.zip -o./nugets
44+
45+
- name: Publish NuGet
46+
if: ${{ inputs.publish_nuget }}
47+
run: |
48+
COMMAND="dotnet nuget push ./nugets/Devolutions.XTS.NET.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json"
49+
50+
if [ '${{ inputs.publish_dry_run }}' == 'true' ]; then
51+
echo "Dry Run : True"
52+
else
53+
echo "Dry Run : False"
54+
fi
55+
56+
echo "Running : $COMMAND"
57+
58+
if [ "${{ inputs.publish_dry_run }}" != "true" ]; then # if not dry run, actually run the command
59+
eval "$COMMAND"
60+
fi

XTS.NET.Benchmarks/XTS.NET.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<ProjectReference Include="..\XTS.NET.csproj" />
15+
<ProjectReference Include="..\src\XTS.NET.csproj" />
1616
</ItemGroup>
1717

1818
</Project>

XTS.NET.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XTS.NET", "XTS.NET.csproj", "{DB2D8001-9562-4042-883D-69D4C75E647C}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XTS.NET", "src\XTS.NET.csproj", "{DB2D8001-9562-4042-883D-69D4C75E647C}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XTS.NET.Tests", "tests\XTS.NET.Tests.csproj", "{AE300E49-FCCD-45D6-A32C-6E133148DF02}"
99
EndProject
File renamed without changes.

src/XTS.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Numerics;
1+
using System.Numerics;
32
using System.Security.Cryptography;
43

54
namespace XTS.NET;

tests/XTS.NET.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</ItemGroup>
2222

2323
<ItemGroup>
24-
<ProjectReference Include="..\XTS.NET.csproj" />
24+
<ProjectReference Include="..\src\XTS.NET.csproj" />
2525
</ItemGroup>
2626

2727
</Project>

0 commit comments

Comments
 (0)