Skip to content

Commit

Permalink
Merge branch 'main' into xunit-v3-serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeApophis authored Feb 4, 2025
2 parents 1ad6766 + ccc1707 commit 18a6b10
Show file tree
Hide file tree
Showing 47 changed files with 479 additions and 162 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build

on:
push:
branches: [ main, funcky3 ]
branches: [ main, release/** ]
pull_request:
branches: [ main, funcky3 ]
branches: [ main, release/** ]

env:
DOTNET_NOLOGO: 1
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Generate NuGet Packages
run: dotnet pack --output nupkg
- uses: actions/upload-artifact@v4
if: success() && github.ref == 'refs/heads/main'
if: success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/'))
with:
name: nupkg
path: nupkg/*
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: '0.4.2'
mdbook-version: '0.4.44'
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '22'
- run: yarn install
working-directory: ./Documentation
- name: Build Marble Graphics
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-nightly-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
- uses: actions/setup-dotnet@v4
name: Install Current .NET SDK
- name: Pack Packages
run: dotnet pack Funcky/Funcky.csproj --output nupkg --version-suffix "nightly.$(git rev-parse --short "${{github.sha}}")"
- name: Push Package
run: dotnet pack --output nupkg --version-suffix "nightly.$(git rev-parse --short "${{github.sha}}")"
- name: Push Packages
run: dotnet nuget push --source https://nuget.pkg.github.com/polyadic/index.json --api-key ${{secrets.GITHUB_TOKEN}} nupkg/Funcky.*.nupkg
3 changes: 1 addition & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</ItemGroup>
<ItemGroup Label="Build Dependencies">
<PackageVersion Include="PolySharp" Version="1.15.0" />
<PackageVersion Include="Polyadic.Build.SemanticVersioning" Version="1.0.0" />
<PackageVersion Include="Polyadic.CodeStyle" Version="1.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.3" />
</ItemGroup>
Expand All @@ -37,9 +38,7 @@
<PackageVersion Include="xunit.extensibility.execution" Version="2.9.3" />
</ItemGroup>
<ItemGroup Label="Analyzer">
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" /><!-- We explicitly reference these analyzers to get the latest version even though we might not use the latest version of Microsoft.CodeAnalysis everywhere. -->
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.0.1597"/>
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions Documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@swirly/parser": "^0.21.0",
"@swirly/renderer-node": "^0.21.0",
"@swirly/theme-default-light": "^0.21.0",
"@swirly/theme-default-dark": "^0.21.0",
"glob": "^7.1.7"
}
}
7 changes: 6 additions & 1 deletion Documentation/scripts/build-marble-graphics.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { basename, extname, dirname, join as joinPath } from 'path';
import { promises as fs } from 'fs';
import { parseMarbleDiagramSpecification } from '@swirly/parser';
import { lightStyles } from '@swirly/theme-default-light';
import { darkStyles } from '@swirly/theme-default-dark';
import { renderMarbleDiagram } from '@swirly/renderer-node';
import globWithCallback from 'glob';

Expand All @@ -12,12 +13,16 @@ const inputFiles = await glob("src/**/*.swirly");

await Promise.all(inputFiles.map(async path => {
const svgFileName = basename(path, extname(path)) + ".svg";
const darkSvgFileName = basename(path, extname(path)) + "-dark.svg"
const svgFilePath = joinPath(dirname(path), svgFileName);
const darkSvgPath = joinPath(dirname(path), darkSvgFileName);

const unparsedSpec = await fs.readFile(path, 'utf8');
const spec = await parseMarbleDiagramSpecification(unparsedSpec);
const { xml } = renderMarbleDiagram(spec, { lightStyles });
const { xml } = renderMarbleDiagram(spec, { styles: lightStyles });
await fs.writeFile(svgFilePath, xml, { encoding: 'utf8' });
const { xml: darkXml } = renderMarbleDiagram(spec, { styles: darkStyles });
await fs.writeFile(darkSvgPath, darkXml, { encoding: 'utf8' });

console.log(`${path} -> ${svgFilePath}`);
}));
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/adjacent-group-by.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## AdjacentGroupBy

![adjacent-group-by with marbles](adjacent-group-by.svg)
<picture>
<picture>
<source srcset="adjacent-group-by-dark.svg" media="(prefers-color-scheme: dark)">
<img src="adjacent-group-by.svg" alt="A marble diagram showing the AdjacentGroupBy operation">
</picture>
</picture>
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/cartesian-product.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B.

In other words: The Cartesian product produces all possible pairs of two given `IEnumerable`s.

![cartesian-product with marbles](cartesian-product.svg "Marble me!")
<picture>
<picture>
<source srcset="cartesian-product-dark.svg" media="(prefers-color-scheme: dark)">
<img src="cartesian-product.svg" alt="A marble diagram showing the CartesianProduct operation">
</picture>
</picture>

### Recipe
The Cartesian product can be easily implemented ad-hoc using LINQ's built-in `SelectMany` extension function:
Expand Down
9 changes: 7 additions & 2 deletions Documentation/src/enumerable-extensions/chunk.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
With the `.Chunk(int)` extension method, you can turn an `IEnumerable<T>` into a `IEnumerable<IEnumerable<T>>`, with the inner Enumerables being of the given size.
Empty and negative chunk sizes are not allowed and will throw a `ArgumentOutOfRangeException`.

![chunk with marbles](chunk.svg)
<picture>
<picture>
<source srcset="chunk-dark.svg" media="(prefers-color-scheme: dark)">
<img src="chunk.svg" alt="A marble diagram showing the Chunk operation">
</picture>
</picture>

### Examples

Expand All @@ -30,4 +35,4 @@ If required, you can also pass a result selector, that turns the inner IEnumerab
var magicSquare = new List<int> { 4, 9, 2, 3, 5, 7, 8, 1, 6 };
var result = magicSquare.Chunk(3, Enumerable.Average); // equivalent to magicSquare.Chunk(3, number => Enumerable.Average(number));
// Result: IEnumerable<int> with 5, 5, 5 as items
```
```
26 changes: 26 additions & 0 deletions Documentation/src/enumerable-extensions/enumerable-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,55 @@ Funcky offers a few additional ones which can come in handy.
<!-- toc -->

{{#include ./adjacent-group-by.md}}

{{#include ./average-or-none.md}}

{{#include ./cartesian-product.md}}

{{#include ./chunk.md}}

{{#include ./for-each.md}}

{{#include ./first-or-none.md}}

{{#include ./inspect.md}}

{{#include ./interleave.md}}

{{#include ./intersperse.md}}

{{#include ./materialize.md}}

{{#include ./merge.md}}

{{#include ./none.md}}

{{#include ./pairwise.md}}

{{#include ./partition.md}}

{{#include ./power-set.md}}

{{#include ./shuffle.md}}

{{#include ./sliding-window.md}}

{{#include ./split.md}}

{{#include ./take-every.md}}

{{#include ./transpose.md}}

{{#include ./where-not-null.md}}

{{#include ./where-select.md}}

{{#include ./with-first.md}}

{{#include ./with-index.md}}

{{#include ./with-last.md}}

{{#include ./with-previous.md}}

{{#include ./zip-longest.md}}
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/interleave.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Interleave

![interleave with marbles](interleave.svg)
<picture>
<picture>
<source srcset="interleave-dark.svg" media="(prefers-color-scheme: dark)">
<img src="interleave.svg" alt="A marble diagram showing the Interleave operation">
</picture>
</picture>
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/intersperse.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Intersperse

![intersperse with marbles](intersperse.svg)
<picture>
<picture>
<source srcset="intersperse-dark.svg" media="(prefers-color-scheme: dark)">
<img src="intersperse.svg" alt="A marble diagram showing the Interleave operation">
</picture>
</picture>
11 changes: 8 additions & 3 deletions Documentation/src/enumerable-extensions/merge.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## Merge

![merge with marbles](merge.svg)
<picture>
<picture>
<source srcset="merge-dark.svg" media="(prefers-color-scheme: dark)">
<img src="merge.svg" alt="A marble diagram showing the Merge operation">
</picture>
</picture>

### Examples

Expand All @@ -12,9 +17,9 @@ Given two sequences which are already ordered the same way:
```

By merging we get one single sequence with the all elements of the given sequences with the same order.

```
sequence1.Merge(sequence2) =>
sequence1.Merge(sequence2) =>
[1, 2, 7, 9, 14 ]
[ 3, 6, 8, 11, 12, 16]
-------------------------------------
Expand Down
13 changes: 9 additions & 4 deletions Documentation/src/enumerable-extensions/pairwise.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
## PairWise

![pairwise with marbles](pairwise.svg)
<picture>
<picture>
<source srcset="pairwise-dark.svg" media="(prefers-color-scheme: dark)">
<img src="pairwise.svg" alt="A marble diagram showing the Pairwise operation">
</picture>
</picture>

### Example

```
```
animals = [ 🐵, 🐶, 🐺, 🐱, 🦄, 🐷, 🦁]
animals.PairWise() =>
[[🐵, 🐶],
[🐶, 🐺],
[🐺, 🐱],
[🐱, 🦄],
[🦄, 🐷],
[🐷, 🦁]]
```
```
13 changes: 9 additions & 4 deletions Documentation/src/enumerable-extensions/partition.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
## Partition

![partition with marbles](partition.svg)
<picture>
<picture>
<source srcset="partition-dark.svg" media="(prefers-color-scheme: dark)">
<img src="partition.svg" alt="A marble diagram showing the Partition operation">
</picture>
</picture>

### Example

```
```
plantBasedFood = [🍉, 🍩 , 🎂, 🍌, 🍫, 🍓, 🍒, 🥕, 🌽, 🥧 ]
plantBasedFood.Partition(IsProcessedFood?)
plantBasedFood.Partition(IsProcessedFood?)
=> [[🍩 , 🎂, 🍫, 🥧],
[🍉, 🍌, 🍓, 🍒, 🥕, 🌽]]
```
```
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/power-set.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## PowerSet

![power-set with marbles](power-set.svg)
<picture>
<picture>
<source srcset="power-set-dark.svg" media="(prefers-color-scheme: dark)">
<img src="power-set.svg" alt="A marble diagram showing the PowerSet operation">
</picture>
</picture>
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/shuffle.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Shuffle

![shuffle with marbles](shuffle.svg)
<picture>
<picture>
<source srcset="shuffle-dark.svg" media="(prefers-color-scheme: dark)">
<img src="shuffle.svg" alt="A marble diagram showing the Shuffle operation">
</picture>
</picture>
8 changes: 6 additions & 2 deletions Documentation/src/enumerable-extensions/sliding-window.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## SlidingWindow

![sliding-window with marbles](sliding-window.svg)

<picture>
<picture>
<source srcset="sliding-window-dark.svg" media="(prefers-color-scheme: dark)">
<img src="sliding-window.svg" alt="A marble diagram showing the SlidingWindow operation">
</picture>
</picture>
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/split.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Split

![split with marbles](split.svg)
<picture>
<picture>
<source srcset="split-dark.svg" media="(prefers-color-scheme: dark)">
<img src="split.svg" alt="A marble diagram showing the Split operation">
</picture>
</picture>
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/take-every.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## TakeEvery

![take-every with marbles](take-every.svg)
<picture>
<picture>
<source srcset="take-every-dark.svg" media="(prefers-color-scheme: dark)">
<img src="take-every.svg" alt="A marble diagram showing the TakeEvery operation">
</picture>
</picture>
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/transpose.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Transpose

![transpose with marbles](transpose.svg)
<picture>
<picture>
<source srcset="transpose-dark.svg" media="(prefers-color-scheme: dark)">
<img src="transpose.svg" alt="A marble diagram showing the Transpose operation">
</picture>
</picture>
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/where-not-null.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## WhereNotNull

![where-not-null with marbles](where-not-null.svg)
<picture>
<picture>
<source srcset="where-not-null-dark.svg" media="(prefers-color-scheme: dark)">
<img src="where-not-null.svg" alt="A marble diagram showing the WhereNotNull operation">
</picture>
</picture>
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/where-select.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## WhereSelect

![where-select with marbles](where-select.svg)
<picture>
<picture>
<source srcset="where-select-dark.svg" media="(prefers-color-scheme: dark)">
<img src="where-select.svg" alt="A marble diagram showing the WhereSelect operation">
</picture>
</picture>
7 changes: 6 additions & 1 deletion Documentation/src/enumerable-extensions/with-first.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## WithFirst

![with-first with marbles](with-first.svg)
<picture>
<picture>
<source srcset="with-first-dark.svg" media="(prefers-color-scheme: dark)">
<img src="with-first.svg" alt="A marble diagram showing the WithFirst operation">
</picture>
</picture>
Loading

0 comments on commit 18a6b10

Please sign in to comment.