Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "feature/*" ]

env:
VERSION: 0.0.0-local

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read # default is read; fine for checkout/build/test
actions: read
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test -c Release --no-build --verbosity normal
28 changes: 0 additions & 28 deletions .github/workflows/build.yml

This file was deleted.

112 changes: 112 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "main" ]
tags: [ "v*" ]
pull_request:
branches: [ "main" ]

env:
VERSION: 0.0.0-local

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read # default is read; fine for checkout/build/test
actions: read
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Set version
run: |
if [[ "$GITHUB_REF_TYPE" == "tag" && "$GITHUB_REF_NAME" == v* ]]; then
VERSION="${GITHUB_REF_NAME#v}"
else
VERSION="0.0.0-local"
fi
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release /p:Version=${{ env.VERSION }}
- name: Test
run: dotnet test -c Release --no-build --verbosity normal

publish:
needs: test
runs-on: ubuntu-latest
permissions:
actions: write # required for actions/upload-artifact
contents: read
strategy:
matrix:
rid: [ linux-x64, osx-x64, win-x64 ]
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Set version
run: |
if [[ "$GITHUB_REF_TYPE" == "tag" && "$GITHUB_REF_NAME" == v* ]]; then
VERSION="${GITHUB_REF_NAME#v}"
else
VERSION="0.0.0-local"
fi
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Publish self-contained single file
run: dotnet publish src/CsvToOfx.Cli/CsvToOfx.Cli.csproj -c Release -r ${{ matrix.rid }} --self-contained true --framework net8.0 /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:Version=${{ env.VERSION }}
- name: Archive artifact
run: |
cd src/CsvToOfx.Cli/bin/Release/net8.0/${{ matrix.rid }}/publish
zip -r ../../csv2ofx-${{ env.VERSION }}-${{ matrix.rid }}.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: csv2ofx-${{ matrix.rid }}
path: src/CsvToOfx.Cli/bin/Release/net8.0/${{ matrix.rid }}/publish/
- name: Upload release zip
uses: actions/upload-artifact@v4
with:
name: csv2ofx-zip-${{ matrix.rid }}
path: src/CsvToOfx.Cli/bin/Release/net8.0/csv2ofx-${{ env.VERSION }}-${{ matrix.rid }}.zip

release:
needs: publish
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write # required for creating a release
actions: read
steps:
- name: Set version
run: |
if [[ "$GITHUB_REF_TYPE" == "tag" && "$GITHUB_REF_NAME" == v* ]]; then
VERSION="${GITHUB_REF_NAME#v}"
else
VERSION="0.0.0-local"
fi
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
files: |
artifacts/csv2ofx-zip-linux-x64/csv2ofx-${{ env.VERSION }}-linux-x64.zip
artifacts/csv2ofx-zip-osx-x64/csv2ofx-${{ env.VERSION }}-osx-x64.zip
artifacts/csv2ofx-zip-win-x64/csv2ofx-${{ env.VERSION }}-win-x64.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 7 additions & 1 deletion src/CsvToOfx.Cli/CsvToOfx.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Resources\SecurityMap.csv" />
</ItemGroup>


<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<LangVersion>14</LangVersion>
</PropertyGroup>

</Project>
14 changes: 8 additions & 6 deletions src/CsvToOfx.Cli/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using CsvToOfx.Core.Models;
using CsvToOfx.Core.Models;
using CsvToOfx.Core.Services;
using CsvToOfx.Parsers.Abstractions;
using CsvToOfx.Writers.Ofx;
Expand All @@ -8,16 +7,19 @@
// -------------------------------
// 1) DI container
// -------------------------------
var preferCusip = true;
var securityArg = GetArg("security-id-type", args);
if (!string.IsNullOrWhiteSpace(securityArg) && securityArg.Equals("ticker", StringComparison.OrdinalIgnoreCase))
preferCusip = false;

var services = new ServiceCollection()
// Core services (make sure these exist in CsvToOfx.Core/Services)
.AddSingleton<DateParser>()
.AddSingleton<AmountParser>()
.AddSingleton<FitIdGenerator>()
.AddSingleton<SubacctResolver>()
.AddSingleton<OutputPathService>() // <-- MISSING previously
.AddSingleton<SecurityResolver>(_ =>
// TODO: load a real ticker->CUSIP map later; empty for now
new SecurityResolver(new Dictionary<string, string>()))
.AddSingleton<OutputPathService>()
.AddSingleton<SecurityResolver>(_ => new SecurityResolver(preferCusip))
// Writers
.AddSingleton<IOfxWriter, OfxWriter>()
.BuildServiceProvider();
Expand Down
Loading
Loading