-
Notifications
You must be signed in to change notification settings - Fork 148
Remove Travis and use Github Actions #228
Changes from all commits
2e56622
04f68a7
5857a3f
932b357
f2a1bc9
8d5bf3e
cf45622
17ba878
b6855de
153a90f
987beb0
7e10f06
501d5f8
4b3da64
21269ca
fecc572
eb43012
f2b884e
66f2532
6485311
e8fe172
53b6140
32f2417
d358d7e
ace92dd
f5f15ff
52683f7
f9ea888
e584761
dee001c
a7cd6a0
93b44f4
66d717b
e129ff7
33d1ea1
b8cf0c0
49ba2ef
5baae1d
c739887
0e321ca
94b7b1a
d0d9a4b
6f97d37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: .NET Core Test and Publish | ||
|
||
on: | ||
push: | ||
branches: master | ||
pull_request: | ||
|
||
env: | ||
DOTNET_VERSION: 3.0.100 | ||
|
||
jobs: | ||
|
||
Test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Chectout | ||
uses: actions/checkout@v1 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
- name: Check format | ||
run: | | ||
dotnet tool install --tool-path ./ dotnet-format | ||
./dotnet-format --check --dry-run -v diagnostic | ||
- name: Test | ||
run: | | ||
find tests -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild | ||
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
PublishGithub: | ||
if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/') | ||
needs: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Chectout | ||
uses: actions/checkout@v1 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
- name: Setup NuGet.exe for use with actions | ||
uses: NuGet/setup-nuget@v1 | ||
- name: Pack with dotnet | ||
run: git rev-list --count HEAD |xargs printf "CI%05d" |xargs dotnet pack -c Debug -o out --include-source --version-suffix | ||
- name: Publish to Github Packages | ||
run: | | ||
nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/neo-project/index.json" -UserName neo-project -Password ${GITHUB_TOKEN} | ||
nuget push out/*.nupkg -Source "GitHub" | ||
erikzhang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
PublishMyGet: | ||
if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/') | ||
needs: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Chectout | ||
uses: actions/checkout@v1 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
- name: Pack with dotnet | ||
run: git rev-list --count HEAD |xargs printf "CI%05d" |xargs dotnet pack -c Debug -o out --include-source --version-suffix | ||
- name: Publish to MyGet | ||
run: dotnet nuget push out/*.nupkg -s https://www.myget.org/F/neo/api/v2/package -k ${MYGET_TOKEN} -ss https://www.myget.org/F/neo/symbols/api/v2/package -sk ${MYGET_TOKEN} | ||
env: | ||
MYGET_TOKEN: ${{ secrets.MYGET_TOKEN }} |
This file was deleted.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,10 +1,11 @@ | ||||
<Project Sdk="Microsoft.NET.Sdk"> | ||||
<Project Sdk="Microsoft.NET.Sdk"> | ||||
|
||||
<PropertyGroup> | ||||
<Copyright>2016-2019 The Neo Project</Copyright> | ||||
<AssemblyTitle>Neo.VM</AssemblyTitle> | ||||
<Description>Neo.VM</Description> | ||||
<Version>3.0.0-preview1</Version> | ||||
<VersionPrefix>3.0.0</VersionPrefix> | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You really want to use a tool rather than manage this manually. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can tell you from personal experience that managing the version suffix manually will not work out well. The problem with most versioning schemes is that they are driven by either by date information, by some build system intrinsic (like the number of previous builds executed in a set amount of time) or both. This makes the version number completely non deterministic. Nerdbank GitVersioning on the other hand produces deterministic version numbers with no dependency on git tags or branches. So building a specific commit locally and on the build server produce the exact same build version. There are also tools to calculate which commit generated a given version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we need an incremental version number. Now I'm using the linux timestamp. neo-vm/.github/workflows/publish.yml Line 22 in d358d7e
It generates the package version like this:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, timestamps are not non deterministic. Nerdbank GitVersioning uses a concept called git height to give each commit it's own deterministic incremental version number. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now I'm using deterministic version numbers. They are generated by the following command:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @devhawk I agree with you that we could use Nerdbank, but I think this may be outside the scope of this PR. |
||||
<VersionSuffix>preview1</VersionSuffix> | ||||
<Authors>The Neo Project</Authors> | ||||
<TargetFramework>netstandard2.1</TargetFramework> | ||||
<AssemblyName>Neo.VM</AssemblyName> | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using the git rev-list count is an improvement on using timestamp. However, it does mean that different branches can end up with the same version suffix. NerdBank gitversion solves this issue by including the commit hash in the version info for branches other than master + releases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @devhawk, maybe you could create an issue to discuss this tool? I saw your 'thumbs up' on Erik's comment and considered it your approval 😅 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we only build and publish the master branch. So there is no reason to include the commit hash in the version info.