Skip to content

Commit

Permalink
Merge branch 'feature/github-actions' of https://github.com/AngleShar…
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRappl committed Apr 21, 2021
2 parents 0891a2f + f1ecd51 commit ee42ad7
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 63 deletions.
13 changes: 8 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ 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

Expand Down Expand Up @@ -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,7 +112,7 @@ 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
Expand Down
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: FlorianRappl
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
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013 - 2020 AngleSharp
Copyright (c) 2013 - 2021 AngleSharp

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
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
48 changes: 21 additions & 27 deletions tools/anglesharp.cake
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,32 @@ using Octokit;
var configuration = Argument("configuration", "Release");
var isRunningOnUnix = IsRunningOnUnix();
var isRunningOnWindows = IsRunningOnWindows();
var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor;
var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;
var buildNumber = AppVeyor.Environment.Build.Number;
var isRunningOnGitHubActions = BuildSystem.GitHubActions.IsRunningOnGitHubActions;
var releaseNotes = ParseReleaseNotes("./CHANGELOG.md");
var version = releaseNotes.Version.ToString();
var buildDir = Directory($"./src/{projectName}/bin") + Directory(configuration);
var buildResultDir = Directory("./bin") + Directory(version);
var nugetRoot = buildResultDir + Directory("nuget");

if (target == "PrePublish")
if (isRunningOnGitHubActions)
{
version = $"{version}-alpha-{buildNumber}";
var buildNumber = BuildSystem.GitHubActions.Environment.Workflow.RunNumber;

if (target == "Default")
{
version = $"{version}-ci-{buildNumber}";
}
else if (target == "PrePublish")
{
version = $"{version}-alpha-{buildNumber}";
}
}

if (!isRunningOnWindows)
{
frameworks.Remove("net46");
frameworks.Remove("net461");
frameworks.Remove("net472");
}

// Initialization
Expand Down Expand Up @@ -74,13 +83,9 @@ Task("Run-Unit-Tests")
Configuration = configuration,
};

if (isRunningOnAppVeyor)
if (isRunningOnGitHubActions)
{
settings.TestAdapterPath = Directory(".");
settings.Logger = "Appveyor";
// TODO Finds a way to exclude tests not allowed to run on appveyor
// Not used in current code
//settings.Where = "cat != ExcludeFromAppVeyor";
settings.Loggers.Add("GitHubActions");
}

DotNetCoreTest($"./src/{solutionName}.Tests/", settings);
Expand All @@ -101,15 +106,17 @@ Task("Copy-Files")
}, targetDir);
}

CopyFiles(new FilePath[] { $"src/{projectName}.nuspec" }, nugetRoot);
CopyFiles(new FilePath[] {
$"src/{projectName}.nuspec",
"logo.png"
}, nugetRoot);
});

Task("Create-Package")
.IsDependentOn("Copy-Files")
.Does(() =>
{
var nugetExe = GetFiles("./tools/**/nuget.exe").FirstOrDefault()
?? (isRunningOnAppVeyor ? GetFiles("C:\\Tools\\NuGet3\\nuget.exe").FirstOrDefault() : null)
?? throw new InvalidOperationException("Could not find nuget.exe.");

var nuspec = nugetRoot + File($"{projectName}.nuspec");
Expand Down Expand Up @@ -153,7 +160,7 @@ Task("Publish-Release")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
var githubToken = EnvironmentVariable("GITHUB_API_TOKEN");
var githubToken = EnvironmentVariable("GITHUB_TOKEN");

if (String.IsNullOrEmpty(githubToken))
{
Expand All @@ -175,14 +182,6 @@ Task("Publish-Release")
}).Wait();
});

Task("Update-AppVeyor-Build-Number")
.WithCriteria(() => isRunningOnAppVeyor)
.Does(() =>
{
var num = AppVeyor.Environment.Build.Number;
AppVeyor.UpdateBuildVersion($"{version}-{num}");
});

// Targets
// ----------------------------------------

Expand All @@ -194,12 +193,7 @@ Task("Default")
.IsDependentOn("Package");

Task("Publish")
.IsDependentOn("Publish-Package")
.IsDependentOn("Publish-Release");

Task("PrePublish")
.IsDependentOn("Publish-Package");

Task("AppVeyor")
.IsDependentOn("Run-Unit-Tests")
.IsDependentOn("Update-AppVeyor-Build-Number");
6 changes: 3 additions & 3 deletions tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.30.0" />
<package id="NUnit.ConsoleRunner" version="3.9.0" />
<package id="Octokit" version="0.17.0" />
<package id="Cake" version="1.1.0" />
<package id="NUnit.ConsoleRunner" version="3.12.0" />
<package id="Octokit" version="0.50.0" />
</packages>

0 comments on commit ee42ad7

Please sign in to comment.