Skip to content

Commit ad7004e

Browse files
authored
切换AppVeyor到Github workflow (#323)
* add github ci Signed-off-by: nivalxer <nivalxer@gmail.com> * add linux/osx ci fix tests error Signed-off-by: nivalxer <nivalxer@gmail.com> * 移除AppVeyor Signed-off-by: nivalxer <nivalxer@gmail.com> * add nuget publish step Signed-off-by: nivalxer <nivalxer@gmail.com> * remove unless pack Signed-off-by: nivalxer <nivalxer@gmail.com> * remove unless cake Signed-off-by: nivalxer <nivalxer@gmail.com> * add tag Signed-off-by: nivalxer <nivalxer@gmail.com> * fix step Publish CI Packages Signed-off-by: nivalxer <nivalxer@gmail.com> * use secret Signed-off-by: nivalxer <nivalxer@gmail.com> * bump test sdk version Signed-off-by: nivalxer <nivalxer@gmail.com> * try fix ci Signed-off-by: nivalxer <nivalxer@gmail.com> * temp disable linux/macos build Signed-off-by: nivalxer <nivalxer@gmail.com> --------- Signed-off-by: nivalxer <nivalxer@gmail.com>
1 parent 2de0b59 commit ad7004e

File tree

17 files changed

+185
-576
lines changed

17 files changed

+185
-576
lines changed

.github/workflows/build-linux.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Linux
2+
#on: [push, pull_request]
3+
env:
4+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
- name: Setup .NET Core
14+
uses: actions/setup-dotnet@v4
15+
with:
16+
dotnet-version: |
17+
6.x
18+
8.x
19+
20+
- name: Build Reason
21+
run: "echo ref: ${{github.ref}} event: ${{github.event_name}}"
22+
23+
- name: Build
24+
shell: bash
25+
run: |
26+
for project in $(find ./src -name "*.csproj"); do
27+
dotnet build --configuration Release $project
28+
done
29+
30+
- name: Run Tests
31+
shell: bash
32+
run: |
33+
for project in $(find ./tests -name "*.csproj"); do
34+
dotnet test --configuration Release $project
35+
done
36+

.github/workflows/build-osx.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build OSX
2+
#on: [push, pull_request]
3+
env:
4+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
5+
jobs:
6+
build:
7+
runs-on: macOS-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
- name: Setup .NET Core
14+
uses: actions/setup-dotnet@v4
15+
with:
16+
dotnet-version: |
17+
6.x
18+
8.x
19+
20+
- name: Build Reason
21+
run: "echo ref: ${{github.ref}} event: ${{github.event_name}}"
22+
23+
- name: Build
24+
shell: bash
25+
run: |
26+
for project in $(find ./src -name "*.csproj"); do
27+
dotnet build --configuration Release $project
28+
done
29+
30+
- name: Run Tests
31+
shell: bash
32+
run: |
33+
for project in $(find ./tests -name "*.csproj"); do
34+
dotnet test --configuration Release $project
35+
done

.github/workflows/build-windows.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build Windows
2+
on: [push, pull_request]
3+
env:
4+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
5+
jobs:
6+
build:
7+
runs-on: windows-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
- name: Setup .NET Core
14+
uses: actions/setup-dotnet@v4
15+
with:
16+
dotnet-version: |
17+
6.x
18+
8.x
19+
20+
- name: Build Reason
21+
run: "echo ref: ${{github.ref}} event: ${{github.event_name}}"
22+
23+
- name: Build Version
24+
shell: pwsh
25+
run: |
26+
$versionPropsPath = "./build/version.props"
27+
[xml]$versionProps = Get-Content $versionPropsPath
28+
$versionMajor = $versionProps.Project.PropertyGroup.VersionMajor
29+
$versionMinor = $versionProps.Project.PropertyGroup.VersionMinor
30+
$versionPatch = $versionProps.Project.PropertyGroup.VersionPatch
31+
$versionQuality = $versionProps.Project.PropertyGroup.VersionQuality
32+
$versionPrefix = "$versionMajor.$versionMinor.$versionPatch"
33+
34+
if (-not [string]::IsNullOrWhiteSpace($versionQuality)) {
35+
$versionPrefix = "$versionPrefix.$versionQuality"
36+
}
37+
38+
$tag = git tag --points-at HEAD
39+
if ([string]::IsNullOrWhiteSpace($tag)) {
40+
$timestamp = Get-Date -Format "yyyyMMddHHmmss"
41+
$versionPrefix = "$versionPrefix-preview-$timestamp"
42+
}
43+
44+
echo "Full Version: $versionPrefix"
45+
Add-Content -Path $Env:GITHUB_ENV -Value "FULL_VERSION=$versionPrefix"
46+
47+
- name: Build
48+
shell: bash
49+
run: |
50+
for project in $(find ./src -name "*.csproj"); do
51+
dotnet build --configuration Release $project -p:Version=${{ env.FULL_VERSION }}
52+
done
53+
54+
- name: Run Tests
55+
shell: bash
56+
run: |
57+
for project in $(find ./tests -name "*.csproj"); do
58+
dotnet test --configuration Release $project
59+
done
60+
61+
- name: Package
62+
shell: bash
63+
if: github.event_name != 'pull_request'
64+
run: |
65+
for project in $(find ./src -name "*.csproj"); do
66+
dotnet pack --configuration Release --no-build $project -p:PackageVersion=${{ env.FULL_VERSION }} -p:SymbolPackageFormat=snupkg --include-source --output ./artifacts/packages
67+
done
68+
69+
- name: Install GitHub Package Tool
70+
if: github.event_name != 'pull_request'
71+
run: dotnet tool install gpr -g
72+
73+
- name: Publish CI Packages
74+
shell: bash
75+
if: github.event_name != 'pull_request'
76+
run: |
77+
for package in $(find ./artifacts/packages/ -name "*.nupkg" -o -name "*.snupkg"); do
78+
echo "$package": Pushing $package...
79+
80+
# GitHub
81+
echo "Pushing to GitHub Package Registry..."
82+
gpr push "$package" -k ${{ secrets.GITHUB_TOKEN }} || echo "Skipping: Package push failed or already exists."
83+
84+
# myget
85+
echo "Pushing to MyGet..."
86+
dotnet nuget push "$package" \
87+
--source "https://www.myget.org/F/aspectcore/api/v2/package" \
88+
--api-key ${{ secrets.MYGET_API_TOKEN }} \
89+
--skip-duplicate || echo "Skipping: Package push failed or already exists."
90+
done

appveyor.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

build.cake

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)