Skip to content

Commit f1a7e55

Browse files
Version 2.1 (#41)
- Add full chapter support (#6) - Add built-in redirect functionality (#39) - Support building Docker containers for release (#38) - Support canonical domain configuration (#37) - Add unit tests for domain/models and integration tests for all three data stores - Convert SQLite storage to use JSON documents, similar to PostgreSQL - Convert admin templates to Giraffe View Engine (from Liquid) - Add .NET 8 support
1 parent 7b325dc commit f1a7e55

File tree

116 files changed

+14781
-8223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+14781
-8223
lines changed

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Continuous Integration
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
env:
11+
MWL_TEST_RETHINK_URI: rethinkdb://localhost/mwl_test
12+
jobs:
13+
build_and_test:
14+
name: Build / Test
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
dotnet-version:
20+
- "6.0"
21+
- "7.0"
22+
- "8.0"
23+
24+
services:
25+
postgres:
26+
image: postgres:latest
27+
env:
28+
POSTGRES_PASSWORD: postgres
29+
options: >-
30+
--health-cmd pg_isready
31+
--health-interval 10s
32+
--health-timeout 5s
33+
--health-retries 5
34+
ports:
35+
- 5432:5432
36+
rethink:
37+
image: rethinkdb:latest
38+
ports:
39+
- 28015:28015
40+
41+
steps:
42+
- name: Check Out Code
43+
uses: actions/checkout@v4
44+
- name: Setup .NET Core SDK
45+
uses: actions/[email protected]
46+
with:
47+
dotnet-version: 8.x
48+
- name: Restore dependencies
49+
run: dotnet restore src/MyWebLog.sln
50+
- name: Build (${{ matrix.dotnet-version }})
51+
run: dotnet build src/MyWebLog.sln -f net${{ matrix.dotnet-version }}
52+
- name: Test (${{ matrix.dotnet-version }})
53+
run: cd src/MyWebLog.Tests; dotnet run -f net${{ matrix.dotnet-version }}
54+
55+
publish:
56+
name: Publish Packages
57+
runs-on: ubuntu-latest
58+
needs: build_and_test
59+
60+
strategy:
61+
matrix:
62+
ver:
63+
- "net6.0"
64+
- "net7.0"
65+
- "net8.0"
66+
os:
67+
- "linux-x64"
68+
- "win-x64"
69+
include:
70+
- os: "linux-x64"
71+
bz2: true
72+
- os: "win-x64"
73+
zip: true
74+
steps:
75+
- name: Check Out Code
76+
uses: actions/checkout@v4
77+
- name: Setup .NET Core SDK
78+
uses: actions/[email protected]
79+
with:
80+
dotnet-version: 8.x
81+
- name: Publish (Release)
82+
run: dotnet publish -c Release -f ${{ matrix.ver }} -r ${{ matrix.os }} src/MyWebLog/MyWebLog.fsproj
83+
- name: Zip Admin Theme
84+
run: cd src/admin-theme; zip -r ../MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish/admin-theme.zip *; cd ../..
85+
- name: Zip Default Theme
86+
run: cd src/default-theme; zip -r ../MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish/default-theme.zip *; cd ../..
87+
- if: ${{ matrix.bz2 }}
88+
name: Create .tar.bz2 Archive
89+
run: tar cfj myWebLog-${{ matrix.ver }}-${{ matrix.os }}.tar.bz2 -C src/MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish .
90+
- if: ${{ matrix.zip }}
91+
name: Create .zip Archive
92+
run: cd src/MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish; zip -r myWebLog-${{ matrix.ver }}-${{ matrix.os }}.zip *; cp myWeb*.zip ../../../../../../..; cd ../../../../../../..
93+
- name: Upload Artifacts
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: package-${{ matrix.ver }}-${{ matrix.os }}
97+
path: |
98+
*x64.zip
99+
*.bz2

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ src/MyWebLog/wwwroot/img/daniel-j-summers
261261
src/MyWebLog/wwwroot/img/bit-badger
262262

263263
.ionide
264+
.vscode
264265
src/MyWebLog/appsettings.Production.json
265266

266267
# SQLite database files
267-
src/MyWebLog/*.db*
268+
src/MyWebLog/data/*.db*

build.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ let zipTheme (name : string) (_ : TargetParameter) =
3333
|> Zip.zipSpec $"{releasePath}/{name}-theme.zip"
3434

3535
/// Frameworks supported by this build
36-
let frameworks = [ "net6.0"; "net7.0" ]
36+
let frameworks = [ "net6.0"; "net7.0"; "net8.0" ]
3737

3838
/// Publish the project for the given runtime ID
3939
let publishFor rid (_ : TargetParameter) =

build.fsproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
99
<Compile Include="build.fs" />
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Fake.Core.Target" Version="5.23.1" />
14-
<PackageReference Include="Fake.DotNet.Cli" Version="5.23.1" />
15-
<PackageReference Include="Fake.IO.FileSystem" Version="5.23.1" />
16-
<PackageReference Include="Fake.IO.Zip" Version="5.23.1" />
17-
<PackageReference Include="MSBuild.StructuredLogger" Version="2.1.768" />
13+
<PackageReference Include="Fake.Core.Target" Version="6.0.0" />
14+
<PackageReference Include="Fake.DotNet.Cli" Version="6.0.0" />
15+
<PackageReference Include="Fake.IO.FileSystem" Version="6.0.0" />
16+
<PackageReference Include="Fake.IO.Zip" Version="6.0.0" />
17+
<PackageReference Include="MSBuild.StructuredLogger" Version="2.2.206" />
1818
</ItemGroup>
1919

2020
</Project>

src/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/bin
2+
**/obj
3+
**/*.db
4+
**/appsettings.*.json

src/Directory.Build.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project>
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
3+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
44
<DebugType>embedded</DebugType>
5-
<AssemblyVersion>2.0.0.0</AssemblyVersion>
6-
<FileVersion>2.0.0.0</FileVersion>
7-
<Version>2.0.0</Version>
5+
<AssemblyVersion>2.1.0.0</AssemblyVersion>
6+
<FileVersion>2.1.0.0</FileVersion>
7+
<Version>2.1.0</Version>
88
</PropertyGroup>
99
</Project>

src/Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
2+
WORKDIR /mwl
3+
COPY ./MyWebLog.sln ./
4+
COPY ./Directory.Build.props ./
5+
COPY ./MyWebLog/MyWebLog.fsproj ./MyWebLog/
6+
COPY ./MyWebLog.Data/MyWebLog.Data.fsproj ./MyWebLog.Data/
7+
COPY ./MyWebLog.Domain/MyWebLog.Domain.fsproj ./MyWebLog.Domain/
8+
COPY ./MyWebLog.Tests/MyWebLog.Tests.fsproj ./MyWebLog.Tests/
9+
RUN dotnet restore
10+
11+
COPY . ./
12+
WORKDIR /mwl/MyWebLog
13+
RUN dotnet publish -f net8.0 -c Release -r linux-x64 --no-self-contained -p:PublishSingleFile=false
14+
15+
FROM alpine AS theme
16+
RUN apk add --no-cache zip
17+
WORKDIR /themes/default-theme
18+
COPY ./default-theme ./
19+
RUN zip -r ../default-theme.zip ./*
20+
WORKDIR /themes/admin-theme
21+
COPY ./admin-theme ./
22+
RUN zip -r ../admin-theme.zip ./*
23+
24+
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine as final
25+
WORKDIR /app
26+
RUN apk add --no-cache icu-libs
27+
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
28+
COPY --from=build /mwl/MyWebLog/bin/Release/net8.0/linux-x64/publish/ ./
29+
COPY --from=theme /themes/*.zip /app/
30+
RUN mkdir themes
31+
32+
EXPOSE 80
33+
CMD [ "dotnet", "/app/MyWebLog.dll" ]

0 commit comments

Comments
 (0)