Skip to content

Commit f1ecd51

Browse files
committed
Use GH actions
1 parent 3fdf871 commit f1ecd51

File tree

9 files changed

+77
-63
lines changed

9 files changed

+77
-63
lines changed

.github/CONTRIBUTING.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ Discussion of issues should be placed transparently in the issue tracker here on
2626

2727
* [AngleSharp.Core](https://github.com/AngleSharp/AngleSharp/issues/)
2828
* [AngleSharp.Css](https://github.com/AngleSharp/AngleSharp.Css/issues/)
29+
* [AngleSharp.Diffing](https://github.com/AngleSharp/AngleSharp.Diffing/issues/)
2930
* [AngleSharp.Io](https://github.com/AngleSharp/AngleSharp.Io/issues/)
3031
* [AngleSharp.Js](https://github.com/AngleSharp/AngleSharp.Js/issues/)
3132
* [AngleSharp.Xml](https://github.com/AngleSharp/AngleSharp.Xml/issues/)
33+
* [AngleSharp.XPath](https://github.com/AngleSharp/AngleSharp.XPath/issues/)
34+
* [AngleSharp.Wasm](https://github.com/AngleSharp/AngleSharp.Wasm/issues/)
3235

3336
### Modifying the code
3437

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

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

79-
```
82+
```sh
8083
git checkout -b feature/#777
8184
```
8285

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

85-
```
88+
```sh
8689
git push -u origin feature/#777
8790
```
8891

8992
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.
9093

91-
```
94+
```sh
9295
git checkout devel
9396
git pull
9497
git pull origin feature/#777
@@ -97,7 +100,7 @@ git push
97100

98101
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`.
99102

100-
```
103+
```sh
101104
git checkout master
102105
git merge devel
103106
git tag v1.0
@@ -109,7 +112,7 @@ git tag v1.0
109112

110113
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.
111114

112-
```
115+
```plaintext
113116
.editorconfig
114117
.gitignore
115118
.gitattributes

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
github: FlorianRappl
4+
custom: https://salt.bountysource.com/teams/anglesharp

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
8+
9+
jobs:
10+
linux:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Build
17+
run: ./build.sh
18+
19+
windows:
20+
runs-on: windows-latest
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Build
26+
run: |
27+
if ($env:GITHUB_REF -eq "refs/heads/master") {
28+
.\build.ps1 -Target Publish
29+
} elseif ($env:GITHUB_REF -eq "refs/heads/devel") {
30+
.\build.ps1 -Target PrePublish
31+
} else {
32+
.\build.ps1
33+
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2013 - 2019 AngleSharp
3+
Copyright (c) 2013 - 2021 AngleSharp
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

appveyor.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

build.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ $NUGET_OLD_URL = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe"
2626
# Should we use experimental build of Roslyn?
2727
$UseExperimental = "";
2828
if ($Experimental.IsPresent) {
29-
$UseExperimental = "-experimental"
29+
$UseExperimental = "--experimental"
3030
}
3131

3232
# Is this a dry run?
3333
if ($WhatIf.IsPresent) {
34-
$UseDryRun = "-dryrun"
34+
$UseDryRun = "--dryrun"
3535
}
3636

3737
# Should we use mono?
3838
if ($Mono.IsPresent) {
39-
$UseMono = "-mono"
39+
$UseMono = "--mono"
4040
}
4141

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

7979
# Start Cake
80-
Invoke-Expression "$CAKE_EXE `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
80+
Invoke-Expression "$CAKE_EXE `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
8181
exit $LASTEXITCODE

build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for i in "$@"; do
2727
-t|--target) TARGET="$2"; shift ;;
2828
-c|--configuration) CONFIGURATION="$2"; shift ;;
2929
-v|--verbosity) VERBOSITY="$2"; shift ;;
30-
-d|--dryrun) DRYRUN="-dryrun" ;;
30+
-d|--dryrun) DRYRUN="--dryrun" ;;
3131
--version) SHOW_VERSION=true ;;
3232
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
3333
*) SCRIPT_ARGUMENTS+=("$1") ;;
@@ -87,7 +87,7 @@ fi
8787

8888
# Start Cake
8989
if $SHOW_VERSION; then
90-
exec mono $CAKE_EXE -version
90+
exec mono $CAKE_EXE --version
9191
else
92-
exec mono $CAKE_EXE $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
92+
exec mono $CAKE_EXE $SCRIPT --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
9393
fi

tools/anglesharp.cake

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,32 @@ using Octokit;
55
var configuration = Argument("configuration", "Release");
66
var isRunningOnUnix = IsRunningOnUnix();
77
var isRunningOnWindows = IsRunningOnWindows();
8-
var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor;
9-
var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;
10-
var buildNumber = AppVeyor.Environment.Build.Number;
8+
var isRunningOnGitHubActions = BuildSystem.GitHubActions.IsRunningOnGitHubActions;
119
var releaseNotes = ParseReleaseNotes("./CHANGELOG.md");
1210
var version = releaseNotes.Version.ToString();
1311
var buildDir = Directory($"./src/{projectName}/bin") + Directory(configuration);
1412
var buildResultDir = Directory("./bin") + Directory(version);
1513
var nugetRoot = buildResultDir + Directory("nuget");
1614

17-
if (target == "PrePublish")
15+
if (isRunningOnGitHubActions)
1816
{
19-
version = $"{version}-alpha-{buildNumber}";
17+
var buildNumber = BuildSystem.GitHubActions.Environment.Workflow.RunNumber;
18+
19+
if (target == "Default")
20+
{
21+
version = $"{version}-ci-{buildNumber}";
22+
}
23+
else if (target == "PrePublish")
24+
{
25+
version = $"{version}-alpha-{buildNumber}";
26+
}
2027
}
2128

2229
if (!isRunningOnWindows)
2330
{
2431
frameworks.Remove("net46");
32+
frameworks.Remove("net461");
33+
frameworks.Remove("net472");
2534
}
2635

2736
// Initialization
@@ -74,13 +83,9 @@ Task("Run-Unit-Tests")
7483
Configuration = configuration,
7584
};
7685

