Skip to content

Commit

Permalink
Merge pull request #12 from AngleSharp/devel
Browse files Browse the repository at this point in the history
0.15.0 release
  • Loading branch information
egil authored Apr 28, 2021
2 parents 98e4546 + 1d7eb12 commit cd7825a
Show file tree
Hide file tree
Showing 17 changed files with 120 additions and 125 deletions.
46 changes: 24 additions & 22 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,47 +26,50 @@ Discussion of issues should be placed transparently in the issue tracker here on

* [AngleSharp.Core](https://github.com/AngleSharp/AngleSharp/issues/)
* [AngleSharp.Css](https://github.com/AngleSharp/AngleSharp.Css/issues/)
* [AngleSharp.Diffing](https://github.com/AngleSharp/AngleSharp.Diffing/issues/)
* [AngleSharp.Io](https://github.com/AngleSharp/AngleSharp.Io/issues/)
* [AngleSharp.Js](https://github.com/AngleSharp/AngleSharp.Js/issues/)
* [AngleSharp.Xml](https://github.com/AngleSharp/AngleSharp.Xml/issues/)
* [AngleSharp.XPath](https://github.com/AngleSharp/AngleSharp.XPath/issues/)
* [AngleSharp.Wasm](https://github.com/AngleSharp/AngleSharp.Wasm/issues/)

### Modifying the code

AngleSharp and its libraries uses features from the latest versions of C# (e.g., C# 7). You will therefore need a C# compiler that is up for the job.

1. Fork and clone the repo.
2. First try to build the AngleSharp.Core libray and see if you get the tests running.
2. First try to build the AngleSharp.Core library and see if you get the tests running.
3. You will be required to resolve some dependencies via NuGet.

AngleSharp itself does not have dependencies, however, the tests are dependent on NUnit.

The build system of AngleSharp uses Cake. A bootstrap script (build.ps1 for Windows or build.sh for *nix systems) is included. Note, that at the moment AngleSharp may require NuGet 3.5, which looks for MSBuild pre-15, i.e., before Visual Studio 2017 on Windows systems. We aim to drop this requirement enitirely soon.
The build system of AngleSharp uses Cake. A bootstrap script (build.ps1 for Windows or build.sh for *nix systems) is included. Note, that at the moment AngleSharp may require NuGet 3.5, which looks for MSBuild pre-15, i.e., before Visual Studio 2017 on Windows systems. We aim to drop this requirement entirely soon.

### Code Conventions

Most parts in the AngleSharp project are fairly straight forward. Among these are:

- Always use statement blocks for control statements, e.g., in a for-loop, if-condition, ...
- You may use a simple (throw) statement in case of enforcing contracts on argument
- Be explicit about modifiers (some files follow an older convention of the code base, but we settled on the explicit style)
* Always use statement blocks for control statements, e.g., in a for-loop, if-condition, ...
* You may use a simple (throw) statement in case of enforcing contracts on argument
* Be explicit about modifiers (some files follow an older convention of the code base, but we settled on the explicit style)

There are a couple of rules, which are definitely not standard, but highly recommended for consistency and readability:

- AngleSharp uses the RHS convention, where types are always put on the right hand side if possible, i.e., preferring `var` under all circumstances
- A single empty line between two non-simple statements (e.g., for-loop and if-condition) should be inserted
- Types are preferred to keywords (`String` instead of `string` or `Int32` instead of `int`)
- `using` statements must be inside the namespace declaration
* AngleSharp uses the RHS convention, where types are always put on the right hand side if possible, i.e., preferring `var` under all circumstances
* A single empty line between two non-simple statements (e.g., for-loop and if-condition) should be inserted
* Types are preferred to keywords (`String` instead of `string` or `Int32` instead of `int`)
* `using` statements must be inside the namespace declaration

### Development Workflow

1. If no issue already exists for the work you'll be doing, create one to document the problem(s) being solved and self-assign.
2. Otherwise please let us know that you are working on the problem. Regular status updates (e.g. "still in progress", "no time anymore", "practically done", "pull request issued") are highly welcome.
2. Create a new branch—please don't work in the `master` branch directly. It is reserved for releases. We recommend naming the branch to match the issue being addressed (`feature/#777` or `issue-777`).
3. Add failing tests for the change you want to make. Tests are crucial and should be taken from W3C (or other specification).
4. Fix stuff. Always go from edge case to edge case.
5. All tests should pass now. Also your new implementation should not break existing tests.
6. Update the documentation to reflect any changes. (or document such changes in the original issue)
7. Push to your fork or push your issue-specific branch to the main repository, then submit a pull request against `devel`.
3. Create a new branch—please don't work in the `master` branch directly. It is reserved for releases. We recommend naming the branch to match the issue being addressed (`feature/#777` or `issue-777`).
4. Add failing tests for the change you want to make. Tests are crucial and should be taken from W3C (or other specification).
5. Fix stuff. Always go from edge case to edge case.
6. All tests should pass now. Also your new implementation should not break existing tests.
7. Update the documentation to reflect any changes. (or document such changes in the original issue)
8. Push to your fork or push your issue-specific branch to the main repository, then submit a pull request against `devel`.

Just to illustrate the git workflow for AngleSharp a little bit more we've added the following graphs.

Expand All @@ -76,19 +79,19 @@ Here we now created a new branch called `devel`. This is the development branch.

Now active work is supposed to be done. Therefore a new branch should be created. Let's create one:

```
```sh
git checkout -b feature/#777
```

There may be many of these feature branches. Most of them are also pushed to the server for discussion or synchronization.

```
```sh
git push -u origin feature/#777
```

Now feature branches may be closed when they are done. Here we simply merge with the feature branch(es). For instance the following command takes the `feature/#777` branch from the server and merges it with the `devel` branch.

```
```sh
git checkout devel
git pull
git pull origin feature/#777
Expand All @@ -97,7 +100,7 @@ git push

Finally, we may have all the features that are needed to release a new version of AngleSharp. Here we tag the release. For instance for the 1.0 release we use `v1.0`.

```
```sh
git checkout master
git merge devel
git tag v1.0
Expand All @@ -109,12 +112,11 @@ git tag v1.0

The following files should not be edited directly in the current repository, but rather in the `AngleSharp.GitBase` repository. They are then synced via `git pull` from a different remote.

```
```plaintext
.editorconfig
.gitignore
.gitattributes
.github/*
appveyor.yml
build.ps1
build.sh
tools/anglesharp.cake
Expand All @@ -124,7 +126,7 @@ LICENSE

To sync manually:

```
```sh
git remote add gitbase [email protected]:AngleSharp/AngleSharp.GitBase.git
git pull gitbase master
```
Expand Down
12 changes: 2 additions & 10 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
# These are supported funding model platforms

github: [egil] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
#patreon: # Replace with a single Patreon username
#open_collective: # Replace with a single Open Collective username
#ko_fi: # Replace with a single Ko-fi username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#otechie: # Replace with a single Otechie username
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
github: [FlorianRappl,egil]
custom: https://salt.bountysource.com/teams/anglesharp
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on: [push, pull_request]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

jobs:
linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build
run: ./build.sh

windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Build
run: |
if ($env:GITHUB_REF -eq "refs/heads/master") {
.\build.ps1 -Target Publish
} elseif ($env:GITHUB_REF -eq "refs/heads/devel") {
.\build.ps1 -Target PrePublish
} else {
.\build.ps1
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.15.0

Released on Wednesday, April 28, 2021.

- Upgraded to version 0.15.0 of AngleSharp.
- Added strong name signing of assembly.

# 0.14.0

Released on Wednesday, April 16, 2020.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Egil Hansen
Copyright (c) 2019-2021 Egil Hansen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 0 additions & 20 deletions appveyor.yml

This file was deleted.

8 changes: 4 additions & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ $NUGET_OLD_URL = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe"
# Should we use experimental build of Roslyn?
$UseExperimental = "";
if ($Experimental.IsPresent) {
$UseExperimental = "-experimental"
$UseExperimental = "--experimental"
}

# Is this a dry run?
if ($WhatIf.IsPresent) {
$UseDryRun = "-dryrun"
$UseDryRun = "--dryrun"
}

# Should we use mono?
if ($Mono.IsPresent) {
$UseMono = "-mono"
$UseMono = "--mono"
}

# Try download NuGet.exe if do not exist.
Expand Down Expand Up @@ -77,5 +77,5 @@ if (!(Test-Path $CAKE_EXE)) {
}

# Start Cake
Invoke-Expression "$CAKE_EXE `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
Invoke-Expression "$CAKE_EXE `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
exit $LASTEXITCODE
6 changes: 3 additions & 3 deletions build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ for i in "$@"; do
-t|--target) TARGET="$2"; shift ;;
-c|--configuration) CONFIGURATION="$2"; shift ;;
-v|--verbosity) VERBOSITY="$2"; shift ;;
-d|--dryrun) DRYRUN="-dryrun" ;;
-d|--dryrun) DRYRUN="--dryrun" ;;
--version) SHOW_VERSION=true ;;
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
*) SCRIPT_ARGUMENTS+=("$1") ;;
Expand Down Expand Up @@ -87,7 +87,7 @@ fi

# Start Cake
if $SHOW_VERSION; then
exec mono $CAKE_EXE -version
exec mono $CAKE_EXE --version
else
exec mono $CAKE_EXE $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
exec mono $CAKE_EXE $SCRIPT --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
fi
14 changes: 8 additions & 6 deletions src/AngleSharp.Diffing.Tests/AngleSharp.DiffingTests.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
<AssemblyName>AngleSharp.Diffing.Tests</AssemblyName>
<RootNamespace>AngleSharp.Diffing</RootNamespace>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <!-- https://github.com/Tyrrrz/GitHubActionsTestLogger/issues/5 -->
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Shouldly" Version="4.0.0-beta0002" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Shouldly" Version="4.0.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.1.0">
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -25,4 +27,4 @@
<ProjectReference Include="..\AngleSharp.Diffing\AngleSharp.Diffing.csproj" />
</ItemGroup>

</Project>
</Project>
14 changes: 1 addition & 13 deletions src/AngleSharp.Diffing.Tests/ShouldlyTestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,7 @@
namespace AngleSharp.Diffing
{
public static class ShouldlyTestExtensions
{
// The ShouldSatisfyAllConditions are here until https://github.com/shouldly/shouldly/issues/472 lands in a release of Shouldly.
public static void ShouldSatisfyAllConditions<T>(this T actual, params Action<T>[] conditions) => ShouldSatisfyAllConditions(actual, () => null, conditions);
public static void ShouldSatisfyAllConditions<T>(this T actual, string customMessage, params Action<T>[] conditions) => ShouldSatisfyAllConditions(actual, () => customMessage, conditions);
public static void ShouldSatisfyAllConditions<T>(this T actual, Func<string?> customMessage, params Action<T>[] conditions)
{
var convertedConditions = conditions
.Select(a => new Action(() => a(actual)))
.ToArray();

actual.ShouldSatisfyAllConditions(customMessage, convertedConditions);
}

{
public static void ShouldAllBe<T>(this IEnumerable<T> actual, Func<T, int, bool> elementPredicate)
{
actual.Select(elementPredicate).ShouldAllBe(x => x);
Expand Down
19 changes: 6 additions & 13 deletions src/AngleSharp.Diffing/AngleSharp.Diffing.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Expand All @@ -13,12 +10,12 @@
<Product>AngleSharp.Diffing</Product>
<Authors>AngleSharp</Authors>
<PackageId>AngleSharp.Diffing</PackageId>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://anglesharp.github.io</PackageProjectUrl>
<PackageIcon>logo.png</PackageIcon>
<PackageIconUrl>https://raw.github.com/AngleSharp/AngleSharp.Diffing/master/logo.png</PackageIconUrl>
<PackageTags>html html5 css css3 dom library diffing anglesharp diff difference compare comparison testing</PackageTags>
<Copyright>Copyright 2019, Egil Hansen</Copyright>
<Copyright>Egil Hansen</Copyright>
<RepositoryUrl>https://github.com/AngleSharp/AngleSharp.Diffing</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand All @@ -30,18 +27,14 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
<AnnotatedReferenceAssemblyVersion>3.0.0</AnnotatedReferenceAssemblyVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.77" PrivateAssets="all" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[$(AnnotatedReferenceAssemblyVersion)]" />
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[5.0.0]" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\logo.png" Pack="true" PackagePath="\" />
<None Include="..\..\LICENSE" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
</Project>
2 changes: 0 additions & 2 deletions src/AngleSharp.Diffing/Assembly.cs

This file was deleted.

2 changes: 2 additions & 0 deletions src/AngleSharp.Diffing/InternalsVisibleTo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("AngleSharp.Diffing.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010001adf274fa2b375134e8e4558d606f1a0f96f5cd0c6b99970f7cce9887477209d7c29f814e2508d8bd2526e99e8cd273bd1158a3984f1ea74830ec5329a77c6ff201a15edeb8b36ab046abd1bce211fe8dbb076d7d806f46b15bfda44def04ead0669971e96c5f666c9eda677f28824fff7aa90d32929ed91d529a7a41699893")]
Loading

0 comments on commit cd7825a

Please sign in to comment.