From 4945f4c44c16823d63d29d39b2aebf2d150df31f Mon Sep 17 00:00:00 2001 From: Erik Zhang Date: Tue, 26 Nov 2019 00:34:09 +0800 Subject: [PATCH] Remove Travis and use Github Actions (#1267) --- .github/workflows/dotnetcore.yml | 73 ++++++++++++++++++++++++++++++++ .travis.yml | 41 ------------------ README.md | 4 +- src/neo/neo.csproj | 3 +- 4 files changed, 77 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/dotnetcore.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml new file mode 100644 index 0000000000..2aae8920e8 --- /dev/null +++ b/.github/workflows/dotnetcore.yml @@ -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" + 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 }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f13cecc403..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -language: csharp - -os: - - linux - -dist: bionic -mono: none -dotnet: 3.0.100 - -env: - - TEST_SUITE="without-cultures" - - TEST_SUITE="cultures" - -install: - - dotnet tool install -g dotnet-format - - export PATH="$PATH:$HOME/.dotnet/tools" - - dotnet-format --version -script: | - echo "Checking format..." - dotnet format --check --dry-run -w . -v diagnostic # check C# formatting for neo.sln - cd tests/neo.UnitTests - if [[ "$TEST_SUITE" == "cultures" ]]; then - dotnet test -v m --filter FullyQualifiedName=Neo.UnitTests.UT_Culture.All_Tests_Cultures - else - if [[ "$TEST_SUITE" == "without-cultures" ]]; then - # Test & Calculate coverage - find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - dotnet test -v m --filter FullyQualifiedName!=Neo.UnitTests.UT_Culture.All_Tests_Cultures /p:CollectCoverage=true /p:CoverletOutputFormat=opencover - else - # Only test - dotnet test -v m --filter FullyQualifiedName!=Neo.UnitTests.UT_Culture.All_Tests_Cultures - fi - fi -after_success: | - if [[ "$TEST_SUITE" == "without-cultures" ]]; then - # Send coverage - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - bash <(curl -s https://codecov.io/bash) -v - fi - - diff --git a/README.md b/README.md index ac251a7a77..d567717e71 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ Current neo version. - - Current Coverage Status. + + Coverage Status License. diff --git a/src/neo/neo.csproj b/src/neo/neo.csproj index 5556e8c660..5897121579 100644 --- a/src/neo/neo.csproj +++ b/src/neo/neo.csproj @@ -3,7 +3,8 @@ 2015-2019 The Neo Project Neo - 3.0.0-preview1 + 3.0.0 + preview1 The Neo Project netstandard2.1 true