77-
if (isRunningOnAppVeyor)
86+
if (isRunningOnGitHubActions)
7887
{
79-
settings.TestAdapterPath = Directory(".");
80-
settings.Logger = "Appveyor";
81-
// TODO Finds a way to exclude tests not allowed to run on appveyor
82-
// Not used in current code
83-
//settings.Where = "cat != ExcludeFromAppVeyor";
88+
settings.Loggers.Add("GitHubActions");
8489
}
8590

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

104-
CopyFiles(new FilePath[] { $"src/{projectName}.nuspec" }, nugetRoot);
109+
CopyFiles(new FilePath[] {
110+
$"src/{projectName}.nuspec",
111+
"logo.png"
112+
}, nugetRoot);
105113
});
106114

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

115122
var nuspec = nugetRoot + File($"{projectName}.nuspec");
@@ -153,7 +160,7 @@ Task("Publish-Release")
153160
.IsDependentOn("Run-Unit-Tests")
154161
.Does(() =>
155162
{
156-
var githubToken = EnvironmentVariable("GITHUB_API_TOKEN");
163+
var githubToken = EnvironmentVariable("GITHUB_TOKEN");
157164

158165
if (String.IsNullOrEmpty(githubToken))
159166
{
@@ -175,14 +182,6 @@ Task("Publish-Release")
175182
}).Wait();
176183
});
177184

178-
Task("Update-AppVeyor-Build-Number")
179-
.WithCriteria(() => isRunningOnAppVeyor)
180-
.Does(() =>
181-
{
182-
var num = AppVeyor.Environment.Build.Number;
183-
AppVeyor.UpdateBuildVersion($"{version}-{num}");
184-
});
185-
186185
// Targets
187186
// ----------------------------------------
188187

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

196195
Task("Publish")
197-
.IsDependentOn("Publish-Package")
198196
.IsDependentOn("Publish-Release");
199197

200198
Task("PrePublish")
201199
.IsDependentOn("Publish-Package");
202-
203-
Task("AppVeyor")
204-
.IsDependentOn("Run-Unit-Tests")
205-
.IsDependentOn("Update-AppVeyor-Build-Number");

tools/packages.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Cake" version="0.30.0" />
4-
<package id="NUnit.ConsoleRunner" version="3.9.0" />
5-
<package id="Octokit" version="0.17.0" />
3+
<package id="Cake" version="1.1.0" />
4+
<package id="NUnit.ConsoleRunner" version="3.12.0" />
5+
<package id="Octokit" version="0.50.0" />
66
</packages>

0 commit comments

Comments
 (0)