From d7411c268a491a9b615bebe50a022bb9504a2330 Mon Sep 17 00:00:00 2001 From: Kerry Jiang Date: Sat, 25 May 2024 17:58:37 -0700 Subject: [PATCH] added build pipelines in github actions --- .github/workflows/build.yml | 39 +++++++++++++++++++++++++++++++++++++ .github/workflows/myget.yml | 24 +++++++++++++++++++++++ .travis.yml | 11 ----------- version.json | 17 ++++++++++++++++ 4 files changed, 80 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/myget.yml delete mode 100644 .travis.yml create mode 100644 version.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6094eff --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: build + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + - macos-latest + runs-on: ${{matrix.os}} + steps: + - uses: actions/checkout@v1 + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + - name: Set env + run: | + echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV + echo "DOTNET_hostBuilder:reloadConfigOnChange=false" >> $GITHUB_ENV + - name: Clean + run: | + dotnet clean ./NetInteractor.sln + dotnet nuget locals all --clear + - name: Build + run: dotnet build -c Release + - name: Test + run: | + cd test/NetInteractor.Test + dotnet test \ No newline at end of file diff --git a/.github/workflows/myget.yml b/.github/workflows/myget.yml new file mode 100644 index 0000000..dda8de9 --- /dev/null +++ b/.github/workflows/myget.yml @@ -0,0 +1,24 @@ +name: myget + +on: + push: + branches: + - master + +jobs: + push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + - name: Set env + run: echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV + - uses: dotnet/nbgv@master + id: nbgv + - name: Pack + run: dotnet pack -c Release -p:PackageVersion=${{ steps.nbgv.outputs.NuGetPackageVersion }}.${{ github.run_number }} -p:Version=${{ steps.nbgv.outputs.NuGetPackageVersion }}.${{ github.run_number }} -p:AssemblyVersion=${{ steps.nbgv.outputs.AssemblyVersion }} -p:AssemblyFileVersion=${{ steps.nbgv.outputs.AssemblyFileVersion }} -p:AssemblyInformationalVersion=${{ steps.nbgv.outputs.AssemblyInformationalVersion }} /p:NoPackageAnalysis=true + - name: Push + run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.MYGET_API_KEY }} --source https://www.myget.org/F/kerrylab/api/v3/index.json \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e1283f1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -dist: xenial -language: csharp -mono: none -dotnet: 2.2 -sudo: required -script: - - dotnet restore - - dotnet build -global: - - DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true - - DOTNET_CLI_TELEMETRY_OPTOUT=1 \ No newline at end of file diff --git a/version.json b/version.json new file mode 100644 index 0000000..ef96c49 --- /dev/null +++ b/version.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "0.4.0", + "publicReleaseRefSpec": [ + "^refs/heads/master$", + "^refs/heads/v\\d+(?:\\.\\d+)?$" + ], + "cloudBuild": { + "buildNumber": { + "enabled": true, + "setVersionVariables": true + } + }, + "nugetPackageVersion": { + "semVer": 2 + } +} \ No newline at end of file