Skip to content

Commit

Permalink
Feature/migrate to GitHub actions (#113)
Browse files Browse the repository at this point in the history
* Migrate to github actions
  • Loading branch information
ZEXSM authored Oct 29, 2023
1 parent 64ca0b8 commit 050a220
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 75 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci-cd.yml
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
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

10 changes: 9 additions & 1 deletion OData.QueryBuilder.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "items", "items", "{179F88B9-A06D-4505-9266-A5D66004601C}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
.travis.yml = .travis.yml
README.md = README.md
EndProjectSection
EndProject
Expand All @@ -27,6 +26,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OData.QueryBuilder.Benchmar
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OData.QueryBuilder.Fakes", "test\OData.QueryBuilder.Fakes\OData.QueryBuilder.Fakes.csproj", "{421FF96A-2F4E-4589-AF2A-604FDC8BE2AC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github", "github", "{C1D8FFE9-07E2-4EA7-AF59-C5A68F7DB89C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{D95B88FB-7257-421E-8AA3-BD85C63ECBE6}"
ProjectSection(SolutionItems) = preProject
.github\workflows\ci-cd.yml = .github\workflows\ci-cd.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -59,6 +65,8 @@ Global
{B8F31CF9-EDE2-4813-A9AC-EBF3514FFE82} = {179F88B9-A06D-4505-9266-A5D66004601C}
{3C66CF4E-8FA0-4E81-90DB-B22234A2670C} = {26982440-340F-48A2-9D73-44DB6C52EBF1}
{421FF96A-2F4E-4589-AF2A-604FDC8BE2AC} = {26982440-340F-48A2-9D73-44DB6C52EBF1}
{C1D8FFE9-07E2-4EA7-AF59-C5A68F7DB89C} = {179F88B9-A06D-4505-9266-A5D66004601C}
{D95B88FB-7257-421E-8AA3-BD85C63ECBE6} = {C1D8FFE9-07E2-4EA7-AF59-C5A68F7DB89C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1D51B9A3-94B0-48DF-BFF5-110B13303535}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Library for creating complex OData queries (OData version 4.01) based on data models with linq syntax.

[![Build Status](https://travis-ci.com/ZEXSM/OData.QueryBuilder.svg?branch=main)](https://travis-ci.com/ZEXSM/OData.QueryBuilder)
[![Coverage Status](https://coveralls.io/repos/github/ZEXSM/OData.QueryBuilder/badge.svg?branch=master)](https://coveralls.io/github/ZEXSM/OData.QueryBuilder?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/ZEXSM/OData.QueryBuilder/badge.svg?branch=master)](https://coveralls.io/github/ZEXSM/OData.QueryBuilder?branch=main)
[![Nuget Status](https://img.shields.io/nuget/dt/OData.QueryBuilder.svg)](https://www.nuget.org/packages/OData.QueryBuilder)

## Benefits
Expand Down
2 changes: 1 addition & 1 deletion src/OData.QueryBuilder/OData.QueryBuilder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>OData.QueryBuilder</PackageId>
<PackageId>DotNetToolTest</PackageId>
<PackageVersion>$(PackageVersion)</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
Expand Down
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 test/OData.QueryBuilder.Fakes/OData.QueryBuilder.Fakes.csproj
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 test/OData.QueryBuilder.Test/OData.QueryBuilder.Test.csproj
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>

0 comments on commit 050a220

Please sign in to comment.