Browse Source

Merge branch 'master' of github.com:AsakusaRinne/TensorFlow.NET into add_cv_compatibility

pull/1047/head
Yaohui Liu 2 years ago
parent
commit
7e9521854d
No known key found for this signature in database GPG Key ID: E86D01E1809BD23E
2 changed files with 154 additions and 0 deletions
  1. +65
    -0
      .github/workflows/build_and_test.yml
  2. +89
    -0
      .github/workflows/release.yml

+ 65
- 0
.github/workflows/build_and_test.yml View File

@@ -0,0 +1,65 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: build_and_test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build-and-test-on-windows:

runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build CPU version
run: dotnet build --no-restore
# - name: Test CPU version
# run: dotnet test --no-build --verbosity normal
- name: uninstall redist cpu for unit tests
run: dotnet remove Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist
- name: install redist gpu for unit tests
run: dotnet add Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Windows-GPU
- name: Restore dependencies
run: dotnet restore
- name: Build GPU version
run: dotnet build --no-restore
# - name: Test GPU version
# run: dotnet test --no-build --verbosity normal

build-and-test-on-linux:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build CPU version
run: dotnet build --no-restore
# - name: Test CPU version
# run: dotnet test --no-build --verbosity normal
- name: uninstall redist cpu for unit tests
run: dotnet remove Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist
- name: install redist gpu for unit tests
run: dotnet add Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Linux-GPU
- name: Restore dependencies
run: dotnet restore
- name: Build GPU version
run: dotnet build --no-restore
# - name: Test GPU version
# run: dotnet test --no-build --verbosity normal

+ 89
- 0
.github/workflows/release.yml View File

@@ -0,0 +1,89 @@
name: release

on:
workflow_run:
workflows: ["build_and_test"]
types:
- completed

env:
MYGET_API_TOKEN: ${{ SECRETS.RINNE_MYGET_KEY }}

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET 6.0.x SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Check .NET info
run: dotnet --info

- name: Install dependencies
run: dotnet restore

- name: Build solution
run: dotnet build -c Release --no-restore

run-semantic-release:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Run semantic-release
run: |
export PATH=$PATH:$(yarn global bin)
yarn global add semantic-release@17.4.3
semantic-release

release:
runs-on: windows-latest
needs: run-semantic-release

steps:
- name: Setup .NET 6.0.x SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

- name: Check .NET info
run: dotnet --info

- name: Install dependencies
run: dotnet restore

- name: Build solution
run: dotnet build -c Release --no-restore

- name: Pack packages
run: |
$LastTag = git describe --tags (git rev-list --tags --max-count=1);
echo "Last tag is: $LastTag";
$Version = ($LastTag).TrimStart('v');
echo "Publishing version: $Version";
dotnet pack -c Release -o packages /p:PackageVersion=$Version /p:Version=$Version;

if($LastExitCode -ne 0)
{
Write-Warning -Message "Pack packages warming, last exit code is ${LastExitCode}."
$LastExitCode = 0;
}

- name: Upload packages artefacts
uses: actions/upload-artifact@v1.0.0
with:
name: "drop-ci-packages"
path: './packages'

- name: Add myget nuget source
run: dotnet nuget add source https://www.myget.org/F/rinne/api/v2/package --name myget.org

- name: Push packages to myget.org
run: dotnet nuget push .\packages\*.nupkg -s myget.org -k $env:MYGET_API_TOKEN --skip-duplicate

Loading…
Cancel
Save