Skip to content

Commit

Permalink
切换AppVeyor到Github workflow (#323)
Browse files Browse the repository at this point in the history
* add github ci

Signed-off-by: nivalxer <[email protected]>

* add linux/osx ci
fix tests error

Signed-off-by: nivalxer <[email protected]>

* 移除AppVeyor

Signed-off-by: nivalxer <[email protected]>

* add nuget publish step

Signed-off-by: nivalxer <[email protected]>

* remove unless pack

Signed-off-by: nivalxer <[email protected]>

* remove unless cake

Signed-off-by: nivalxer <[email protected]>

* add tag

Signed-off-by: nivalxer <[email protected]>

* fix step Publish CI Packages

Signed-off-by: nivalxer <[email protected]>

* use secret

Signed-off-by: nivalxer <[email protected]>

* bump test sdk version

Signed-off-by: nivalxer <[email protected]>

* try fix ci

Signed-off-by: nivalxer <[email protected]>

* temp disable linux/macos build

Signed-off-by: nivalxer <[email protected]>

---------

Signed-off-by: nivalxer <[email protected]>
  • Loading branch information
nivalxer authored Mar 26, 2024
1 parent 2de0b59 commit ad7004e
Show file tree
Hide file tree
Showing 17 changed files with 185 additions and 576 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build Linux
#on: [push, pull_request]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
8.x
- name: Build Reason
run: "echo ref: ${{github.ref}} event: ${{github.event_name}}"

- name: Build
shell: bash
run: |
for project in $(find ./src -name "*.csproj"); do
dotnet build --configuration Release $project
done
- name: Run Tests
shell: bash
run: |
for project in $(find ./tests -name "*.csproj"); do
dotnet test --configuration Release $project
done
35 changes: 35 additions & 0 deletions .github/workflows/build-osx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build OSX
#on: [push, pull_request]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build:
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
8.x
- name: Build Reason
run: "echo ref: ${{github.ref}} event: ${{github.event_name}}"

- name: Build
shell: bash
run: |
for project in $(find ./src -name "*.csproj"); do
dotnet build --configuration Release $project
done
- name: Run Tests
shell: bash
run: |
for project in $(find ./tests -name "*.csproj"); do
dotnet test --configuration Release $project
done
90 changes: 90 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build Windows
on: [push, pull_request]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
8.x
- name: Build Reason
run: "echo ref: ${{github.ref}} event: ${{github.event_name}}"

- name: Build Version
shell: pwsh
run: |
$versionPropsPath = "./build/version.props"
[xml]$versionProps = Get-Content $versionPropsPath
$versionMajor = $versionProps.Project.PropertyGroup.VersionMajor
$versionMinor = $versionProps.Project.PropertyGroup.VersionMinor
$versionPatch = $versionProps.Project.PropertyGroup.VersionPatch
$versionQuality = $versionProps.Project.PropertyGroup.VersionQuality
$versionPrefix = "$versionMajor.$versionMinor.$versionPatch"
if (-not [string]::IsNullOrWhiteSpace($versionQuality)) {
$versionPrefix = "$versionPrefix.$versionQuality"
}
$tag = git tag --points-at HEAD
if ([string]::IsNullOrWhiteSpace($tag)) {
$timestamp = Get-Date -Format "yyyyMMddHHmmss"
$versionPrefix = "$versionPrefix-preview-$timestamp"
}
echo "Full Version: $versionPrefix"
Add-Content -Path $Env:GITHUB_ENV -Value "FULL_VERSION=$versionPrefix"
- name: Build
shell: bash
run: |
for project in $(find ./src -name "*.csproj"); do
dotnet build --configuration Release $project -p:Version=${{ env.FULL_VERSION }}
done
- name: Run Tests
shell: bash
run: |
for project in $(find ./tests -name "*.csproj"); do
dotnet test --configuration Release $project
done
- name: Package
shell: bash
if: github.event_name != 'pull_request'
run: |
for project in $(find ./src -name "*.csproj"); do
dotnet pack --configuration Release --no-build $project -p:PackageVersion=${{ env.FULL_VERSION }} -p:SymbolPackageFormat=snupkg --include-source --output ./artifacts/packages
done
- name: Install GitHub Package Tool
if: github.event_name != 'pull_request'
run: dotnet tool install gpr -g

- name: Publish CI Packages
shell: bash
if: github.event_name != 'pull_request'
run: |
for package in $(find ./artifacts/packages/ -name "*.nupkg" -o -name "*.snupkg"); do
echo "$package": Pushing $package...
# GitHub
echo "Pushing to GitHub Package Registry..."
gpr push "$package" -k ${{ secrets.GITHUB_TOKEN }} || echo "Skipping: Package push failed or already exists."
# myget
echo "Pushing to MyGet..."
dotnet nuget push "$package" \
--source "https://www.myget.org/F/aspectcore/api/v2/package" \
--api-key ${{ secrets.MYGET_API_TOKEN }} \
--skip-duplicate || echo "Skipping: Package push failed or already exists."
done
22 changes: 0 additions & 22 deletions appveyor.yml

This file was deleted.

104 changes: 0 additions & 104 deletions build.cake

This file was deleted.

Loading

0 comments on commit ad7004e

Please sign in to comment.