-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/migrate to GitHub actions (#113)
* Migrate to github actions
- Loading branch information
Showing
8 changed files
with
116 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: OData.QueryBuilder ci\cd | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
env: | ||
DOTNET_VERSION: '3.1.x' | ||
jobs: | ||
ci: | ||
name: build&test&coverage(${{matrix.os}}) | ||
runs-on: ${{ matrix.os }} | ||
environment: ci | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup .NET SDK ${{ matrix.dotnet-version }} | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
- name: Build | ||
run: dotnet build -c ${{ vars.CONFIGURATION }} | ||
- name: Test | ||
run: dotnet test -c ${{ vars.CONFIGURATION }} --no-build | ||
- name: Coveralls | ||
run: | | ||
dotnet minicover instrument | ||
dotnet minicover reset | ||
dotnet test -c ${{ vars.CONFIGURATION }} --no-build | ||
dotnet minicover uninstrument | ||
dotnet minicover report | ||
dotnet minicover coverallsreport --service-name "github" \ | ||
--service-job-id ${{ github.run_id }} \ | ||
--repo-token ${{ secrets.COVERALLS_REPO_TOKEN }} \ | ||
--branch ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} \ | ||
--commit ${{ github.sha }} | ||
cd: | ||
needs: ci | ||
if: github.ref == 'refs/heads/main' | ||
name: publish&release | ||
runs-on: ubuntu-latest | ||
environment: cd | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Create tag | ||
id: create_tag | ||
run: | | ||
git fetch --tags --force &> /dev/null | ||
PR_TITLE=$(git log -1 --pretty='%f') | ||
LAST_TAG=$(echo $(git describe --tags $(git rev-list --tags --max-count=1)) | cut -d'v' -f 2) | ||
CURRENT_MAJOR=$(echo $LAST_TAG | cut -d. -f 1) | ||
CURRENT_MINOR=$(echo $LAST_TAG | cut -d. -f 2) | ||
CURRENT_PATCH=$(echo $(echo $LAST_TAG | cut -d. -f 3) | cut -d- -f 1) | ||
RC=$(echo $(echo $LAST_TAG | cut -d. -f 3) | cut -d- -f 2) | ||
MAJOR=$(([ "$RC" == "rc" ] && echo $CURRENT_MAJOR) || ([ "$(echo $PR_TITLE | grep -oP 'release')" == "release" ] && echo $(($CURRENT_MAJOR+1))) || echo $CURRENT_MAJOR) | ||
MINOR=$(([ "$RC" == "rc" ] && echo $CURRENT_MINOR) || ([ "$(echo $PR_TITLE | grep -oP 'release')" == "release" ] && echo 0) || ([ "$(echo $PR_TITLE | grep -oP 'feature')" == "feature" ] && echo $(($CURRENT_MINOR+1))) || echo $CURRENT_MINOR) | ||
PATCH=$(([ "$RC" == "rc" ] && echo $CURRENT_PATCH) || ([ "$(echo $PR_TITLE | grep -oP 'release')" == "release" ] && echo 0) || ([ "$(echo $PR_TITLE | grep -oP 'feature')" == "feature" ] && echo 0) || echo $(($CURRENT_PATCH+1))) | ||
NEW_TAG=$(echo $MAJOR.$MINOR.$PATCH) | ||
PACKAGE_VERSION=${NEW_TAG:-${{ vars.DEFAULT_PACKAGE_VERSION }}} | ||
echo "release_package_version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" | ||
echo $PACKAGE_VERSION | ||
- name: Pack | ||
run: dotnet pack -c ${{ vars.CONFIGURATION }} -p:PackageVersion=${{ steps.create_tag.outputs.release_package_version }} | ||
- name: Release | ||
env: | ||
GH_TOKEN: ${{ secrets.ACCSESS_TOKEN }} | ||
run: | | ||
dotnet nuget push ./src/OData.QueryBuilder/bin/Release/OData.QueryBuilder.${{ steps.create_tag.outputs.release_package_version }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s ${{ vars.NUGET_SOURCE }} | ||
git tag v${{ steps.create_tag.outputs.release_package_version }} | ||
git push origin v${{ steps.create_tag.outputs.release_package_version }} | ||
gh release create v${{ steps.create_tag.outputs.release_package_version }} --generate-notes |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 12 additions & 11 deletions
23
test/OData.QueryBuilder.Benchmark/OData.QueryBuilder.Benchmark.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<IsPackable>false</IsPackable> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\OData.QueryBuilder\OData.QueryBuilder.csproj" /> | ||
<ProjectReference Include="..\OData.QueryBuilder.Fakes\OData.QueryBuilder.Fakes.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\OData.QueryBuilder\OData.QueryBuilder.csproj" /> | ||
<ProjectReference Include="..\OData.QueryBuilder.Fakes\OData.QueryBuilder.Fakes.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
7 changes: 4 additions & 3 deletions
7
test/OData.QueryBuilder.Fakes/OData.QueryBuilder.Fakes.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
</Project> |
28 changes: 14 additions & 14 deletions
28
test/OData.QueryBuilder.Test/OData.QueryBuilder.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="5.10.3" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\OData.QueryBuilder\OData.QueryBuilder.csproj" /> | ||
<ProjectReference Include="..\OData.QueryBuilder.Fakes\OData.QueryBuilder.Fakes.csproj" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="5.10.3" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\OData.QueryBuilder\OData.QueryBuilder.csproj" /> | ||
<ProjectReference Include="..\OData.QueryBuilder.Fakes\OData.QueryBuilder.Fakes.csproj" /> | ||
</ItemGroup> | ||
</Project> |