Skip to content
Open
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
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches: ['**']
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Install WASM workload
run: dotnet workload install wasm-tools

- name: Restore
run: dotnet restore src/HealthNerd.Wasm/HealthNerd.Wasm.csproj

- name: Build
run: dotnet build src/HealthNerd.Wasm/HealthNerd.Wasm.csproj -c Release --no-restore

- name: Publish (dry-run to verify WASM output)
run: dotnet publish src/HealthNerd.Wasm/HealthNerd.Wasm.csproj -c Release --no-restore -o ./publish

- name: Verify output exists
run: |
ls -la publish/wwwroot/
test -f publish/wwwroot/index.html
test -f publish/wwwroot/_framework/blazor.webassembly.js
12 changes: 11 additions & 1 deletion .github/workflows/deploy-wasm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Deploy HealthNerd WASM

on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [master]
push:
branches: [master]
paths:
Expand All @@ -10,11 +14,17 @@ on:

jobs:
deploy:
# Only deploy when CI passed (skip on failure or manual trigger without context)
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

steps:
- name: Checkout HealthNerd
uses: actions/checkout@v4
with:
# On workflow_run the default sha is the workflow trigger sha, not the pushed commit.
# Pin to the sha that triggered CI so we build exactly what passed.
ref: ${{ github.event.workflow_run.head_sha || github.sha }}

- name: Setup .NET 8
uses: actions/setup-dotnet@v4
Expand Down Expand Up @@ -46,5 +56,5 @@ jobs:
git config user.name "github-actions[bot]"
git add -A
git diff --staged --quiet && echo "No changes to deploy" && exit 0
git commit -m "Deploy HealthNerd WASM from HealthNerd@${{ github.sha }}"
git commit -m "Deploy HealthNerd WASM from HealthNerd@${{ github.event.workflow_run.head_sha || github.sha }}"
git push
11 changes: 4 additions & 7 deletions src/HealthNerd.Wasm/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
<div class="settings-row">
<label>Custom sheets placement</label>
<select @bind="_settings.CustomSheetsPlacement" @bind:after="SaveSettings">
<option value="BeforeSummary">Before summary</option>
<option value="AfterSummary">After summary</option>
</select>
</div>
Expand Down Expand Up @@ -271,12 +270,10 @@
"Make sure you upload the export.zip produced by the Health app.");

// Filter records by since-date.
// Record.Start is assumed to be NodaTime.LocalDate (verify at compile time).
// If HealthKitData.Core uses a different type (e.g. Instant), adjust the
// comparison accordingly.
var sinceDate = LocalDate.FromDateTime(ws.SinceDate);
var records = loader.Records .Where(r => r.Start >= sinceDate).ToList();
var workouts = loader.Workouts.Where(w => w.Start >= sinceDate).ToList();
// Both Record.StartDate and Workout.StartDate are NodaTime.Instant.
var sinceInstant = Instant.FromDateTimeUtc(DateTime.SpecifyKind(ws.SinceDate, DateTimeKind.Utc));
var records = loader.Records .Where(r => r.StartDate >= sinceInstant).ToList();
var workouts = loader.Workouts.Where(w => w.StartDate >= sinceInstant).ToList();

// Load custom sheets (sheets whose names begin with "custom")
ExcelPackage? customPackage = null;
Expand Down
4 changes: 1 addition & 3 deletions src/HealthNerd.Wasm/Services/SettingsMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ public static Settings ToExcelSettings(WebSettings ws)
OmitEmptyColumnsOnOverallSummary = ws.OmitEmptyColumnsOnOverallSummary,
OmitEmptySheets = ws.OmitEmptySheets,

CustomSheetsPlacement = ws.CustomSheetsPlacement == "BeforeSummary"
? CustomSheetsPlacement.BeforeSummary
: CustomSheetsPlacement.AfterSummary,
CustomSheetsPlacement = CustomSheetsPlacement.AfterSummary,

UseConstantNameForMostRecentMonthlySummarySheet = ws.UseConstantNameForMostRecentMonthlySummarySheet,
UseConstantNameForPreviousMonthlySummarySheet = ws.UseConstantNameForPreviousMonthlySummarySheet,
Expand Down